1e1051a39Sopenharmony_ci# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
2e1051a39Sopenharmony_ci#
3e1051a39Sopenharmony_ci# Licensed under the Apache License 2.0 (the "License").  You may not use
4e1051a39Sopenharmony_ci# this file except in compliance with the License.  You can obtain a copy
5e1051a39Sopenharmony_ci# in the file LICENSE in the source distribution or at
6e1051a39Sopenharmony_ci# https://www.openssl.org/source/license.html
7e1051a39Sopenharmony_ci
8e1051a39Sopenharmony_ciuse strict;
9e1051a39Sopenharmony_ciuse warnings;
10e1051a39Sopenharmony_ci
11e1051a39Sopenharmony_ciuse OpenSSL::Glob;
12e1051a39Sopenharmony_ciuse OpenSSL::Test qw/:DEFAULT srctop_dir/;
13e1051a39Sopenharmony_ci
14e1051a39Sopenharmony_cisub fuzz_ok {
15e1051a39Sopenharmony_ci    die "Only one argument accepted" if scalar @_ != 1;
16e1051a39Sopenharmony_ci
17e1051a39Sopenharmony_ci    my $f = $_[0];
18e1051a39Sopenharmony_ci    my $d = srctop_dir('fuzz', 'corpora', $f);
19e1051a39Sopenharmony_ci
20e1051a39Sopenharmony_ci    SKIP: {
21e1051a39Sopenharmony_ci        skip "No directory $d", 1 unless -d $d;
22e1051a39Sopenharmony_ci        ok(run(fuzz(["$f-test", $d])), "Fuzzing $f");
23e1051a39Sopenharmony_ci    }
24e1051a39Sopenharmony_ci}
25e1051a39Sopenharmony_ci
26e1051a39Sopenharmony_ci1;
27