1#!/usr/bin/env perl
2# Copyright 2016-2018 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
9use strict;
10use warnings;
11
12use OpenSSL::Glob;
13use OpenSSL::Test qw/:DEFAULT srctop_file/;
14use OpenSSL::Test::Utils;
15
16setup("test_fuzz");
17
18my @fuzzers = ('asn1', 'asn1parse', 'bignum', 'bndiv', 'client', 'conf', 'crl', 'server', 'x509');
19if (!disabled("cms")) {
20    push @fuzzers, 'cms';
21}
22if (!disabled("ct")) {
23    push @fuzzers, 'ct';
24}
25plan tests => scalar @fuzzers;
26
27foreach my $f (@fuzzers) {
28    subtest "Fuzzing $f" => sub {
29        my @dirs = glob(srctop_file('fuzz', 'corpora', $f));
30        push @dirs, glob(srctop_file('fuzz', 'corpora', "$f-*"));
31
32        plan skip_all => "No corpora for $f-test" unless @dirs;
33
34        plan tests => scalar @dirs;
35
36        foreach (@dirs) {
37            ok(run(fuzz(["$f-test", $_])));
38        }
39    }
40}
41