selftest: Abort if we fail to startup testenv with '--one' option
authorTim Beale <timbeale@catalyst.net.nz>
Mon, 18 Feb 2019 02:34:51 +0000 (15:34 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Feb 2019 23:37:14 +0000 (00:37 +0100)
The --one selftest.pl option means abort when the first test fails.
However, when 'make test' fails to startup a testenv, it'll try to
continue and run other tests by default. When '--one' is used,
selftest.pl can just die() at that point.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/selftest.pl

index 9aea62a3d2aad679be7a6c2dfbaae7333cd0b7c2..ec44b89dac7a7895f074944c5e538ac49bf4dfbd 100755 (executable)
@@ -944,7 +944,11 @@ sub setup_env($$)
                        $testenv_vars->{target} = $target;
                }
                if (not defined($testenv_vars)) {
-                       warn("$opt_target can't start up known environment '$envname'");
+                       if ($opt_one) {
+                               die("$opt_target can't start up known environment '$envname'");
+                       } else {
+                               warn("$opt_target can't start up known environment '$envname'");
+                       }
                }
        }