Make the 00-prep_*.t recipe truly mandatory
authorTomas Mraz <tomas@openssl.org>
Mon, 31 May 2021 15:00:38 +0000 (17:00 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 1 Jun 2021 13:07:51 +0000 (15:07 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15550)

test/run_tests.pl

index 9f34ab9e7e2ec8165ab57790f0a74f97980ea9c1..ea054bc1899ad68cdb8afc74d08e47370f17950a 100644 (file)
@@ -83,7 +83,7 @@ sub reorder {
 
     # for parallel test runs, do slow tests first
     if ($jobs > 1 && $key =~ m/test_ssl_new|test_fuzz/) {
-        $key =~ s/(\d+)-/00-/;
+        $key =~ s/(\d+)-/01-/;
     }
     return $key;
 }
@@ -131,18 +131,20 @@ foreach my $arg (@ARGV ? @ARGV : ('alltests')) {
     $initial_arg = 0;
 }
 
+# prep recipes are mandatory and need to be always run first
+my @preps = glob(catfile($recipesdir,"00-prep_*.t"));
+foreach my $test (@preps) {
+    delete $tests{$test};
+}
+
 sub find_matching_tests {
     my ($glob) = @_;
 
-    # prep recipes are mandatory
-    my @recipes = glob(catfile($recipesdir,"00-prep_*.t"));
-
     if ($glob =~ m|^[\d\[\]\?\-]+$|) {
-        push @recipes, glob(catfile($recipesdir,"$glob-*.t"));
-    } else {
-        push @recipes, glob(catfile($recipesdir,"*-$glob.t"));
+        return glob(catfile($recipesdir,"$glob-*.t"));
     }
-    return @recipes;
+
+    return glob(catfile($recipesdir,"*-$glob.t"));
 }
 
 # The following is quite a bit of hackery to adapt to both TAP::Harness
@@ -305,6 +307,10 @@ unless (defined $eres) {
 
 my $harness = $package->new(\%tapargs);
 my $ret =
+    $harness->runtests(map { [ abs2rel($_, rel2abs(curdir())), basename($_) ] }
+                       @preps);
+die if $ret->has_errors;
+$ret =
     $harness->runtests(map { [ abs2rel($_, rel2abs(curdir())), basename($_) ] }
                        sort { reorder($a) cmp reorder($b) } keys %tests);