selftest: use an array when starting testenv with system()
authorAndrew Bartlett <abartlet@samba.org>
Sat, 29 Sep 2012 10:40:13 +0000 (20:40 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 30 Sep 2012 00:30:39 +0000 (02:30 +0200)
By reduing the need for escapes and forcing the use of bash, this
seems to allow 'make testenv' to start on FreeBSD

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Sep 30 02:30:40 CEST 2012 on sn-devel-104

selftest/selftest.pl

index b636910f526fa5d99033beb468997e3df4631691..b50853e54d3a5fad2aba2319b2b6d1479864089d 100755 (executable)
@@ -838,8 +838,13 @@ if ($opt_testenv) {
 
        my $envvarstr = exported_envvars_str($testenv_vars);
 
-       my $term = ($ENV{TERMINAL} or "xterm -e");
-       system("$term 'echo -e \"
+       my @term = ();
+       if ($ENV{TERMINAL}) {
+           @term = ($ENV{TERMINAL});
+       } else {
+           @term = ("xterm", "-e");
+       }
+       my @term_args = ("bash", "-c", "echo -e \"
 Welcome to the Samba4 Test environment '$testenv_name'
 
 This matches the client environment used in make test
@@ -850,7 +855,10 @@ TORTURE_OPTIONS=\$TORTURE_OPTIONS
 SMB_CONF_PATH=\$SMB_CONF_PATH
 
 $envvarstr
-\" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'");
+\" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash");
+
+       system(@term, @term_args);
+
        teardown_env($testenv_name);
 } elsif ($opt_list) {
        foreach (@todo) {