Commit 53520ebe authored by Richard Levitte's avatar Richard Levitte
Browse files

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: default avatarRich Salz <rsalz@openssl.org>
parent 2511c12b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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 =