1- # $OpenBSD: ssh-tty.sh,v 1.1 2025/10/20 00:45:10 djm Exp $
1+ # $OpenBSD: ssh-tty.sh,v 1.2 2025/10/21 08:34:52 djm Exp $
22# Placed in the Public Domain.
33
44# Basic TTY smoke test
@@ -30,6 +30,8 @@ MAGIC3="woLF1701d"
3030MAGIC3_OCTAL=" \167\157\114\106\061\067\060\061\144"
3131MAGIC4=" lUh4thX4evR"
3232MAGIC4_OCTAL=" \154\125\150\064\164\150\130\064\145\166\122"
33+ MAGIC5=" AllMo1000x"
34+ MAGIC5_OCTAL=" \101\154\154\115\157\061\060\060\060\170"
3335
3436# Wait for a mux process to become ready.
3537wait_for_mux_ready ()
@@ -90,7 +92,7 @@ run_test() {
9092 # Prepare a tmux session.
9193 $TMUX_TEST kill-session -t $sess 2> /dev/null
9294 $TMUX_TEST new-session -d -s $sess
93- # echo XXXXXXXXXX $sess; sleep 10
95+ # echo XXXXXXXXXX $TMUX_TEST attach -t $sess; sleep 10
9496
9597 # Command to start SSH; sent as keystrokes to tmux session.
9698 RCMD=" $CLEANENV $SHELL "
@@ -108,13 +110,15 @@ run_test() {
108110 verbose " ${tag} : ^c interrupts process"
109111 # ^c should interrupt the sleep and prevent the magic string
110112 # from appearing.
111- $TMUX_TEST send-keys -t $sess " sleep 30 || printf '$MAGIC3_OCTAL \n'"
113+ $TMUX_TEST send-keys -t $sess \
114+ " printf '$MAGIC3_OCTAL ' ; sleep 30 || printf '$MAGIC4_OCTAL \n'"
112115 $TMUX_TEST send-keys -t $sess ENTER
116+ wait_for_regex " $MAGIC3 " # Command has executed.
113117 $TMUX_TEST send-keys -t $sess " C-c"
114118 # send another string to let us know that the sleep has finished.
115- $TMUX_TEST send-keys -t $sess " printf '$MAGIC4_OCTAL \n'" ENTER
116- wait_for_regex " $MAGIC4 "
117- not_in_term " $MAGIC3 " " ^c did not interrupt"
119+ $TMUX_TEST send-keys -t $sess " printf '$MAGIC5_OCTAL \n'" ENTER
120+ wait_for_regex " $MAGIC5 "
121+ not_in_term " $MAGIC4 " " ^c did not interrupt"
118122
119123 verbose " ${tag} : ~? produces help"
120124 $TMUX_TEST send-keys -t $sess ENTER " ~?"
@@ -143,6 +147,7 @@ not_in_term "$MAGIC1" "terminal already contains magic1 string" fatal
143147not_in_term " $MAGIC2 " " terminal already contains magic2 string" fatal
144148not_in_term " $MAGIC3 " " terminal already contains magic3 string" fatal
145149not_in_term " $MAGIC4 " " terminal already contains magic4 string" fatal
150+ not_in_term " $MAGIC5 " " terminal already contains magic5 string" fatal
146151not_in_term " ^Supported escape" " terminal already contains escape help" fatal
147152$TMUX_TEST send-keys -t $sess " printf '$MAGIC1_OCTAL \n'" ENTER
148153wait_for_regex " $MAGIC1 " fatal
0 commit comments