aa7281a71a9bb9883b3fd209d782a023ff5dfbca
[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  SKIP: {
14      skip "because $MINFO not found. If you want this test to run, please do 'perl util/mkfiles.pl > $MINFO'"
15          unless open(FH,$MINFO);
16
17      while(<FH>) {
18          chomp;
19          last if /^RELATIVE_DIRECTORY=test$/;
20      }
21      while(<FH>) {
22          chomp;
23          last if /^EXE=/;
24      }
25      close FH;
26
27      s/^EXE=\s*//;
28      s/\s*$//;
29      my @expected_tests =
30          map { s/\..*$//;       # Remove extension
31                s/_?test$//;     # Remove possible underscore
32                s/(sha\d+)t/$1/; # sha comes with no t at the end
33                $_; } split(/\s+/, $_);
34
35      plan tests => scalar @expected_tests;
36
37      my @found_tests =
38          map { basename($_) } glob(top_file("test", "recipes", "*.t"));
39
40      foreach my $test (sort @expected_tests) {
41          ok(scalar(grep(/^[0-9][0-9]-test_$test\.t$/, @found_tests)),
42             "check that a test for $test exists")
43              || diag("Expected to find something matching '[0-9][0-9]-test_$test.t'");
44      }
45 }