Add recipes for tests related to certificates
[openssl.git] / test / recipes / 00-check_testexes.t
1 #! /usr/bin/perl
2
3 use strict;
4
5 use File::Spec::Functions;
6 use Test::More;
7
8 use OpenSSL::Test qw/:DEFAULT top_file/;
9
10 setup("check_testexes");
11
12 my $MINFO = top_file("MINFO");
13
14 plan tests => 2;
15 if (ok(open(FH,$MINFO), "MINFO exists")) {
16     subtest 'Finding test scripts for the compiled test binaries' => sub {
17         find_tests(\*FH); close FH;
18     };
19 } else {
20     diag("Expected to find $MINFO, please run 'make files' in the top directory");
21 }
22
23 #-------------
24 # test script finder
25 sub find_tests {
26     my $fh = shift;
27     while(<$fh>) {
28         chomp;
29         last if /^RELATIVE_DIRECTORY=test$/;
30     }
31     while(<$fh>) {
32         chomp;
33         last if /^EXE=/;
34     }
35
36     s/^EXE=\s*//;
37     s/\s*$//;
38     my %foundfiles =
39         map {
40             my $key = $_;
41             s/_?test$//;
42             s/(sha\d+)t/$1/;
43             $key => top_file("test",
44                              "recipes/[0-9][0-9]-test_$_.t"); } split(/\s+/, $_);
45
46     plan tests => scalar (keys %foundfiles);
47
48     foreach (sort keys %foundfiles) {
49         my @check = glob($foundfiles{$_});
50         ok(scalar @check, "check that a test for $_ exists")
51             || diag("Expected to find something matching $foundfiles{$_}");
52     }
53 }