From 321f9e79db85fe67a3cc498780dbe88602483b16 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 20 Dec 2023 07:44:19 -0500 Subject: [PATCH] Fix tests with deterministic IDs --- qpdf/qtest/error-condition.test | 8 ++++---- qpdf/qtest/form-xobject.test | 4 ++-- qpdf/qtest/many-nulls.test | 5 ++--- qpdf/qtest/replace-input.test | 12 +++++++----- qpdf/qtest/type-checks.test | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/qpdf/qtest/error-condition.test b/qpdf/qtest/error-condition.test index d9357a0f..097190e8 100644 --- a/qpdf/qtest/error-condition.test +++ b/qpdf/qtest/error-condition.test @@ -194,8 +194,8 @@ $td->runtest("xref loop with append", $td->EXIT_STATUS => 3}, $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "a.pdf"}, - {$td->FILE => "append-xref-loop-fixed.pdf"}); + {$td->COMMAND => "qpdf-test-compare a.pdf append-xref-loop-fixed.pdf"}, + {$td->FILE => "append-xref-loop-fixed.pdf", $td->EXIT_STATUS => 0}); $td->runtest("endobj not at newline", {$td->COMMAND => @@ -204,8 +204,8 @@ $td->runtest("endobj not at newline", $td->EXIT_STATUS => 3}, $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "a.pdf"}, - {$td->FILE => "endobj-at-eol-fixed.pdf"}); + {$td->COMMAND => "qpdf-test-compare a.pdf endobj-at-eol-fixed.pdf"}, + {$td->FILE => "endobj-at-eol-fixed.pdf", $td->EXIT_STATUS => 0}); cleanup(); $td->report($n_tests); diff --git a/qpdf/qtest/form-xobject.test b/qpdf/qtest/form-xobject.test index 3183a219..2a9bac83 100644 --- a/qpdf/qtest/form-xobject.test +++ b/qpdf/qtest/form-xobject.test @@ -94,8 +94,8 @@ $td->runtest("overlay on page with no resources", {$td->STRING => "", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); $td->runtest("check overlay with no resources output", - {$td->FILE => "a.pdf"}, - {$td->FILE => "overlay-no-resources.pdf"}); + {$td->COMMAND => "qpdf-test-compare a.pdf overlay-no-resources.pdf"}, + {$td->FILE => "overlay-no-resources.pdf", $td->EXIT_STATUS => 0}); cleanup(); $td->report($n_tests); diff --git a/qpdf/qtest/many-nulls.test b/qpdf/qtest/many-nulls.test index c3eefa1f..744075f0 100644 --- a/qpdf/qtest/many-nulls.test +++ b/qpdf/qtest/many-nulls.test @@ -23,9 +23,8 @@ $td->runtest("create file with many nulls", {$td->STRING => "", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); $td->runtest("compare output", - {$td->FILE => "a.pdf"}, - {$td->FILE => "many-nulls.pdf"}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "qpdf-test-compare a.pdf many-nulls.pdf"}, + {$td->FILE => "many-nulls.pdf", $td->EXIT_STATUS => 0}); $td->runtest("run check file", {$td->COMMAND => "qpdf --check a.pdf"}, {$td->FILE => "many-nulls.out", $td->EXIT_STATUS => 0}, diff --git a/qpdf/qtest/replace-input.test b/qpdf/qtest/replace-input.test index 70a37cc2..5c1a9df2 100644 --- a/qpdf/qtest/replace-input.test +++ b/qpdf/qtest/replace-input.test @@ -32,10 +32,12 @@ foreach my $d (['auto-ü', 1], ['auto-öπ', 2]) " --object-streams=generate --replace-input ./$u.pdf"}, {$td->STRING => "", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); + # qpdf handles Unicode filenames on Windows, but qpdf-test-compare + # doesn't. + rename("$u.pdf", "u.pdf") or die; $td->runtest("check output ($u)", - {$td->FILE => "$u.pdf"}, - {$td->FILE => "replace-input.pdf"}, - $td->NORMALIZE_NEWLINES); + {$td->COMMAND => "qpdf-test-compare u.pdf replace-input.pdf"}, + {$td->FILE => "replace-input.pdf", $td->EXIT_STATUS => 0}); } system("cp xref-with-short-size.pdf auto-warn.pdf") == 0 or die; @@ -46,8 +48,8 @@ $td->runtest("replace input with warnings", $td->NORMALIZE_NEWLINES); $td->runtest("check output", - {$td->FILE => "auto-warn.pdf"}, - {$td->FILE => "warn-replace.pdf"}); + {$td->COMMAND => "qpdf-test-compare auto-warn.pdf warn-replace.pdf"}, + {$td->FILE => "warn-replace.pdf", $td->EXIT_STATUS => 0}); $td->runtest("check orig output", {$td->FILE => "auto-warn.pdf.~qpdf-orig"}, {$td->FILE => "xref-with-short-size.pdf"}); diff --git a/qpdf/qtest/type-checks.test b/qpdf/qtest/type-checks.test index 17b3c994..73cb7fb6 100644 --- a/qpdf/qtest/type-checks.test +++ b/qpdf/qtest/type-checks.test @@ -27,8 +27,8 @@ $td->runtest("ensure object-types-os is up-to-date", " object-types.pdf a.pdf"}, {$td->STRING => "", $td->EXIT_STATUS => 0}); $td->runtest("check file", - {$td->FILE => "a.pdf"}, - {$td->FILE => "object-types-os.pdf"}); + {$td->COMMAND => "qpdf-test-compare a.pdf object-types-os.pdf"}, + {$td->FILE => "object-types-os.pdf", $td->EXIT_STATUS => 0}); $td->runtest("type checks", {$td->COMMAND => "test_driver 42 object-types.pdf"}, {$td->FILE => "object-types.out",