summaryrefslogtreecommitdiffstats
path: root/test/recipes/05-test_fuzz.t
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2016-06-04 16:10:49 +0100
committerBen Laurie <ben@links.org>2016-07-01 13:45:45 +0100
commit90d28f0519427ffc293f880c423d9c4395a6fcd4 (patch)
treebb3be2701c6ea2bbe31b6770c1c104fe8c5e4d5c /test/recipes/05-test_fuzz.t
parent2c12f22c3364a1e562a19415f9929359945a7c21 (diff)
Run the fuzzing corpora as tests.
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/recipes/05-test_fuzz.t')
-rwxr-xr-xtest/recipes/05-test_fuzz.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/recipes/05-test_fuzz.t b/test/recipes/05-test_fuzz.t
new file mode 100755
index 0000000000..f5ae228de4
--- /dev/null
+++ b/test/recipes/05-test_fuzz.t
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License"). You may not use
+# this file except in compliance with the License. You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
+use strict;
+use warnings;
+
+use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
+
+setup("test_fuzz");
+
+my @fuzzers = ('asn1', 'asn1parse', 'bignum', 'bndiv', 'cms', 'conf', 'ct', 'server');
+plan tests => scalar @fuzzers;
+
+foreach my $f (@fuzzers) {
+ subtest "Fuzzing $f" => sub {
+ my @files = glob(srctop_file('fuzz', 'corpora', $f, '*'));
+ push @files, glob(srctop_file('fuzz', 'corpora', "$f-*", '*'));
+
+ plan skip_all => "No corpora for $f-test" unless @files;
+
+ plan tests => scalar @files;
+
+ foreach (@files) {
+ ok(run(fuzz(["$f-test", $_])));
+ }
+ }
+}