Add EVP_ENCODE_CTX_copy
[openssl.git] / test / recipes / 05-test_fuzz.t
1 #!/usr/bin/env perl
2 # Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9 use strict;
10 use warnings;
11
12 use if $^O ne "VMS", 'File::Glob' => qw/glob/;
13 use OpenSSL::Test qw/:DEFAULT srctop_file/;
14 use OpenSSL::Test::Utils;
15
16 setup("test_fuzz");
17
18 my @fuzzers = ('asn1', 'asn1parse', 'bignum', 'bndiv', 'conf', 'crl', 'ct', 'server', 'x509');
19 if (!disabled("cms")) {
20     push @fuzzers, 'cms';
21 }
22 plan tests => scalar @fuzzers;
23
24 foreach my $f (@fuzzers) {
25     subtest "Fuzzing $f" => sub {
26         my @files = glob(srctop_file('fuzz', 'corpora', $f, '*'));
27         push @files, glob(srctop_file('fuzz', 'corpora', "$f-*", '*'));
28
29         plan skip_all => "No corpora for $f-test" unless @files;
30
31         plan tests => scalar @files;
32
33         foreach (@files) {
34             ok(run(fuzz(["$f-test", $_])));
35         }
36     }
37 }