99-test_fuzz.t 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env perl
  2. # Copyright 2016-2020 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("cmp")) {
  16. push @fuzzers, 'cmp';
  17. }
  18. if (!disabled("cms")) {
  19. push @fuzzers, 'cms';
  20. }
  21. if (!disabled("ct")) {
  22. push @fuzzers, 'ct';
  23. }
  24. plan tests => scalar @fuzzers;
  25. foreach my $f (@fuzzers) {
  26. subtest "Fuzzing $f" => sub {
  27. my @dirs = glob(srctop_file('fuzz', 'corpora', $f));
  28. push @dirs, glob(srctop_file('fuzz', 'corpora', "$f-*"));
  29. plan skip_all => "No corpora for $f-test" unless @dirs;
  30. plan tests => scalar @dirs;
  31. foreach (@dirs) {
  32. ok(run(fuzz(["$f-test", $_])));
  33. }
  34. }
  35. }