Commit 5963267b5f497dbede86c0c9aa8850f4024d14a6

Authored by Jay Berkenbilt
1 parent 04fe9cc2

Discard stderr from gs when comparing images.

This works around cases where gs falsely complains about things in the
PDF files or gives warnings that don't harm the output.  See comments
in qpdf.test for details.
Showing 2 changed files with 10 additions and 6 deletions
@@ -5,10 +5,6 @@ Next @@ -5,10 +5,6 @@ Next
5 5
6 * Fix documentation errors in debian bug reports 6 * Fix documentation errors in debian bug reports
7 7
8 - * good17.pdf, good18.pdf, and hybrid-xref.pdf have incorrect hybrid  
9 - reference sections. Review section 3.4 of the PDF specification  
10 - and make sure ghostscript doesn't complain about the files.  
11 -  
12 General 8 General
13 ======= 9 =======
14 10
qpdf/qtest/qpdf.test
@@ -1463,10 +1463,18 @@ sub compare_pdfs @@ -1463,10 +1463,18 @@ sub compare_pdfs
1463 } 1463 }
1464 else 1464 else
1465 { 1465 {
  1466 + # We discard gs's stderr since it has sometimes been known to
  1467 + # complain about files that are not bad. In particular, gs
  1468 + # 9.04 can't handle empty xref sections such as those found in
  1469 + # the hybrid xref cases. We don't really care whether gs
  1470 + # complains or not as long as it creates correct images. If
  1471 + # it doesn't create correct images, the test will fail, and we
  1472 + # can run manually to see the error message. If it does, then
  1473 + # we don't care about the warning.
1466 $td->runtest("convert original file to image", 1474 $td->runtest("convert original file to image",
1467 {$td->COMMAND => 1475 {$td->COMMAND =>
1468 "(cd tif1;" . 1476 "(cd tif1;" .
1469 - " gs -q -dNOPAUSE -sDEVICE=tiff12nc" . 1477 + " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff12nc" .
1470 " -sOutputFile=a.tif - < ../$f1)"}, 1478 " -sOutputFile=a.tif - < ../$f1)"},
1471 {$td->STRING => "", 1479 {$td->STRING => "",
1472 $td->EXIT_STATUS => 0}); 1480 $td->EXIT_STATUS => 0});
@@ -1485,7 +1493,7 @@ sub compare_pdfs @@ -1485,7 +1493,7 @@ sub compare_pdfs
1485 $td->runtest("convert new file to image", 1493 $td->runtest("convert new file to image",
1486 {$td->COMMAND => 1494 {$td->COMMAND =>
1487 "(cd tif2;" . 1495 "(cd tif2;" .
1488 - " gs -q -dNOPAUSE -sDEVICE=tiff12nc" . 1496 + " gs 2>/dev/null -q -dNOPAUSE -sDEVICE=tiff12nc" .
1489 " -sOutputFile=a.tif - < ../$f2)"}, 1497 " -sOutputFile=a.tif - < ../$f2)"},
1490 {$td->STRING => "", 1498 {$td->STRING => "",
1491 $td->EXIT_STATUS => 0}); 1499 $td->EXIT_STATUS => 0});