Add a pause mechanism for debugging tests.
This commit is contained in:
@@ -5,6 +5,29 @@
|
||||
# then captures screen with `tmux capture-pane`. Captures exitstatus
|
||||
# of both and returns appropriate errors.
|
||||
#
|
||||
|
||||
# If MOSH_E2E_WAIT is set, then the test will wait for another tmux
|
||||
# client to attach to the test session before starting, and will wait
|
||||
# for other tmux clients to detach before exiting.
|
||||
wait_for_clients()
|
||||
{
|
||||
if [ -z "$MOSH_E2E_WAIT" ]; then
|
||||
return
|
||||
fi
|
||||
expected=$1
|
||||
while true; do
|
||||
n=$(tmux list-clients -F . | wc -l)
|
||||
if [ $expected -eq 1 ]; then
|
||||
if [ $n -eq 1 ]; then
|
||||
return
|
||||
fi
|
||||
elif [ $n -ne 1 ]; then
|
||||
return
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
export MOSH_SERVER_PID=$PPID
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
@@ -26,6 +49,7 @@ if [ -z "$TMUX_PANE" ]; then
|
||||
printf "not running under tmux\n" >&2
|
||||
exit 99
|
||||
fi
|
||||
wait_for_clients 2
|
||||
# run harnessed command
|
||||
eval "$@"
|
||||
testret=$?
|
||||
@@ -37,6 +61,7 @@ fi
|
||||
# Wait for tmux client screen to become up to date.
|
||||
sleep 1
|
||||
printf "@@@ server complete @@@" >&2
|
||||
wait_for_clients 1
|
||||
i=0
|
||||
while [ $i -lt 60 ]; do
|
||||
if grep -q "@@@ server complete @@@" "$testname.tmux.log"; then
|
||||
|
||||
Reference in New Issue
Block a user