From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 05/12] tests: Don't globally set tmux default-shell Date: Tue, 17 May 2022 14:36:07 +0200 Message-ID: <20220517123614.1892316-6-sbrivio@redhat.com> In-Reply-To: <20220517123614.1892316-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4582172319246632716==" --===============4582172319246632716== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: David Gibson 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(-) 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() { =20 # run_term() - Start tmux session, running entry point, with recording if ne= eded run_term() { - export SHELL=3D"/bin/sh" - tmux set-option -g default-shell "/bin/sh" - TMUX=3D"tmux new-session -s passt_test -ePCAP=3D$PCAP -eDEBUG=3D$DEBUG" =20 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 } =20 # 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 '' =20 @@ -596,6 +595,8 @@ term() { =20 # 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 '' =20 --=20 2.35.1 --===============4582172319246632716==--