Tone down the requirements of a test that will go away.

00-check_testexes.t was a way for me to check that I didn't forget a
compiled test app.  The way it worked was to require MINFO to be present.
Considering the need for this test has diminished considerably at this
point, I might as well tone down the requirement, and have it skip the
test (and not fail it) if MINFO isn't present.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Richard Levitte 2015-04-23 11:11:14 +02:00
parent 71a4f2832c
commit 204e41ed50

View File

@ -11,43 +11,52 @@ setup("check_testexes");
my $MINFO = top_file("MINFO"); my $MINFO = top_file("MINFO");
plan tests => 2; SKIP: {
if (ok(open(FH,$MINFO), "MINFO exists")) { my %foundfiles;
subtest 'Finding test scripts for the compiled test binaries' => sub { my $numtests = 1;
find_tests(\*FH); close FH;
}; if (open(FH,$MINFO)) {
} else { while(<FH>) {
diag("Expected to find $MINFO, please run 'make files' in the top directory"); chomp;
} last if /^RELATIVE_DIRECTORY=test$/;
}
#------------- while(<FH>) {
# test script finder chomp;
sub find_tests { last if /^EXE=/;
my $fh = shift; }
while(<$fh>) { close FH;
chomp;
last if /^RELATIVE_DIRECTORY=test$/; my $pathfix = sub { return shift; }; # noop
} if ($^O eq "MSWin32") {
while(<$fh>) { # Experience has shown that glob needs the backslashes escaped
chomp; # to handle the glob glob() gets served. Otherwise, it sometimes
last if /^EXE=/; # considers the backslash an escape of the next character, most
} # notably the [.
# (if the single backslash is followed by a *, however, the *
s/^EXE=\s*//; # doesn't seem to be considered escaped... go figure...)
s/\s*$//; $pathfix = sub { shift; s/\\/\\\\/g; return $_; };
my %foundfiles = }
map { s/^EXE=\s*//;
my $key = $_; s/\s*$//;
s/_?test$//; %foundfiles =
s/(sha\d+)t/$1/; map {
$key => top_file("test", my $key = $_;
"recipes/[0-9][0-9]-test_$_.t"); } split(/\s+/, $_); s/_?test$//;
s/(sha\d+)t/$1/;
plan tests => scalar (keys %foundfiles); $key =>
$pathfix->(top_file("test", "recipes",
foreach (sort keys %foundfiles) { "[0-9][0-9]-test_$_.t")); } split(/\s+/, $_);
my @check = glob($foundfiles{$_}); $numtests = scalar keys %foundfiles;
ok(scalar @check, "check that a test for $_ exists") }
|| diag("Expected to find something matching $foundfiles{$_}");
} plan tests => $numtests;
skip "because $MINFO found. If you want this test to run, please do 'perl util/mkfiles.pl > $MINFO'", 1
unless %foundfiles;
foreach (sort keys %foundfiles) {
my @check = glob($foundfiles{$_});
ok(scalar @check, "check that a test for $_ exists")
|| diag("Expected to find something matching $foundfiles{$_}");
}
} }