Commit c71e41e9d9e24fd433e92732cc4253d3f9d67b80
Committed by
Jay Berkenbilt
1 parent
ff481b59
Change handling of qpdf fuzz corpus
Files are copied into the build area rather than left in the source tree, and the test suite looks for them there. Also remove special case around counting files in the qpdf corpus.
Showing
2 changed files
with
7 additions
and
9 deletions
README-maintainer
| @@ -66,9 +66,10 @@ GOOGLE OSS-FUZZ | @@ -66,9 +66,10 @@ GOOGLE OSS-FUZZ | ||
| 66 | * qpdf project: https://github.com/google/oss-fuzz/tree/master/projects/qpdf | 66 | * qpdf project: https://github.com/google/oss-fuzz/tree/master/projects/qpdf |
| 67 | 67 | ||
| 68 | * Adding new test cases: download the file from oss-fuzz and drop it | 68 | * Adding new test cases: download the file from oss-fuzz and drop it |
| 69 | - in fuzz/qpdf_extra/issue-number.fuzz. If not ready to include, it | ||
| 70 | - can be stored anywhere, and the absolute path can be passed to the | ||
| 71 | - reproduction code as described below. | 69 | + in fuzz/qpdf_extra/issue-number.fuzz. When ready to include it, add |
| 70 | + to fuzz/CMakeLists.txt. Until ready to use, the file can be stored | ||
| 71 | + anywhere, and the absolute path can be passed to the reproduction | ||
| 72 | + code as described below. | ||
| 72 | 73 | ||
| 73 | * To test locally, see https://github.com/google/oss-fuzz/tree/master/docs/, | 74 | * To test locally, see https://github.com/google/oss-fuzz/tree/master/docs/, |
| 74 | especially new_project_guide.md. Summary: | 75 | especially new_project_guide.md. Summary: |
fuzz/qtest/fuzz.test
| @@ -9,10 +9,7 @@ require TestDriver; | @@ -9,10 +9,7 @@ require TestDriver; | ||
| 9 | 9 | ||
| 10 | my $td = new TestDriver('fuzz'); | 10 | my $td = new TestDriver('fuzz'); |
| 11 | 11 | ||
| 12 | -my $qpdf_n_test_files = 31; | ||
| 13 | -my @extra = glob("../qpdf_extra/*.fuzz"); | ||
| 14 | -my $qpdf_n_extra_files = scalar(@extra); | ||
| 15 | -my $qpdf_n_files = ($qpdf_n_test_files + $qpdf_n_extra_files); | 12 | +my $qpdf_corpus = $ENV{'QPDF_FUZZ_CORPUS'} || die "must set QPDF_FUZZ_CORPUS"; |
| 16 | 13 | ||
| 17 | my @fuzzers = ( | 14 | my @fuzzers = ( |
| 18 | ['ascii85' => 1], | 15 | ['ascii85' => 1], |
| @@ -23,7 +20,7 @@ my @fuzzers = ( | @@ -23,7 +20,7 @@ my @fuzzers = ( | ||
| 23 | ['pngpredictor' => 1], | 20 | ['pngpredictor' => 1], |
| 24 | ['runlength' => 6], | 21 | ['runlength' => 6], |
| 25 | ['tiffpredictor' => 1], | 22 | ['tiffpredictor' => 1], |
| 26 | - ['qpdf' => $qpdf_n_files], | 23 | + ['qpdf' => 52], # increment when adding new files |
| 27 | ); | 24 | ); |
| 28 | 25 | ||
| 29 | my $n_tests = 0; | 26 | my $n_tests = 0; |
| @@ -40,7 +37,7 @@ foreach my $d (@fuzzers) | @@ -40,7 +37,7 @@ foreach my $d (@fuzzers) | ||
| 40 | my $dir = "../${k}_fuzzer_seed_corpus"; | 37 | my $dir = "../${k}_fuzzer_seed_corpus"; |
| 41 | if (! -d $dir) | 38 | if (! -d $dir) |
| 42 | { | 39 | { |
| 43 | - $dir = "../build/${k}_fuzzer_seed_corpus"; | 40 | + $dir = $qpdf_corpus; |
| 44 | } | 41 | } |
| 45 | my @files = glob("$dir/*"); | 42 | my @files = glob("$dir/*"); |
| 46 | $td->runtest("file count for $dir", | 43 | $td->runtest("file count for $dir", |