Commit c67634afa045b9b1e54c85942c14982ac68678e7

Authored by Jay Berkenbilt
1 parent 49621ef5

Fix tests when running comparison tool is adequate

Fix all tests where the only required fix is to run qpdf-test-compare
instead of doing a simple file comparison.
examples/CMakeLists.txt
... ... @@ -45,6 +45,7 @@ add_test(
45 45 --top ${qpdf_SOURCE_DIR}
46 46 --bin $<TARGET_FILE_DIR:pdf-create>
47 47 --bin $<TARGET_FILE_DIR:qpdf>
  48 + --bin $<TARGET_FILE_DIR:qpdf-test-compare>
48 49 --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL
49 50 --code ${qpdf_SOURCE_DIR}/examples
50 51 --color ${QTEST_COLOR}
... ...
examples/qtest/c-objects.test
... ... @@ -17,8 +17,8 @@ foreach my $i (qw(1 2))
17 17 {$td->COMMAND => "pdf-c-objects $i.pdf '' a.pdf"},
18 18 {$td->STRING => "", $td->EXIT_STATUS => 0});
19 19 $td->runtest("check output",
20   - {$td->FILE => "a.pdf"},
21   - {$td->FILE => "$i-out.pdf"});
  20 + {$td->COMMAND => "qpdf-test-compare a.pdf $i-out.pdf"},
  21 + {$td->FILE => "$i-out.pdf", $td->EXIT_STATUS => 0});
22 22 }
23 23  
24 24 cleanup();
... ...
examples/qtest/custom-filter.test
... ... @@ -24,8 +24,8 @@ $td-&gt;runtest(&quot;custom filter, decode generalized&quot;,
24 24 $td->EXIT_STATUS => 0},
25 25 $td->NORMALIZE_NEWLINES);
26 26 $td->runtest("check output",
27   - {$td->FILE => "a.pdf"},
28   - {$td->FILE => "generalized.pdf"});
  27 + {$td->COMMAND => "qpdf-test-compare a.pdf generalized.pdf"},
  28 + {$td->FILE => "generalized.pdf", $td->EXIT_STATUS => 0});
29 29  
30 30 $td->runtest("custom filter, decode specialized",
31 31 {$td->COMMAND =>
... ... @@ -34,8 +34,8 @@ $td-&gt;runtest(&quot;custom filter, decode specialized&quot;,
34 34 $td->EXIT_STATUS => 0},
35 35 $td->NORMALIZE_NEWLINES);
36 36 $td->runtest("check output",
37   - {$td->FILE => "a.pdf"},
38   - {$td->FILE => "specialized.pdf"});
  37 + {$td->COMMAND => "qpdf-test-compare a.pdf specialized.pdf"},
  38 + {$td->FILE => "specialized.pdf", $td->EXIT_STATUS => 0});
39 39  
40 40 cleanup();
41 41  
... ...
examples/qtest/invert-images.test
... ... @@ -20,8 +20,8 @@ $td-&gt;runtest(&quot;invert images&quot;,
20 20 $td->NORMALIZE_NEWLINES);
21 21  
22 22 $td->runtest("check output",
23   - {$td->FILE => "a.pdf"},
24   - {$td->FILE => "out.pdf"});
  23 + {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"},
  24 + {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0});
25 25  
26 26 cleanup();
27 27  
... ...
examples/qtest/overlay-page.test
... ... @@ -15,15 +15,15 @@ $td-&gt;runtest(&quot;overlay-page&quot;,
15 15 {$td->COMMAND => "pdf-overlay-page in.pdf stamp.pdf a.pdf"},
16 16 {$td->STRING => "", $td->EXIT_STATUS => 0});
17 17 $td->runtest("compare files",
18   - {$td->FILE => "a.pdf"},
19   - {$td->FILE => "out.pdf"});
  18 + {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"},
  19 + {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0});
20 20  
21 21 $td->runtest("overlay-page with fields/ annotations",
22 22 {$td->COMMAND => "pdf-overlay-page in.pdf annotations.pdf a.pdf"},
23 23 {$td->STRING => "", $td->EXIT_STATUS => 0});
24 24 $td->runtest("compare files",
25   - {$td->FILE => "a.pdf"},
26   - {$td->FILE => "annotations-out.pdf"});
  25 + {$td->COMMAND => "qpdf-test-compare a.pdf annotations-out.pdf"},
  26 + {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0});
27 27  
28 28 cleanup();
29 29  
... ...
examples/qtest/qpdfjob-remove-annotations.test
... ... @@ -15,8 +15,8 @@ $td-&gt;runtest(&quot;remove-annotations&quot;,
15 15 {$td->COMMAND => "qpdfjob-remove-annotations --static-id annotations.pdf out.pdf"},
16 16 {$td->STRING => "", $td->EXIT_STATUS => 0});
17 17 $td->runtest("compare files",
18   - {$td->FILE => "out.pdf"},
19   - {$td->FILE => "annotations-out.pdf"});
  18 + {$td->COMMAND => "qpdf-test-compare out.pdf annotations-out.pdf"},
  19 + {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0});
20 20  
21 21 cleanup();
22 22  
... ...
examples/qtest/set-form-values.test
... ... @@ -15,8 +15,8 @@ $td-&gt;runtest(&quot;set form values&quot;,
15 15 {$td->COMMAND => "pdf-set-form-values form-in.pdf a.pdf soup"},
16 16 {$td->STRING => "", $td->EXIT_STATUS => 0});
17 17 $td->runtest("compare files",
18   - {$td->FILE => "a.pdf"},
19   - {$td->FILE => "form-out.pdf"});
  18 + {$td->COMMAND => "qpdf-test-compare a.pdf form-out.pdf"},
  19 + {$td->FILE => "form-out.pdf", $td->EXIT_STATUS => 0});
20 20  
21 21 cleanup();
22 22  
... ...
qpdf/CMakeLists.txt
... ... @@ -55,6 +55,7 @@ add_test(
55 55 --top ${qpdf_SOURCE_DIR}
56 56 --bin $<TARGET_FILE_DIR:qpdf>
57 57 --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL
  58 + --bin $<TARGET_FILE_DIR:qpdf-test-compare>
58 59 --code ${qpdf_SOURCE_DIR}/qpdf
59 60 --color ${QTEST_COLOR}
60 61 --show-on-failure ${SHOW_FAILED_TEST_OUTPUT}
... ...
qpdf/qtest/attachments.test
... ... @@ -207,8 +207,8 @@ $td-&gt;runtest(&quot;remove multiple attachments&quot;,
207 207 $td->EXIT_STATUS => 0},
208 208 $td->NORMALIZE_NEWLINES);
209 209 $td->runtest("check output",
210   - {$td->FILE => "a.pdf"},
211   - {$td->FILE => "remove-multiple-attachments.pdf"});
  210 + {$td->COMMAND => "qpdf-test-compare a.pdf remove-multiple-attachments.pdf"},
  211 + {$td->FILE => "remove-multiple-attachments.pdf", $td->EXIT_STATUS => 0});
212 212 $td->runtest("remove multiple attachments (json)",
213 213 {$td->COMMAND =>
214 214 "qpdf --job-json-file=remove-multiple-attachments.json"},
... ... @@ -216,8 +216,8 @@ $td-&gt;runtest(&quot;remove multiple attachments (json)&quot;,
216 216 $td->EXIT_STATUS => 0},
217 217 $td->NORMALIZE_NEWLINES);
218 218 $td->runtest("check output",
219   - {$td->FILE => "b.pdf"},
220   - {$td->FILE => "remove-multiple-attachments.pdf"});
  219 + {$td->COMMAND => "qpdf-test-compare b.pdf remove-multiple-attachments.pdf"},
  220 + {$td->FILE => "remove-multiple-attachments.pdf", $td->EXIT_STATUS => 0});
221 221  
222 222 cleanup();
223 223 $td->report($n_tests);
... ...
qpdf/qtest/c-api.test
... ... @@ -36,8 +36,8 @@ foreach my $d (@capi)
36 36 {$td->STRING => "C test $n done\n", $td->EXIT_STATUS => 0},
37 37 $td->NORMALIZE_NEWLINES);
38 38 $td->runtest("check $description",
39   - {$td->FILE => "a.pdf"},
40   - {$td->FILE => $outfile});
  39 + {$td->COMMAND => "qpdf-test-compare a.pdf $outfile"},
  40 + {$td->FILE => $outfile, $td->EXIT_STATUS => 0});
41 41 }
42 42 $td->runtest("write to bad file name",
43 43 {$td->COMMAND => "qpdf-ctest 2 hybrid-xref.pdf '' /:a:/:b:"},
... ...
qpdf/qtest/coalesce-contents.test
... ... @@ -46,8 +46,8 @@ $td-&gt;runtest(&quot;coalesce contents without qdf&quot;,
46 46 " --coalesce-contents coalesce.pdf a.pdf"},
47 47 {$td->STRING => "", $td->EXIT_STATUS => 0});
48 48 $td->runtest("check output",
49   - {$td->FILE => "a.pdf"},
50   - {$td->FILE => "coalesce-out.pdf"});
  49 + {$td->COMMAND => "qpdf-test-compare a.pdf coalesce-out.pdf"},
  50 + {$td->FILE => "coalesce-out.pdf", $td->EXIT_STATUS => 0});
51 51  
52 52 cleanup();
53 53 $td->report($n_tests);
... ...
qpdf/qtest/copy-annotations.test
... ... @@ -110,8 +110,8 @@ $td-&gt;runtest(&quot;keeping some fields&quot;,
110 110 {$td->STRING => "", $td->EXIT_STATUS => 0},
111 111 $td->NORMALIZE_NEWLINES);
112 112 $td->runtest("check output",
113   - {$td->FILE => "a.pdf"},
114   - {$td->FILE => "kept-some-fields.pdf"});
  113 + {$td->COMMAND => "qpdf-test-compare a.pdf kept-some-fields.pdf"},
  114 + {$td->FILE => "kept-some-fields.pdf", $td->EXIT_STATUS => 0});
115 115 $td->runtest("not keeping any fields",
116 116 {$td->COMMAND =>
117 117 "qpdf --static-id kept-some-fields.pdf" .
... ...
qpdf/qtest/custom-pipeline.test
... ... @@ -21,8 +21,8 @@ $td-&gt;runtest(&quot;output to custom pipeline&quot;,
21 21 {$td->STRING => "test 33 done\n", $td->EXIT_STATUS => 0},
22 22 $td->NORMALIZE_NEWLINES);
23 23 $td->runtest("check output",
24   - {$td->FILE => "a.pdf"},
25   - {$td->FILE => "custom-pipeline.pdf"});
  24 + {$td->COMMAND => "qpdf-test-compare a.pdf custom-pipeline.pdf"},
  25 + {$td->FILE => "custom-pipeline.pdf", $td->EXIT_STATUS => 0});
26 26  
27 27 cleanup();
28 28 $td->report($n_tests);
... ...
qpdf/qtest/dangling-refs.test
... ... @@ -24,8 +24,8 @@ foreach my $f (@dangling)
24 24 {$td->FILE => "$f-dangling.out", $td->EXIT_STATUS => 0},
25 25 $td->NORMALIZE_NEWLINES);
26 26 $td->runtest("check output",
27   - {$td->FILE => "a.pdf"},
28   - {$td->FILE => "$f-dangling-out.pdf"});
  27 + {$td->COMMAND => "qpdf-test-compare a.pdf $f-dangling-out.pdf"},
  28 + {$td->FILE => "$f-dangling-out.pdf", $td->EXIT_STATUS => 0});
29 29 }
30 30 cleanup();
31 31 $td->report($n_tests);
... ...
qpdf/qtest/decode-parameters.test
... ... @@ -34,8 +34,8 @@ $td-&gt;runtest(&quot;stream with indirect decode parms&quot;,
34 34 "qpdf --static-id indirect-decode-parms.pdf a.pdf"},
35 35 {$td->STRING => "", $td->EXIT_STATUS => 0});
36 36 $td->runtest("check file",
37   - {$td->FILE => "a.pdf"},
38   - {$td->FILE => "indirect-decode-parms-out.pdf"});
  37 + {$td->COMMAND => "qpdf-test-compare a.pdf indirect-decode-parms-out.pdf"},
  38 + {$td->FILE => "indirect-decode-parms-out.pdf", $td->EXIT_STATUS => 0});
39 39  
40 40 $td->runtest("decode parameters empty list",
41 41 {$td->COMMAND => "qpdf --static-id empty-decode-parms.pdf a.pdf"},
... ...
qpdf/qtest/encryption.test
... ... @@ -404,8 +404,8 @@ foreach my $d (@cenc)
404 404 if (-f $pdf_outfile)
405 405 {
406 406 $td->runtest("check $description content",
407   - {$td->FILE => "a.pdf"},
408   - {$td->FILE => $pdf_outfile});
  407 + {$td->COMMAND => "qpdf-test-compare a.pdf $pdf_outfile"},
  408 + {$td->FILE => $pdf_outfile, $td->EXIT_STATUS => 0});
409 409 }
410 410 else
411 411 {
... ... @@ -491,8 +491,8 @@ $td-&gt;runtest(&quot;convert encrypted to qdf&quot;,
491 491 " --qdf a.pdf b.qdf"},
492 492 {$td->STRING => "", $td->EXIT_STATUS => 0});
493 493 $td->runtest("compare files",
494   - {$td->FILE => 'a.qdf'},
495   - {$td->FILE => 'b.qdf'});
  494 + {$td->COMMAND => "qpdf-test-compare a.qdf b.qdf"},
  495 + {$td->FILE => 'b.qdf', $td->EXIT_STATUS => 0});
496 496 $td->runtest("linearize with AES and object streams",
497 497 {$td->COMMAND => "qpdf --encrypt '' o 128 --use-aes=y --" .
498 498 " --linearize --object-streams=generate enc-base.pdf a.pdf"},
... ... @@ -564,8 +564,8 @@ foreach my $d ([&#39;--force-V4&#39;, &#39;V4&#39;],
564 564 " enc-base.pdf a.pdf"},
565 565 {$td->STRING => "", $td->EXIT_STATUS => 0});
566 566 $td->runtest("check output",
567   - {$td->FILE => "a.pdf"},
568   - {$td->FILE => "$out.pdf"});
  567 + {$td->COMMAND => "qpdf-test-compare a.pdf $out.pdf"},
  568 + {$td->FILE => "$out.pdf", $td->EXIT_STATUS => 0});
569 569 $td->runtest("show encryption",
570 570 {$td->COMMAND => "qpdf --show-encryption a.pdf"},
571 571 {$td->FILE => "$out-encryption.out", $td->EXIT_STATUS => 0},
... ...
qpdf/qtest/extensions-dictionary.test
... ... @@ -46,16 +46,16 @@ foreach my $input (@ext_inputs)
46 46 # Look at the actual file for a few cases to make sure
47 47 # qdf and non-qdf output are okay
48 48 $td->runtest("check file",
49   - {$td->FILE => "a.pdf"},
50   - {$td->FILE => "$base-$op-$version.pdf"});
  49 + {$td->COMMAND => "qpdf-test-compare a.pdf $base-$op-$version.pdf"},
  50 + {$td->FILE => "$base-$op-$version.pdf", $td->EXIT_STATUS => 0});
51 51 $td->runtest("$input: $op version to $version",
52 52 {$td->COMMAND =>
53 53 "qpdf --qdf --static-id" .
54 54 " --$op-version=$version $input a.qdf"},
55 55 {$td->STRING => "", $td->EXIT_STATUS => 0});
56 56 $td->runtest("check file",
57   - {$td->FILE => "a.qdf"},
58   - {$td->FILE => "$base-$op-$version.qdf"});
  57 + {$td->COMMAND => "qpdf-test-compare a.qdf $base-$op-$version.qdf"},
  58 + {$td->FILE => "$base-$op-$version.qdf", $td->EXIT_STATUS => 0});
59 59 }
60 60 }
61 61 }
... ...
qpdf/qtest/filter-abbreviations.test
... ... @@ -23,8 +23,8 @@ $td-&gt;runtest(&quot;stream filter abbreviations&quot;,
23 23 $td->EXIT_STATUS => 0},
24 24 $td->NORMALIZE_NEWLINES);
25 25 $td->runtest("check output",
26   - {$td->FILE => "a.pdf"},
27   - {$td->FILE => "filter-abbreviation.out"});
  26 + {$td->COMMAND => "qpdf-test-compare a.pdf filter-abbreviation.out"},
  27 + {$td->FILE => "filter-abbreviation.out", $td->EXIT_STATUS => 0});
28 28  
29 29 cleanup();
30 30 $td->report($n_tests);
... ...
qpdf/qtest/inline-images.test
... ... @@ -68,8 +68,8 @@ $td-&gt;runtest(&quot;named colorspace&quot;,
68 68 {$td->STRING => "", $td->EXIT_STATUS => 0},
69 69 $td->NORMALIZE_NEWLINES);
70 70 $td->runtest("check output",
71   - {$td->FILE => "a.pdf"},
72   - {$td->FILE => "inline-image-colorspace-lookup-out.pdf"});
  71 + {$td->COMMAND => "qpdf-test-compare a.pdf inline-image-colorspace-lookup-out.pdf"},
  72 + {$td->FILE => "inline-image-colorspace-lookup-out.pdf", $td->EXIT_STATUS => 0});
73 73  
74 74  
75 75 my @eii_tests = (
... ...
qpdf/qtest/merge-and-split.test
... ... @@ -39,8 +39,8 @@ $td-&gt;runtest(&quot;merge three files&quot;,
39 39 # as well as 20-pages have text on page n (from 1) that shows its page
40 40 # position from 0, so page 1 says it's page 0.
41 41 $td->runtest("check output",
42   - {$td->FILE => "a.pdf"},
43   - {$td->FILE => "merge-three-files-1.pdf"});
  42 + {$td->COMMAND => "qpdf-test-compare a.pdf merge-three-files-1.pdf"},
  43 + {$td->FILE => "merge-three-files-1.pdf", $td->EXIT_STATUS => 0});
44 44 # Select the same pages but add them to an empty file
45 45 $td->runtest("merge three files",
46 46 {$td->COMMAND => "qpdf --empty a.pdf" .
... ... @@ -49,8 +49,8 @@ $td-&gt;runtest(&quot;merge three files&quot;,
49 49 # Manually verified about this file: it has the same pages but does
50 50 # not contain outlines or other things from the original file.
51 51 $td->runtest("check output",
52   - {$td->FILE => "a.pdf"},
53   - {$td->FILE => "merge-three-files-2.pdf"});
  52 + {$td->COMMAND => "qpdf-test-compare a.pdf merge-three-files-2.pdf"},
  53 + {$td->FILE => "merge-three-files-2.pdf", $td->EXIT_STATUS => 0});
54 54 $td->runtest("avoid respecification of password",
55 55 {$td->COMMAND =>
56 56 "qpdf --empty a.pdf --copy-encryption=20-pages.pdf" .
... ... @@ -69,16 +69,16 @@ $td-&gt;runtest(&quot;merge with implicit ranges&quot;,
69 69 " --static-id"},
70 70 {$td->STRING => "", $td->EXIT_STATUS => 0});
71 71 $td->runtest("check output",
72   - {$td->FILE => "a.pdf"},
73   - {$td->FILE => "merge-implicit-ranges.pdf"});
  72 + {$td->COMMAND => "qpdf-test-compare a.pdf merge-implicit-ranges.pdf"},
  73 + {$td->FILE => "merge-implicit-ranges.pdf", $td->EXIT_STATUS => 0});
74 74 $td->runtest("merge with . and implicit ranges",
75 75 {$td->COMMAND =>
76 76 "qpdf minimal.pdf a.pdf --pages minimal.pdf . 1 --" .
77 77 " --static-id"},
78 78 {$td->STRING => "", $td->EXIT_STATUS => 0});
79 79 $td->runtest("check output",
80   - {$td->FILE => "a.pdf"},
81   - {$td->FILE => "merge-dot-implicit-ranges.pdf"});
  80 + {$td->COMMAND => "qpdf-test-compare a.pdf merge-dot-implicit-ranges.pdf"},
  81 + {$td->FILE => "merge-dot-implicit-ranges.pdf", $td->EXIT_STATUS => 0});
82 82 $td->runtest("merge with multiple labels",
83 83 {$td->COMMAND =>
84 84 "qpdf --empty a.pdf" .
... ... @@ -88,8 +88,8 @@ $td-&gt;runtest(&quot;merge with multiple labels&quot;,
88 88 " --static-id"},
89 89 {$td->STRING => "", $td->EXIT_STATUS => 0});
90 90 $td->runtest("check output",
91   - {$td->FILE => "a.pdf"},
92   - {$td->FILE => "merge-multiple-labels.pdf"});
  91 + {$td->COMMAND => "qpdf-test-compare a.pdf merge-multiple-labels.pdf"},
  92 + {$td->FILE => "merge-multiple-labels.pdf", $td->EXIT_STATUS => 0});
93 93 $td->runtest("remove labels",
94 94 {$td->COMMAND =>
95 95 "qpdf --empty a.pdf" .
... ... @@ -100,8 +100,8 @@ $td-&gt;runtest(&quot;remove labels&quot;,
100 100 " --static-id"},
101 101 {$td->STRING => "", $td->EXIT_STATUS => 0});
102 102 $td->runtest("check output",
103   - {$td->FILE => "a.pdf"},
104   - {$td->FILE => "remove-labels.pdf"});
  103 + {$td->COMMAND => "qpdf-test-compare a.pdf remove-labels.pdf"},
  104 + {$td->FILE => "remove-labels.pdf", $td->EXIT_STATUS => 0});
105 105  
106 106 $td->runtest("split with shared resources",
107 107 {$td->COMMAND =>
... ... @@ -178,8 +178,8 @@ $td-&gt;runtest(&quot;force full page duplication&quot;,
178 178 {$td->STRING => "", $td->EXIT_STATUS => 0},
179 179 $td->NORMALIZE_NEWLINES);
180 180 $td->runtest("check output",
181   - {$td->FILE => "a.pdf"},
182   - {$td->FILE => "deep-duplicate-pages.pdf"});
  181 + {$td->COMMAND => "qpdf-test-compare a.pdf deep-duplicate-pages.pdf"},
  182 + {$td->FILE => "deep-duplicate-pages.pdf", $td->EXIT_STATUS => 0});
183 183  
184 184  
185 185 cleanup();
... ...
qpdf/qtest/newline-before-endstream.test
... ... @@ -36,8 +36,8 @@ foreach my $d (
36 36 {$td->STRING => "", $td->EXIT_STATUS => 0},
37 37 $td->NORMALIZE_NEWLINES);
38 38 $td->runtest("check output ($description)",
39   - {$td->FILE => "a.pdf"},
40   - {$td->FILE => "newline-before-endstream-$suffix.pdf"});
  39 + {$td->COMMAND => "qpdf-test-compare a.pdf newline-before-endstream-$suffix.pdf"},
  40 + {$td->FILE => "newline-before-endstream-$suffix.pdf", $td->EXIT_STATUS => 0});
41 41 if ($flags =~ /qdf/)
42 42 {
43 43 $td->runtest("fix-qdf",
... ... @@ -52,8 +52,8 @@ $td-&gt;runtest(&quot;newline before endstream (C)&quot;,
52 52 {$td->STRING => "C test 22 done\n", $td->EXIT_STATUS => 0},
53 53 $td->NORMALIZE_NEWLINES);
54 54 $td->runtest("check output",
55   - {$td->FILE => "a.pdf"},
56   - {$td->FILE => "newline-before-endstream-nl.pdf"});
  55 + {$td->COMMAND => "qpdf-test-compare a.pdf newline-before-endstream-nl.pdf"},
  56 + {$td->FILE => "newline-before-endstream-nl.pdf", $td->EXIT_STATUS => 0});
57 57  
58 58 cleanup();
59 59 $td->report($n_tests);
... ...
qpdf/qtest/page-errors.test
... ... @@ -32,8 +32,8 @@ $td-&gt;runtest(&quot;handle page with inherited MediaBox&quot;,
32 32 {$td->STRING => "", $td->EXIT_STATUS => 0},
33 33 $td->NORMALIZE_NEWLINES);
34 34 $td->runtest("check output",
35   - {$td->FILE => "a.pdf"},
36   - {$td->FILE => "page-inherit-mediabox-out.pdf"});
  35 + {$td->COMMAND => "qpdf-test-compare a.pdf page-inherit-mediabox-out.pdf"},
  36 + {$td->FILE => "page-inherit-mediabox-out.pdf", $td->EXIT_STATUS => 0});
37 37 $td->runtest("check no type key for page nodes",
38 38 {$td->COMMAND => "qpdf --check no-pages-types.pdf"},
39 39 {$td->FILE => "no-pages-types.out", $td->EXIT_STATUS => 3},
... ... @@ -43,8 +43,8 @@ $td-&gt;runtest(&quot;no type key for page nodes&quot;,
43 43 {$td->FILE => "no-pages-types-fix.out", $td->EXIT_STATUS => 3},
44 44 $td->NORMALIZE_NEWLINES);
45 45 $td->runtest("check output",
46   - {$td->FILE => "a-split-out-1.pdf"},
47   - {$td->FILE => "no-pages-types-fixed.pdf"});
  46 + {$td->COMMAND => "qpdf-test-compare a-split-out-1.pdf no-pages-types-fixed.pdf"},
  47 + {$td->FILE => "no-pages-types-fixed.pdf", $td->EXIT_STATUS => 0});
48 48 $td->runtest("detect loops in pages structure",
49 49 {$td->COMMAND => "qpdf --check pages-loop.pdf"},
50 50 {$td->FILE => "pages-loop.out", $td->EXIT_STATUS => 2},
... ...
qpdf/qtest/pages-tree.test
... ... @@ -24,8 +24,8 @@ $td-&gt;runtest(&quot;linearize duplicated pages&quot;,
24 24 $td->EXIT_STATUS => 3},
25 25 $td->NORMALIZE_NEWLINES);
26 26 $td->runtest("compare files",
27   - {$td->FILE => "a.pdf"},
28   - {$td->FILE => "linearize-duplicate-page.pdf"});
  27 + {$td->COMMAND => "qpdf-test-compare a.pdf"},
  28 + {$td->FILE => "linearize-duplicate-page.pdf", $td->EXIT_STATUS => 0});
29 29 $td->runtest("extract duplicated pages",
30 30 {$td->COMMAND =>
31 31 "qpdf --static-id page_api_2.pdf" .
... ... @@ -34,16 +34,16 @@ $td-&gt;runtest(&quot;extract duplicated pages&quot;,
34 34 $td->EXIT_STATUS => 3},
35 35 $td->NORMALIZE_NEWLINES);
36 36 $td->runtest("compare files",
37   - {$td->FILE => "a.pdf"},
38   - {$td->FILE => "extract-duplicate-page.pdf"});
  37 + {$td->COMMAND => "qpdf-test-compare a.pdf extract-duplicate-page.pdf"},
  38 + {$td->FILE => "extract-duplicate-page.pdf", $td->EXIT_STATUS => 0});
39 39 $td->runtest("direct pages",
40 40 {$td->COMMAND =>
41 41 "qpdf --static-id direct-pages.pdf --pages . -- a.pdf"},
42 42 {$td->FILE => "direct-page-warning.out", $td->EXIT_STATUS => 3},
43 43 $td->NORMALIZE_NEWLINES);
44 44 $td->runtest("check output",
45   - {$td->FILE => "a.pdf"},
46   - {$td->FILE => "direct-pages-fixed.pdf"});
  45 + {$td->COMMAND => "qpdf-test-compare a.pdf direct-pages-fixed.pdf"},
  46 + {$td->FILE => "direct-pages-fixed.pdf", $td->EXIT_STATUS => 0});
47 47 $td->runtest("show direct pages",
48 48 {$td->COMMAND =>
49 49 "qpdf --show-pages direct-pages.pdf"},
... ...
qpdf/qtest/parsing.test
... ... @@ -33,14 +33,14 @@ $td-&gt;runtest(&quot;extra header text&quot;,
33 33 {$td->FILE => "test-32.out", $td->EXIT_STATUS => 0},
34 34 $td->NORMALIZE_NEWLINES);
35 35 $td->runtest("check output",
36   - {$td->FILE => "a.pdf"},
37   - {$td->FILE => "extra-header-no-newline.pdf"});
  36 + {$td->COMMAND => "qpdf-test-compare a.pdf extra-header-no-newline.pdf"},
  37 + {$td->FILE => "extra-header-no-newline.pdf", $td->EXIT_STATUS => 0});
38 38 $td->runtest("check output",
39 39 {$td->FILE => "b.pdf"},
40 40 {$td->FILE => "extra-header-lin-no-newline.pdf"});
41 41 $td->runtest("check output",
42   - {$td->FILE => "c.pdf"},
43   - {$td->FILE => "extra-header-newline.pdf"});
  42 + {$td->COMMAND => "qpdf-test-compare c.pdf extra-header-newline.pdf"},
  43 + {$td->FILE => "extra-header-newline.pdf", $td->EXIT_STATUS => 0});
44 44 $td->runtest("check output",
45 45 {$td->FILE => "d.pdf"},
46 46 {$td->FILE => "extra-header-lin-newline.pdf"});
... ...
qpdf/qtest/preserve-unref.test
... ... @@ -20,22 +20,22 @@ $td-&gt;runtest(&quot;drop unused objects&quot;,
20 20 {$td->COMMAND => "qpdf --static-id unreferenced-objects.pdf a.pdf"},
21 21 {$td->STRING => "", $td->EXIT_STATUS => 0});
22 22 $td->runtest("check output",
23   - {$td->FILE => "a.pdf"},
24   - {$td->FILE => "unreferenced-dropped.pdf"});
  23 + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-dropped.pdf"},
  24 + {$td->FILE => "unreferenced-dropped.pdf", $td->EXIT_STATUS => 0});
25 25 $td->runtest("keep unused objects",
26 26 {$td->COMMAND => "qpdf --static-id --preserve-unreferenced" .
27 27 " unreferenced-objects.pdf a.pdf"},
28 28 {$td->STRING => "", $td->EXIT_STATUS => 0});
29 29 $td->runtest("check output",
30   - {$td->FILE => "a.pdf"},
31   - {$td->FILE => "unreferenced-preserved.pdf"});
  30 + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-preserved.pdf"},
  31 + {$td->FILE => "unreferenced-preserved.pdf", $td->EXIT_STATUS => 0});
32 32 $td->runtest("keep unused objects (C)",
33 33 {$td->COMMAND =>
34 34 "qpdf-ctest 21 unreferenced-objects.pdf '' a.pdf"},
35 35 {$td->STRING => "C test 21 done\n", $td->EXIT_STATUS => 0},
36 36 $td->NORMALIZE_NEWLINES);
37 37 $td->runtest("check output",
38   - {$td->FILE => "a.pdf"},
39   - {$td->FILE => "unreferenced-preserved.pdf"});
  38 + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-preserved.pdf"},
  39 + {$td->FILE => "unreferenced-preserved.pdf", $td->EXIT_STATUS => 0});
40 40 cleanup();
41 41 $td->report($n_tests);
... ...
qpdf/qtest/qpdf-json.test
... ... @@ -294,31 +294,31 @@ $td-&gt;runtest(&quot;C API create from json file&quot;,
294 294 {$td->STRING => "C test 42 done\n", $td->EXIT_STATUS => 0},
295 295 $td->NORMALIZE_NEWLINES);
296 296 $td->runtest("check C API create from file",
297   - {$td->FILE => "a.pdf"},
298   - {$td->FILE => "qpdf-ctest-42-43.pdf"});
  297 + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-42-43.pdf"},
  298 + {$td->FILE => "qpdf-ctest-42-43.pdf", $td->EXIT_STATUS => 0});
299 299 $td->runtest("C API create from json buffer",
300 300 {$td->COMMAND => "qpdf-ctest 43 minimal.json '' a.pdf"},
301 301 {$td->STRING => "C test 43 done\n", $td->EXIT_STATUS => 0},
302 302 $td->NORMALIZE_NEWLINES);
303 303 $td->runtest("check C API create from buffer",
304   - {$td->FILE => "a.pdf"},
305   - {$td->FILE => "qpdf-ctest-42-43.pdf"});
  304 + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-42-43.pdf"},
  305 + {$td->FILE => "qpdf-ctest-42-43.pdf", $td->EXIT_STATUS => 0});
306 306 $td->runtest("C API update from json file",
307 307 {$td->COMMAND =>
308 308 "qpdf-ctest 44 minimal.pdf '' a.pdf minimal-update.json"},
309 309 {$td->STRING => "C test 44 done\n", $td->EXIT_STATUS => 0},
310 310 $td->NORMALIZE_NEWLINES);
311 311 $td->runtest("check C API update from file",
312   - {$td->FILE => "a.pdf"},
313   - {$td->FILE => "qpdf-ctest-44-45.pdf"});
  312 + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-44-45.pdf"},
  313 + {$td->FILE => "qpdf-ctest-44-45.pdf", $td->EXIT_STATUS => 0});
314 314 $td->runtest("C API update from json buffer",
315 315 {$td->COMMAND =>
316 316 "qpdf-ctest 45 minimal.pdf '' a.pdf minimal-update.json"},
317 317 {$td->STRING => "C test 45 done\n", $td->EXIT_STATUS => 0},
318 318 $td->NORMALIZE_NEWLINES);
319 319 $td->runtest("check C API update from buffer",
320   - {$td->FILE => "a.pdf"},
321   - {$td->FILE => "qpdf-ctest-44-45.pdf"});
  320 + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-44-45.pdf"},
  321 + {$td->FILE => "qpdf-ctest-44-45.pdf", $td->EXIT_STATUS => 0});
322 322 $td->runtest("C API write to JSON 1",
323 323 {$td->COMMAND =>
324 324 "qpdf-ctest 46 minimal.pdf '' a.json"},
... ...
qpdf/qtest/qpdf_test_helpers.pm
... ... @@ -46,8 +46,8 @@ sub check_pdf
46 46 {$td->STRING => "",
47 47 $td->EXIT_STATUS => $status});
48 48 $td->runtest("check output",
49   - {$td->FILE => "a.pdf"},
50   - {$td->FILE => $output});
  49 + {$td->COMMAND => "qpdf-test-compare a.pdf $output"},
  50 + {$td->FILE => $output, $td->EXIT_STATUS => 0});
51 51 }
52 52  
53 53 sub flush_tiff_cache
... ...
qpdf/qtest/qpdfjob.test
... ... @@ -76,8 +76,8 @@ foreach my $i (@good_json)
76 76 else
77 77 {
78 78 $td->runtest("check good json $i output",
79   - {$td->FILE => "a.pdf"},
80   - {$td->FILE => "job-json-$i.pdf"});
  79 + {$td->COMMAND => "qpdf-test-compare a.pdf job-json-$i.pdf"},
  80 + {$td->FILE => "job-json-$i.pdf", $td->EXIT_STATUS => 0});
81 81 }
82 82 }
83 83  
... ... @@ -107,8 +107,8 @@ $td-&gt;runtest(&quot;C job API&quot;,
107 107 foreach my $i (['a.pdf', 1], ['b.pdf', 2], ['c.pdf', 3], ['d.pdf', 4])
108 108 {
109 109 $td->runtest("check output",
110   - {$td->FILE => $i->[0]},
111   - {$td->FILE => "qpdfjob-ctest$i->[1].pdf"});
  110 + {$td->COMMAND => "qpdf-test-compare $i->[0] qpdfjob-ctest$i->[1].pdf"},
  111 + {$td->FILE => "qpdfjob-ctest$i->[1].pdf", $td->EXIT_STATUS => 0});
112 112 }
113 113 my $wide_out = `qpdfjob-ctest wide`;
114 114 $td->runtest("qpdfjob-ctest wide",
... ... @@ -124,8 +124,8 @@ if ($wide_out =~ m/skipped/)
124 124 else
125 125 {
126 126 $td->runtest("check output",
127   - {$td->FILE => "a.pdf"},
128   - {$td->FILE => "qpdfjob-ctest-wide.pdf"});
  127 + {$td->COMMAND => "qpdf-test-compare a.pdf qpdfjob-ctest-wide.pdf"},
  128 + {$td->FILE => "qpdfjob-ctest-wide.pdf", $td->EXIT_STATUS => 0});
129 129 }
130 130  
131 131 cleanup();
... ...
qpdf/qtest/rotate-pages.test
... ... @@ -29,24 +29,24 @@ $td-&gt;runtest(&quot;page rotation&quot;,
29 29 " --rotate=-90:3,15,17,18"},
30 30 {$td->STRING => "", $td->EXIT_STATUS => 0});
31 31 $td->runtest("check output",
32   - {$td->FILE => "a.pdf"},
33   - {$td->FILE => "rotated.pdf"});
  32 + {$td->COMMAND => "qpdf-test-compare a.pdf rotated.pdf"},
  33 + {$td->FILE => "rotated.pdf", $td->EXIT_STATUS => 0});
34 34  
35 35 $td->runtest("remove rotation",
36 36 {$td->COMMAND => "qpdf --static-id rotated.pdf a.pdf" .
37 37 " --qdf --no-original-object-ids --rotate=0"},
38 38 {$td->STRING => "", $td->EXIT_STATUS => 0});
39 39 $td->runtest("check output",
40   - {$td->FILE => "a.pdf"},
41   - {$td->FILE => "unrotated.pdf"});
  40 + {$td->COMMAND => "qpdf-test-compare a.pdf unrotated.pdf"},
  41 + {$td->FILE => "unrotated.pdf", $td->EXIT_STATUS => 0});
42 42  
43 43 $td->runtest("rotate all pages",
44 44 {$td->COMMAND =>
45 45 "qpdf --static-id --rotate=180 minimal.pdf a.pdf"},
46 46 {$td->STRING => "", $td->EXIT_STATUS => 0});
47 47 $td->runtest("check output",
48   - {$td->FILE => "a.pdf"},
49   - {$td->FILE => "minimal-rotated.pdf"});
  48 + {$td->COMMAND => "qpdf-test-compare a.pdf minimal-rotated.pdf"},
  49 + {$td->FILE => "minimal-rotated.pdf", $td->EXIT_STATUS => 0});
50 50  
51 51 $td->runtest("flatten with inherited rotate",
52 52 {$td->COMMAND =>
... ... @@ -54,8 +54,8 @@ $td-&gt;runtest(&quot;flatten with inherited rotate&quot;,
54 54 " inherited-rotate.pdf a.pdf"},
55 55 {$td->STRING => "", $td->EXIT_STATUS => 0});
56 56 $td->runtest("check output",
57   - {$td->FILE => "a.pdf"},
58   - {$td->FILE => "inherited-flattened.pdf"});
  57 + {$td->COMMAND => "qpdf-test-compare a.pdf inherited-flattened.pdf"},
  58 + {$td->FILE => "inherited-flattened.pdf", $td->EXIT_STATUS => 0});
59 59  
60 60 foreach my $angle (qw(90 180 270))
61 61 {
... ...
qpdf/qtest/specific-file.test
... ... @@ -33,15 +33,15 @@ $td-&gt;runtest(&quot;compress objstm and xref&quot;,
33 33 {$td->STRING => "", $td->EXIT_STATUS => 0},
34 34 $td->NORMALIZE_NEWLINES);
35 35 $td->runtest("check output",
36   - {$td->FILE => "a.pdf"},
37   - {$td->FILE => "compress-objstm-xref.pdf"});
  36 + {$td->COMMAND => "qpdf-test-compare a.pdf compress-objstm-xref.pdf"},
  37 + {$td->FILE => "compress-objstm-xref.pdf", $td->EXIT_STATUS => 0});
38 38 $td->runtest("qdf + preserved-unreferenced + xref streams",
39 39 {$td->COMMAND => "qpdf --qdf --preserve-unreferenced" .
40 40 " --static-id compress-objstm-xref.pdf a.pdf"},
41 41 {$td->STRING => "", $td->EXIT_STATUS => 0});
42 42 $td->runtest("check output",
43   - {$td->FILE => "a.pdf"},
44   - {$td->FILE => "compress-objstm-xref-qdf.pdf"});
  43 + {$td->COMMAND => "qpdf-test-compare a.pdf compress-objstm-xref-qdf.pdf"},
  44 + {$td->FILE => "compress-objstm-xref-qdf.pdf", $td->EXIT_STATUS => 0});
45 45 $td->runtest("check fix-qdf idempotency",
46 46 {$td->COMMAND => "fix-qdf a.pdf"},
47 47 {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0});
... ...
qpdf/qtest/stream-replacements.test
... ... @@ -21,8 +21,8 @@ $td-&gt;runtest(&quot;replace stream data&quot;,
21 21 {$td->STRING => "test 7 done\n", $td->EXIT_STATUS => 0},
22 22 $td->NORMALIZE_NEWLINES);
23 23 $td->runtest("check output",
24   - {$td->FILE => "a.pdf"},
25   - {$td->FILE => "replaced-stream-data.pdf"});
  24 + {$td->COMMAND => "qpdf-test-compare a.pdf replaced-stream-data.pdf"},
  25 + {$td->FILE => "replaced-stream-data.pdf", $td->EXIT_STATUS => 0});
26 26 $td->runtest("replace stream data compressed",
27 27 {$td->COMMAND => "test_driver 8 qstream.pdf"},
28 28 {$td->FILE => "test8.out", $td->EXIT_STATUS => 0},
... ...