mirror of
https://github.com/openssl/openssl.git
synced 2025-02-11 14:22:43 +08:00
To be able to run tests when we've built in a directory other than the source tree, the testing framework needs a few adjustments. test/testlib/OpenSSL/Test.pm needs to know where it can find shlib_wrap.sh, and a number of other tests need to be told a different place to find engines than what they may be able to figure out on their own. Relying to $TOP is not enough, $SRCTOP and $BLDTOP can be used as an alternative. As part of this change, top_file and top_dir are removed and srctop_file, bldtop_file, srctop_dir and bldtop_dir take their place. Reviewed-by: Ben Laurie <ben@openssl.org>
60 lines
1.5 KiB
Perl
60 lines
1.5 KiB
Perl
#! /usr/bin/perl
|
|
|
|
use strict;
|
|
|
|
use File::Spec::Functions;
|
|
use File::Basename;
|
|
use OpenSSL::Test qw/:DEFAULT bldtop_file/;
|
|
|
|
setup("check_testexes");
|
|
|
|
my $OpenSSL_ver = "";
|
|
my $Makefile = bldtop_file("Makefile");
|
|
if (open(FH, $Makefile)) {
|
|
$OpenSSL_ver =
|
|
(map { s/\R//; s/^VERSION=([^\s]*)\s*$//; $1 } grep { /^VERSION=/ } <FH>)[0];
|
|
close FH;
|
|
}
|
|
|
|
my $MINFO = bldtop_file("MINFO");
|
|
|
|
plan skip_all => "because MINFO not found. If you want this test to run, please do 'perl util/mkfiles.pl > MINFO'"
|
|
unless open(FH,$MINFO);
|
|
|
|
my $MINFO_ver = "";
|
|
|
|
while(<FH>) {
|
|
s/\R//; # chomp;
|
|
if (/^VERSION=([^\s]*)\s*$/) {
|
|
$MINFO_ver = $1;
|
|
}
|
|
last if /^RELATIVE_DIRECTORY=test$/;
|
|
}
|
|
while(<FH>) {
|
|
s/\R//; # chomp;
|
|
last if /^EXE=/;
|
|
}
|
|
close FH;
|
|
|
|
plan skip_all => "because MINFO is not from this OpenSSL version. If you want this test to run, please do 'perl util/mkfiles.pl > MINFO'"
|
|
unless $OpenSSL_ver eq $MINFO_ver;
|
|
|
|
s/^EXE=\s*//;
|
|
s/\s*$//;
|
|
my @expected_tests =
|
|
map { s/\..*$//; # Remove extension
|
|
s/_?test$//; # Remove 'test', possibly prefixed with '_'
|
|
s/(sha\d+)t/$1/; # sha comes with no t at the end
|
|
$_; } split(/\s+/, $_);
|
|
|
|
plan tests => scalar @expected_tests;
|
|
|
|
my @found_tests =
|
|
map { basename($_) } glob(bldtop_file("test", "recipes", "*.t"));
|
|
|
|
foreach my $test (sort @expected_tests) {
|
|
ok(scalar(grep(/^[0-9][0-9]-test_$test\.t$/, @found_tests)),
|
|
"check that a test for $test exists")
|
|
|| diag("Expected to find something matching '[0-9][0-9]-test_$test.t'");
|
|
}
|