selftest: Add separate command line for listing tests, allowing us of subunit-filter...
[obnox/samba/samba-obnox.git] / selftest / selftest.pl
index 34ae6056efda87d21247813e64be4c54c64ec224..ea63ee528b5a242e2dea19a44c2809fd540bd6fd 100755 (executable)
@@ -574,10 +574,15 @@ sub read_testlist($)
                        $name =~ s/\n//g;
                        my $env = <IN>;
                        $env =~ s/\n//g;
+                       my $loadlist;
+                       if ($supports_loadlist) {
+                               $loadlist = <IN>;
+                               $loadlist =~ s/\n//g;
+                       }
                        my $cmdline = <IN>;
                        $cmdline =~ s/\n//g;
                        if (should_run_test($name) == 1) {
-                               push (@ret, [$name, $env, $cmdline, $supports_loadlist]);
+                               push (@ret, [$name, $env, $cmdline, $loadlist]);
                        }
                } else {
                        print;
@@ -937,11 +942,12 @@ $envvarstr
        teardown_env($testenv_name);
 } elsif ($opt_list) {
        foreach (@todo) {
-               my $cmd = $$_[2];
                my $name = $$_[0];
                my $envname = $$_[1];
+               my $cmd = $$_[2];
+               my $listcmd = $$_[3];
 
-               unless($cmd =~ /\$LISTOPT/) {
+               unless (defined($listcmd)) {
                        warn("Unable to list tests in $name");
                        # Rather than ignoring this testsuite altogether, just pretend the entire testsuite is
                        # a single "test".
@@ -949,14 +955,12 @@ $envvarstr
                        next;
                }
 
-               $cmd =~ s/\$LISTOPT/--list/g;
-
-               system($cmd);
+               system($listcmd);
 
                if ($? == -1) {
-                       die("Unable to run $cmd: $!");
+                       die("Unable to run $listcmd: $!");
                } elsif ($? & 127) {
-                       die(sprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127),  ($? & 128) ? 'with' : 'without'));
+                       die(sprintf("%s died with signal %d, %s coredump\n", $listcmd, ($? & 127),  ($? & 128) ? 'with' : 'without'));
                }
 
                my $exitcode = $? >> 8;