From 1780e6d916d83f812ffceec56ac3d8fa97b83248 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 15 Sep 2015 14:07:10 +0200 Subject: [PATCH] Add a method to list available tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Emilia Käsper --- Makefile.org | 4 ++++ test/Makefile | 2 ++ test/run_tests.pl | 13 ++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Makefile.org b/Makefile.org index 2f8e472ccf..c56aa8648a 100644 --- a/Makefile.org +++ b/Makefile.org @@ -439,6 +439,10 @@ tests: rehash $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests ); OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a +list-tests: + @(cd test && \ + $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. list-tests) + report: @$(PERL) util/selftest.pl diff --git a/test/Makefile b/test/Makefile index 779d23a2f4..e9386335f5 100644 --- a/test/Makefile +++ b/test/Makefile @@ -153,6 +153,8 @@ tags: tests: exe apps TOP=$(TOP) PERL=$(PERL) $(PERL) run_tests.pl $(TESTS) +list-tests: + @TOP=$(TOP) PERL=$(PERL) $(PERL) run_tests.pl list apps: @(cd ..; $(MAKE) DIRS=apps all) diff --git a/test/run_tests.pl b/test/run_tests.pl index 7e61282f16..cacbc02b11 100644 --- a/test/run_tests.pl +++ b/test/run_tests.pl @@ -26,7 +26,8 @@ my @tests = ( "alltests" ); if (@ARGV) { @tests = @ARGV; } -if (grep /^alltests$/, @tests) { +my $list_mode = scalar(grep /^list$/, @tests) != 0; +if (grep /^alltests|list$/, @tests) { @tests = grep { basename($_) =~ /^[0-9][0-9]-[^\.]*\.t$/ } glob(catfile($recipesdir,"*.t")); @@ -40,6 +41,12 @@ if (grep /^alltests$/, @tests) { @tests = @t; } -@tests = map { abs2rel($_, rel2abs(curdir())); } @tests; +if ($list_mode) { + @tests = map { $_ = basename($_); $_ =~ s/^[0-9][0-9]-//; $_ =~ s/\.t$//; + $_ } @tests; + print join("\n", @tests), "\n"; +} else { + @tests = map { abs2rel($_, rel2abs(curdir())); } @tests; -runtests(sort @tests); + runtests(sort @tests); +} -- 2.25.1