483d8830fe196c461b7dfba20788fdc0f5a66941
[openssl.git] / test / recipes / 00-check_testexes.t
1 #! /usr/bin/perl
2
3 use strict;
4
5 use File::Spec::Functions;
6 use File::Basename;
7 use OpenSSL::Test qw/:DEFAULT top_file/;
8
9 setup("check_testexes");
10
11 my $MINFO = top_file("MINFO");
12
13 plan skip_all => "because MINFO not found. If you want this test to run, please do 'perl util/mkfiles.pl > MINFO'"
14     unless open(FH,$MINFO);
15
16 while(<FH>) {
17     chomp;
18     last if /^RELATIVE_DIRECTORY=test$/;
19 }
20 while(<FH>) {
21     chomp;
22     last if /^EXE=/;
23 }
24 close FH;
25
26 s/^EXE=\s*//;
27 s/\s*$//;
28 my @expected_tests =
29     map { s/\..*$//;            # Remove extension
30           s/_?test$//;          # Remove 'test', possibly prefixed with '_'
31           s/(sha\d+)t/$1/;      # sha comes with no t at the end
32           $_; } split(/\s+/, $_);
33
34 plan tests => scalar @expected_tests;
35
36 my @found_tests =
37     map { basename($_) } glob(top_file("test", "recipes", "*.t"));
38
39 foreach my $test (sort @expected_tests) {
40     ok(scalar(grep(/^[0-9][0-9]-test_$test\.t$/, @found_tests)),
41        "check that a test for $test exists")
42         || diag("Expected to find something matching '[0-9][0-9]-test_$test.t'");
43 }