Commit b745920961bd44cbe3ded956c7b79f47c142b118

Authored by Jay Berkenbilt
1 parent 5c5b4e64

Allow specific performance tests to be run

Showing 2 changed files with 24 additions and 1 deletions
ChangeLog
  1 +2022-10-08 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * performance_check: add --test option to limit which tests are
  4 + run.
  5 +
1 2022-10-06 Jay Berkenbilt <ejb@ql.org> 6 2022-10-06 Jay Berkenbilt <ejb@ql.org>
2 7
3 * Change minimum required C++ version from C++-14 to C++-17. 8 * Change minimum required C++ version from C++-14 to C++-17.
performance_check
@@ -50,7 +50,7 @@ my $default_iterations = 20; @@ -50,7 +50,7 @@ my $default_iterations = 20;
50 50
51 sub usage 51 sub usage
52 { 52 {
53 - die " 53 + warn "
54 Usage: $whoami [ args ] 54 Usage: $whoami [ args ]
55 --dir dir test on all files in dir (default: $default_test_dir) 55 --dir dir test on all files in dir (default: $default_test_dir)
56 --file file test only on the named file 56 --file file test only on the named file
@@ -58,15 +58,23 @@ Usage: $whoami [ args ] @@ -58,15 +58,23 @@ Usage: $whoami [ args ]
58 --workdir where to write output pdfs (default: $default_workdir) 58 --workdir where to write output pdfs (default: $default_workdir)
59 --maxtime maximum time for a test; 0 means unlimited (default: $default_maxtime) 59 --maxtime maximum time for a test; 0 means unlimited (default: $default_maxtime)
60 --iterations number of iterations (default: $default_iterations) 60 --iterations number of iterations (default: $default_iterations)
  61 + --test regexp run only tests that match specified pattern
61 62
62 Populate $test_dir with files you want to use for performance 63 Populate $test_dir with files you want to use for performance
63 benchmarking. PDF files and qpdf JSON files are allowed. The qpdf 64 benchmarking. PDF files and qpdf JSON files are allowed. The qpdf
64 release process uses a clone of 65 release process uses a clone of
65 https://github.com/qpdf/performance-test-files for this purpose. 66 https://github.com/qpdf/performance-test-files for this purpose.
66 67
  68 +Tests:
67 "; 69 ";
  70 + foreach my $t (@tests)
  71 + {
  72 + warn " $t->[0]\n";
  73 + }
  74 + exit 2;
68 } 75 }
69 76
  77 +my $test_re = undef;
70 while (@ARGV) 78 while (@ARGV)
71 { 79 {
72 my $arg = shift(@ARGV); 80 my $arg = shift(@ARGV);
@@ -102,6 +110,11 @@ while (@ARGV) @@ -102,6 +110,11 @@ while (@ARGV)
102 usage() unless @ARGV; 110 usage() unless @ARGV;
103 $iterations = shift(@ARGV); 111 $iterations = shift(@ARGV);
104 } 112 }
  113 + elsif ('--test' eq $arg)
  114 + {
  115 + usage() unless @ARGV;
  116 + $test_re = shift(@ARGV);
  117 + }
105 else 118 else
106 { 119 {
107 usage(); 120 usage();
@@ -233,6 +246,11 @@ sub run_tests @@ -233,6 +246,11 @@ sub run_tests
233 foreach my $test (@tests) 246 foreach my $test (@tests)
234 { 247 {
235 my ($name, $args) = @$test; 248 my ($name, $args) = @$test;
  249 + if ((defined $test_re) && $name !~ m/$test_re/)
  250 + {
  251 + print " skipping test $name\n";
  252 + next;
  253 + }
236 print " test: $name\n"; 254 print " test: $name\n";
237 $args = filter_args($args); 255 $args = filter_args($args);
238 if (! defined $args) 256 if (! defined $args)