selftest: Allow for wider range of terminals (besides xterm)
authorTim Beale <timbeale@catalyst.net.nz>
Fri, 31 May 2019 00:33:59 +0000 (12:33 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 31 May 2019 05:18:20 +0000 (05:18 +0000)
Allow developers to override the default @term_args, as well as the
terminal itself.

Currently, due to the nature of the args we pass to xterm (i.e. 'echo -e
"blah.." && bash'), it doesn't make it very flexible for use with other
terminals. By dropping these additional @term_args, it makes it much
easier to slot in an alternative terminal.

For example, these commands now work (more or less).

TERMINAL="terminator" TERMINAL_ARGS="-x bash" \
 SELFTEST_TESTENV=ad_dc make testenv

TERMINAL="bash" TERMINAL_ARGS="" \
 SELFTEST_TESTENV=nt4_dc make testenv

TERMINAL="bash" TERMINAL_ARGS="--norc" \
 SELFTEST_TESTENV=none make testenv

bash is usable, but a little weird because its output is still being
piped. Also bash with ad_dc is a little weird because we're using tee
for the DC's stdout. (I'd also recommend --norc, as it makes it easier
to differentiate between the testenv shell).

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

index 228bb29ecfe9891ce24effed0a9a4180bb1bca78..1bbe2f81bcfd07056ac6a1b21fc65705dc666dbd 100755 (executable)
@@ -964,6 +964,10 @@ $envvarstr
        my @term = ();
        if ($ENV{TERMINAL}) {
            @term = ($ENV{TERMINAL});
+               # override the default terminal args (if specified)
+               if (defined($ENV{TERMINAL_ARGS})) {
+                       @term_args = split(/ /, $ENV{TERMINAL_ARGS});
+               }
        } else {
            @term = ("xterm", "-e");
            unshift(@term_args, ("bash", "-c"));