Add a method to list available tests
authorRichard Levitte <levitte@openssl.org>
Tue, 15 Sep 2015 12:07:10 +0000 (14:07 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 15 Sep 2015 12:07:10 +0000 (14:07 +0200)
Reviewed-by: Emilia Käsper <emilia@openssl.org>
Makefile.org
test/Makefile
test/run_tests.pl

index 2f8e472ccf96133bec4543ffd57010b8001faf98..c56aa8648aaceca425dae2233b583f4ed2fb3906 100644 (file)
@@ -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
 
index 779d23a2f4f0f869550f6eb091d98a41c149c111..e9386335f5a3dc19a545fd8ba9825df5c0b84a92 100644 (file)
@@ -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)
index 7e61282f16cad6e69353b4f497ed8729d5faad38..cacbc02b116bd1ac697343a5a0ae5cde06ca2d60 100644 (file)
@@ -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);
+}