2016-06-04 23:10:49 +08:00
|
|
|
#!/usr/bin/env perl
|
2018-04-03 20:57:12 +08:00
|
|
|
# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
2016-06-04 23:10:49 +08:00
|
|
|
#
|
|
|
|
# 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;
|
|
|
|
|
2017-08-02 04:43:56 +08:00
|
|
|
use OpenSSL::Glob;
|
2016-06-04 23:10:49 +08:00
|
|
|
use OpenSSL::Test qw/:DEFAULT srctop_file/;
|
2016-07-19 03:59:30 +08:00
|
|
|
use OpenSSL::Test::Utils;
|
2016-06-04 23:10:49 +08:00
|
|
|
|
|
|
|
setup("test_fuzz");
|
|
|
|
|
2016-12-08 06:12:04 +08:00
|
|
|
my @fuzzers = ('asn1', 'asn1parse', 'bignum', 'bndiv', 'client', 'conf', 'crl', 'server', 'x509');
|
2016-07-19 03:59:30 +08:00
|
|
|
if (!disabled("cms")) {
|
|
|
|
push @fuzzers, 'cms';
|
|
|
|
}
|
2016-07-22 22:49:03 +08:00
|
|
|
if (!disabled("ct")) {
|
|
|
|
push @fuzzers, 'ct';
|
|
|
|
}
|
2016-06-04 23:10:49 +08:00
|
|
|
plan tests => scalar @fuzzers;
|
|
|
|
|
|
|
|
foreach my $f (@fuzzers) {
|
|
|
|
subtest "Fuzzing $f" => sub {
|
2018-03-28 21:46:28 +08:00
|
|
|
my @dirs = glob(srctop_file('fuzz', 'corpora', $f));
|
|
|
|
push @dirs, glob(srctop_file('fuzz', 'corpora', "$f-*"));
|
2016-06-04 23:10:49 +08:00
|
|
|
|
2018-03-28 21:46:28 +08:00
|
|
|
plan skip_all => "No corpora for $f-test" unless @dirs;
|
2016-06-04 23:10:49 +08:00
|
|
|
|
2018-03-28 21:46:28 +08:00
|
|
|
plan tests => scalar @dirs;
|
2016-06-04 23:10:49 +08:00
|
|
|
|
2018-03-28 21:46:28 +08:00
|
|
|
foreach (@dirs) {
|
2016-06-04 23:10:49 +08:00
|
|
|
ok(run(fuzz(["$f-test", $_])));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|