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