]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/run_tests.pl
2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
12 # Recognise VERBOSE and V which is common on other projects.
14 $ENV{HARNESS_VERBOSE
} = "yes" if $ENV{VERBOSE
} || $ENV{V
};
17 use File
::Spec
::Functions qw
/catdir catfile curdir abs2rel rel2abs/;
19 use if $^O
ne "VMS", 'File::Glob' => qw
/glob/;
20 use Test
::Harness qw
/runtests $switches/;
22 my $srctop = $ENV{SRCTOP
} || $ENV{TOP
};
23 my $bldtop = $ENV{BLDTOP
} || $ENV{TOP
};
24 my $recipesdir = catdir
($srctop, "test", "recipes");
25 my $testlib = catdir
($srctop, "test", "testlib");
26 my $utillib = catdir
($srctop, "util");
28 # It seems that $switches is getting interpreted with 'eval' or something
29 # like that, and that we need to take care of backslashes or they will
30 # disappear along the way.
31 $testlib =~ s
|\\|\\\\|g
if $^O
eq "MSWin32";
32 $utillib =~ s
|\\|\\\\|g
if $^O
eq "MSWin32";
34 # Test::Harness provides the variable $switches to give it
35 # switches to be used when it calls our recipes.
36 $switches = "-w \"-I$testlib\" \"-I$utillib\"";
38 my @alltests = find_matching_tests
("*");
42 foreach my $arg (@ARGV ?
@ARGV : ('alltests')) {
45 (my $x = basename
($_)) =~ s
|^[0-9][0-9]-(.*)\
.t
$|$1|;
50 if ($arg eq 'alltests') {
51 warn "'alltests' encountered, ignoring everything before that...\n"
53 %tests = map { $_ => 1 } @alltests;
54 } elsif ($arg =~ m/^(-?)(.*)/) {
57 my @matches = find_matching_tests
($test);
59 # If '-foo' is the first arg, it's short for 'alltests -foo'
60 if ($sign eq '-' && $initial_arg) {
61 %tests = map { $_ => 1 } @alltests;
64 if (scalar @matches == 0) {
65 warn "Test $test found no match, skipping ",
66 ($sign eq '-' ?
"removal" : "addition"),
69 foreach $test (@matches) {
78 warn "I don't know what '$arg' is about, ignoring...\n";
84 runtests
(map { abs2rel
($_, rel2abs
(curdir
())); } sort keys %tests);
86 sub find_matching_tests
{
89 return glob(catfile
($recipesdir,"*-$glob.t"));