Ignore the log files
[openssl.git] / test / recipes / 00-check_testalltests.t
1 #! /usr/bin/perl
2
3 use strict;
4
5 use File::Spec::Functions;
6 use Test::More;
7
8 use lib 'testlib';
9 use OpenSSL::Test;
10
11 setup("check_testalltests");
12
13 my $Makefile = top_file("test","Makefile");
14
15 plan tests => 2;
16 if (ok(open(FH,$Makefile), "test/Makefile exists")) {
17     subtest 'Finding test scripts for the alltests target' => sub {
18         find_tests(\*FH); close FH;
19     };
20 } else {
21     diag("Expected to find $Makefile");
22 }
23
24 #-------------
25 # test script finder
26 sub find_tests {
27     my $fh = shift;
28     my $line;
29     while(<$fh>) {
30         chomp;
31         $line = $_;
32         last if /^alltests:/;
33     }
34     while(<$fh>) {
35         chomp;
36         my $l = $_;
37         $line =~ s/\\\s*$/$l/;
38         last if $line !~ /\\\s*$/;
39     }
40     close $fh;
41     $line =~ s/^alltests:\s*//;
42
43     # It's part of the test_ssl recipe
44     $line =~ s/\s+test_ss\s+/ /;
45
46     # It's split into sha1, sha256 and sha512
47     $line =~ s/\s+test_sha\s+/ test_sha1 test_sha256 test_sha512 /;
48
49     my %foundfiles =
50         map {
51             s/^test_//;
52             $_ => top_file("test",
53                            "recipes/[0-9][0-9]-test_$_.t"); } split(/\s+/,
54                                                                     $line);
55
56     plan tests => scalar (keys %foundfiles);
57
58     foreach (sort keys %foundfiles) {
59         my @check = glob($foundfiles{$_});
60         ok(scalar @check, "check that a test for $_ exists")
61             || diag("Expected to find something matching $foundfiles{$_}");
62     }
63 }