Check the validity of MINFO

MINFO may be an old file lying around, which might have
00-check_testexes.t produce incorrect results.  To make sure this
doesn't happen, check the variable VERSION in it against the same
variable in the top Makefile.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Richard Levitte 2015-08-09 06:52:50 +02:00
parent 2511c12bf2
commit 53520ebe87

View File

@ -8,13 +8,26 @@ use OpenSSL::Test qw/:DEFAULT top_file/;
setup("check_testexes");
my $OpenSSL_ver = "";
my $Makefile = top_file("Makefile");
if (open(FH, $Makefile)) {
$OpenSSL_ver =
(map { chomp; s/^VERSION=([^\s]*)\s*$//; $1 } grep { /^VERSION=/ } <FH>)[0];
close FH;
}
my $MINFO = top_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>) {
chomp;
if (/^VERSION=([^\s]*)\s*$/) {
$MINFO_ver = $1;
}
last if /^RELATIVE_DIRECTORY=test$/;
}
while(<FH>) {
@ -23,6 +36,9 @@ while(<FH>) {
}
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 =