From ae83999b75165669ba468defa4cddced3ef2b058 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 12 May 2022 13:27:21 +1000 Subject: tests: Don't globally set tmux default-shell run_term() uses tmux set-option -g to globally set the default shell. Unfortunately this hits a chicken-and-egg problem that's common with many of tmux's session options. If there isn't already a tmux server running, we can't connect to set the option. If we attempt this after starting our session (and therefore the server), then the session will already be started with the previous default shell. In any case it's not a good idea to set tmux global options, since that might interfere with whatever else the user is doing in tmux. So, instead set the default-shell option locally to the session after starting it. To make sure we get the right shell for our initial script, explicitly invoke /bin/sh to interpret it. Signed-off-by: David Gibson --- test/lib/term | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/lib') diff --git a/test/lib/term b/test/lib/term index 42b0020..7dd9826 100755 --- a/test/lib/term +++ b/test/lib/term @@ -542,26 +542,25 @@ pause_continue() { # run_term() - Start tmux session, running entry point, with recording if needed run_term() { - export SHELL="/bin/sh" - tmux set-option -g default-shell "/bin/sh" - TMUX="tmux new-session -s passt_test -ePCAP=$PCAP -eDEBUG=$DEBUG" if [ ${CI} -eq 1 ]; then printf '\e[8;50;240t' - asciinema rec --overwrite ci.uncut -c "$TMUX ./ci from_term" + asciinema rec --overwrite ci.uncut -c "$TMUX /bin/sh -c './ci from_term'" video_postprocess ci.uncut elif [ ${DEMO} -eq 1 ]; then printf '\e[8;40;130t' - asciinema rec --overwrite demo.uncut -c "$TMUX ./run_demo from_term" + asciinema rec --overwrite demo.uncut -c "$TMUX /bin/sh -c './run_demo from_term'" video_postprocess demo.uncut else - $TMUX ./run from_term + $TMUX /bin/sh -c './run from_term' fi } # term() - Set up terminal window and panes for regular tests or CI term() { + tmux set-option default-shell "/bin/sh" + tmux set status-interval 1 tmux rename-window '' @@ -596,6 +595,8 @@ term() { # term_demo() - Set up terminal window and panes for demo term_demo() { + tmux set-option default-shell "/bin/sh" + tmux set status-interval 1 tmux rename-window '' -- cgit v1.2.3