]>
Commit | Line | Data |
---|---|---|
e0a65194 RS |
1 | #! /usr/bin/env perl |
2 | # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. | |
3 | # | |
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 | |
aec27d4d RL |
8 | |
9 | use strict; | |
10 | use warnings; | |
11 | ||
12 | use File::Spec::Functions qw/catdir catfile curdir abs2rel rel2abs/; | |
13 | use File::Basename; | |
14 | use Test::Harness qw/runtests $switches/; | |
15 | ||
42e0ccdf RL |
16 | my $srctop = $ENV{SRCTOP} || $ENV{TOP}; |
17 | my $bldtop = $ENV{BLDTOP} || $ENV{TOP}; | |
18 | my $recipesdir = catdir($srctop, "test", "recipes"); | |
19 | my $testlib = catdir($srctop, "test", "testlib"); | |
20 | my $utillib = catdir($srctop, "util"); | |
aec27d4d | 21 | |
df7421cc | 22 | # It seems that $switches is getting interpreted with 'eval' or something |
aec27d4d RL |
23 | # like that, and that we need to take care of backslashes or they will |
24 | # disappear along the way. | |
25 | $testlib =~ s|\\|\\\\|g if $^O eq "MSWin32"; | |
25be5f44 | 26 | $utillib =~ s|\\|\\\\|g if $^O eq "MSWin32"; |
aec27d4d RL |
27 | |
28 | # Test::Harness provides the variable $switches to give it | |
29 | # switches to be used when it calls our recipes. | |
25be5f44 | 30 | $switches = "-w \"-I$testlib\" \"-I$utillib\""; |
aec27d4d RL |
31 | |
32 | my @tests = ( "alltests" ); | |
33 | if (@ARGV) { | |
34 | @tests = @ARGV; | |
35 | } | |
1780e6d9 RL |
36 | my $list_mode = scalar(grep /^list$/, @tests) != 0; |
37 | if (grep /^alltests|list$/, @tests) { | |
aec27d4d RL |
38 | @tests = grep { |
39 | basename($_) =~ /^[0-9][0-9]-[^\.]*\.t$/ | |
40 | } glob(catfile($recipesdir,"*.t")); | |
41 | } else { | |
42 | my @t = (); | |
43 | foreach (@tests) { | |
44 | push @t, grep { | |
45 | basename($_) =~ /^[0-9][0-9]-[^\.]*\.t$/ | |
46 | } glob(catfile($recipesdir,"*-$_.t")); | |
47 | } | |
48 | @tests = @t; | |
49 | } | |
50 | ||
1780e6d9 RL |
51 | if ($list_mode) { |
52 | @tests = map { $_ = basename($_); $_ =~ s/^[0-9][0-9]-//; $_ =~ s/\.t$//; | |
53 | $_ } @tests; | |
54 | print join("\n", @tests), "\n"; | |
55 | } else { | |
56 | @tests = map { abs2rel($_, rel2abs(curdir())); } @tests; | |
aec27d4d | 57 | |
1780e6d9 RL |
58 | runtests(sort @tests); |
59 | } |