diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-12-20 19:28:42 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-12-20 21:46:20 +0100 |
commit | 7e679ab8b68a38aae8374ef28f999afd94bf5124 (patch) | |
tree | d1d4f7028d152e90fcd5ef44b0b685251e1a2dd9 /qpdf | |
parent | d61612a2e54d266d8fc4f55042080b780984272e (diff) | |
download | qpdf-7e679ab8b68a38aae8374ef28f999afd94bf5124.tar.zst |
Avoid depending on exact xref stream offsets
For the modified test case, we care about successful recovery, not
about the exact offsets. Add a filter to remove the specific numbers
from show-xref.
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf/filter-xref-offsets.pl | 8 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/xref-with-short-size-new.out | 8 | ||||
-rw-r--r-- | qpdf/qtest/xref-streams.test | 3 |
3 files changed, 14 insertions, 5 deletions
diff --git a/qpdf/qtest/qpdf/filter-xref-offsets.pl b/qpdf/qtest/qpdf/filter-xref-offsets.pl new file mode 100644 index 00000000..fa4e95c8 --- /dev/null +++ b/qpdf/qtest/qpdf/filter-xref-offsets.pl @@ -0,0 +1,8 @@ +use warnings; +use strict; + +while (<>) +{ + s/(uncompressed; offset =) \d+/$1 .../; + print; +} diff --git a/qpdf/qtest/qpdf/xref-with-short-size-new.out b/qpdf/qtest/qpdf/xref-with-short-size-new.out index 9396e6c6..1c0f409a 100644 --- a/qpdf/qtest/qpdf/xref-with-short-size-new.out +++ b/qpdf/qtest/qpdf/xref-with-short-size-new.out @@ -1,4 +1,4 @@ -1/0: uncompressed; offset = 15 +1/0: uncompressed; offset = ... 2/0: compressed; stream = 1, index = 0 3/0: compressed; stream = 1, index = 1 4/0: compressed; stream = 1, index = 2 @@ -8,6 +8,6 @@ 8/0: compressed; stream = 1, index = 6 9/0: compressed; stream = 1, index = 7 10/0: compressed; stream = 1, index = 8 -11/0: uncompressed; offset = 674 -12/0: uncompressed; offset = 801 -13/0: uncompressed; offset = 16194 +11/0: uncompressed; offset = ... +12/0: uncompressed; offset = ... +13/0: uncompressed; offset = ... diff --git a/qpdf/qtest/xref-streams.test b/qpdf/qtest/xref-streams.test index 8d8e8bd9..68640bdf 100644 --- a/qpdf/qtest/xref-streams.test +++ b/qpdf/qtest/xref-streams.test @@ -28,7 +28,8 @@ $td->runtest("recover xref with short size", $td->EXIT_STATUS => 3}, $td->NORMALIZE_NEWLINES); $td->runtest("show new xref stream", - {$td->COMMAND => "qpdf --show-xref a.pdf"}, + {$td->COMMAND => "qpdf --show-xref a.pdf", + $td->FILTER => "perl filter-xref-offsets.pl"}, {$td->FILE => "xref-with-short-size-new.out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); |