2014-01-11 10:16:25 +01:00
|
|
|
#!/bin/sh
|
|
|
|
FAILED=0
|
2014-01-11 10:31:57 +01:00
|
|
|
|
2014-01-11 10:16:25 +01:00
|
|
|
if [ "$(echo '\e')" != '\e' ] ; then
|
|
|
|
safe_echo() {
|
|
|
|
echo -E "$@"
|
|
|
|
}
|
|
|
|
else
|
|
|
|
safe_echo() {
|
|
|
|
echo "$@"
|
|
|
|
}
|
|
|
|
fi
|
2014-01-11 10:31:57 +01:00
|
|
|
|
2014-01-17 18:34:18 +01:00
|
|
|
check_screen_log() {
|
2014-01-22 05:33:43 +01:00
|
|
|
if test -e tests/test_shells/${1}.ok ; then
|
|
|
|
diff -u tests/test_shells/${1}.ok tests/shell/screen.log
|
|
|
|
return $?
|
|
|
|
else
|
|
|
|
cat tests/shell/screen.log
|
|
|
|
return 1
|
|
|
|
fi
|
2014-01-17 18:34:18 +01:00
|
|
|
}
|
|
|
|
|
2014-01-12 21:53:38 +01:00
|
|
|
run_test() {
|
2014-01-12 22:07:13 +01:00
|
|
|
SH="$1"
|
2014-01-12 21:53:38 +01:00
|
|
|
SESNAME="powerline-shell-test-$$"
|
2014-01-12 22:07:13 +01:00
|
|
|
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
2014-01-13 16:47:58 +01:00
|
|
|
env LANG=en_US.UTF-8 BINDFILE="$BINDFILE" "$@"
|
2014-01-12 22:07:13 +01:00
|
|
|
screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH
|
2014-01-17 18:34:18 +01:00
|
|
|
# Wait for screen to initialize
|
2014-01-13 21:18:34 +01:00
|
|
|
sleep 0.3s
|
2014-01-12 21:53:38 +01:00
|
|
|
screen -S "$SESNAME" -p 0 -X width 300 1
|
|
|
|
screen -S "$SESNAME" -p 0 -X logfile tests/shell/screen.log
|
|
|
|
screen -S "$SESNAME" -p 0 -X paste a
|
2014-01-17 18:34:18 +01:00
|
|
|
# Wait for screen to exit (sending command to non-existing screen session
|
|
|
|
# fails; when launched instance exits corresponding session is deleted)
|
2014-01-12 21:53:38 +01:00
|
|
|
while screen -S "$SESNAME" -X blankerprg "" > /dev/null ; do
|
2014-01-17 18:34:18 +01:00
|
|
|
sleep 0.1s
|
2014-01-12 21:53:38 +01:00
|
|
|
done
|
2014-01-13 19:37:33 +01:00
|
|
|
./tests/test_shells/postproc.py tests/shell/screen.log
|
2014-01-17 18:34:18 +01:00
|
|
|
if ! check_screen_log ${SH} ; then
|
|
|
|
# Repeat the diff to make it better viewable in travis output
|
|
|
|
check_screen_log ${SH} | cat -v
|
2014-01-22 05:33:43 +01:00
|
|
|
echo "Failed ${SH}"
|
2014-01-12 21:53:38 +01:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
2014-01-11 10:36:02 +01:00
|
|
|
}
|
|
|
|
|
2014-01-11 10:16:25 +01:00
|
|
|
mkdir tests/shell
|
2014-01-11 10:31:57 +01:00
|
|
|
git init tests/shell/3rd
|
|
|
|
git --git-dir=tests/shell/3rd/.git checkout -b BRANCH
|
|
|
|
|
2014-01-12 21:53:38 +01:00
|
|
|
if ! run_test bash --norc --noprofile -i ; then
|
2014-01-11 10:16:25 +01:00
|
|
|
FAILED=1
|
|
|
|
fi
|
2014-01-12 22:07:13 +01:00
|
|
|
rm tests/shell/screen.log
|
|
|
|
|
2014-01-13 16:47:58 +01:00
|
|
|
if ! run_test zsh -f -i ; then
|
|
|
|
FAILED=1
|
|
|
|
fi
|
2014-01-22 05:33:43 +01:00
|
|
|
rm tests/shell/screen.log
|
|
|
|
|
|
|
|
export XDG_CONFIG_HOME=/dev/null
|
|
|
|
if ! run_test fish -i ; then
|
|
|
|
FAILED=1
|
|
|
|
fi
|
2014-01-13 16:47:58 +01:00
|
|
|
rm tests/shell/screen.log
|
|
|
|
|
2014-01-11 10:16:25 +01:00
|
|
|
rm -r tests/shell
|
|
|
|
exit $FAILED
|