99-test_fuzz.t 1.1 KB

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