aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/many-nulls.test
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-01 00:40:15 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-01 22:15:54 +0200
commit4f4b908605a0c0e9cf3fc568302b074801eb7419 (patch)
tree57a47a647569cff6456bcf6e050998a2edc4c675 /qpdf/qtest/many-nulls.test
parent3d029fb17ef6b8ea9094394741f103608f698bad (diff)
downloadqpdf-4f4b908605a0c0e9cf3fc568302b074801eb7419.tar.zst
Add a file with arrays with lots of nulls to the test suite
A bug was fixed between qpdf 8.4.2 and 9.0.0 regarding this type of file (see #305 and #311), but it was necessary to retest after some major refactoring work at the lexical and parsing layers. This lays the groundwork for including this in performance benchmarks and in the qpdf test suite rather than having to keep a large, non-redistributable file around. 20 arrays of 20K nulls is plenty for performance memory testing and doesn't take too long to run. Compared to qpdf 8.4.2, in qpdf 11.0.0, the file generated here uses 3% of the RAM and runs over 4 times faster.
Diffstat (limited to 'qpdf/qtest/many-nulls.test')
-rw-r--r--qpdf/qtest/many-nulls.test34
1 files changed, 34 insertions, 0 deletions
diff --git a/qpdf/qtest/many-nulls.test b/qpdf/qtest/many-nulls.test
new file mode 100644
index 00000000..c3eefa1f
--- /dev/null
+++ b/qpdf/qtest/many-nulls.test
@@ -0,0 +1,34 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+unshift(@INC, '.');
+require qpdf_test_helpers;
+
+chdir("qpdf") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('many-nulls');
+
+# The output of test_many_nulls is also used in performance testing.
+# If it changes, consider whether it should be updated in
+# performance-test-files as well. See performance_check at the top of
+# the source tree.
+$td->runtest("create file with many nulls",
+ {$td->COMMAND => "test_many_nulls a.pdf"},
+ {$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->runtest("run check file",
+ {$td->COMMAND => "qpdf --check a.pdf"},
+ {$td->FILE => "many-nulls.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+cleanup();
+$td->report(3);