End to end test suite for Mosh sessions.
For original messy development history, see https://github.com/cgull/mosh/tree/localhost or https://github.com/cgull/mosh/commit/e7feed48a4a271e2977f714f58acfa04cdaa5cca
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Harness script for Mosh tests, server side. Runs test script and
|
||||
# then captures screen with `tmux capture-pane`. Captures exitstatus
|
||||
# of both and returns appropriate errors.
|
||||
#
|
||||
if [ $# -lt 2 ]; then
|
||||
printf "not enough args\n" >&2
|
||||
exit 99
|
||||
fi
|
||||
testname=$1
|
||||
shift
|
||||
rm -f $testname.capture $testname.exitstatus
|
||||
trap 'rv=$?; echo $rv > $testname.exitstatus; exit $rv' EXIT
|
||||
# check for tmux
|
||||
if [ -z "$TMUX_PANE" ]; then
|
||||
printf "not running under tmux\n" >&2
|
||||
exit 99
|
||||
fi
|
||||
# run harnessed command
|
||||
eval "$@"
|
||||
testret=$?
|
||||
# Wait a bit for tmux screen to become up to date.
|
||||
sleep 1
|
||||
# capture screen
|
||||
if ! tmux capture-pane -et $TMUX_PANE; then
|
||||
printf "tmux capture-pane failed, erroring test\n" >&2
|
||||
exit 99
|
||||
fi
|
||||
if ! tmux save-buffer $testname.capture; then
|
||||
printf "tmux save-buffer failed, erroring test\n" >&2
|
||||
exit 99
|
||||
fi
|
||||
# return useful exitstatus from harnessed command
|
||||
if [ $testret -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
Reference in New Issue
Block a user