Run shell tests with and without daemon

This commit is contained in:
ZyX 2014-08-02 21:02:26 +04:00
parent 9290c2a23b
commit fed43e8af5
4 changed files with 61 additions and 40 deletions

View File

@ -8,9 +8,10 @@ import sys
import codecs
shell = sys.argv[1]
fname = os.path.join('tests', 'shell', shell + '.full.log')
new_fname = os.path.join('tests', 'shell', shell + '.log')
test_type = sys.argv[1]
shell = sys.argv[2]
fname = os.path.join('tests', 'shell', shell + '.' + test_type + '.full.log')
new_fname = os.path.join('tests', 'shell', shell + '.' + test_type + '.log')
pid_fname = os.path.join('tests', 'shell', '3rd', 'pid')

View File

@ -1,3 +1,3 @@
width 1024
height 1
logfile "tests/shell/${SH}.full.log"
logfile "tests/shell/${SH}.${TEST_TYPE}.full.log"

View File

@ -3,17 +3,23 @@ FAILED=0
ONLY_SHELL="$1"
check_screen_log() {
SH="$1"
if test -e tests/test_shells/${SH}.ok ; then
diff -u tests/test_shells/${SH}.ok tests/shell/${SH}.log
TEST_TYPE="$1"
SH="$2"
if test -e tests/test_shells/${SH}.${TEST_TYPE}.ok ; then
diff -a -u tests/test_shells/${SH}.${TEST_TYPE}.ok tests/shell/${SH}.${TEST_TYPE}.log
return $?
elif test -e tests/test_shells/${SH}.ok ; then
diff -a -u tests/test_shells/${SH}.ok tests/shell/${SH}.${TEST_TYPE}.log
return $?
else
cat tests/shell/${SH}.log
cat tests/shell/${SH}.${TEST_TYPE}.log
return 1
fi
}
run_test() {
TEST_TYPE="$1"
shift
SH="$1"
SESNAME="powerline-shell-test-${SH}-$$"
ARGS=( "$@" )
@ -32,6 +38,7 @@ run_test() {
fi
fi
export TEST_TYPE
export SH
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
@ -59,21 +66,21 @@ run_test() {
while screen -S "$SESNAME" -X blankerprg "" > /dev/null ; do
sleep 0.1s
done
./tests/test_shells/postproc.py ${SH}
if ! check_screen_log ${SH} ; then
./tests/test_shells/postproc.py ${TEST_TYPE} ${SH}
if ! check_screen_log ${TEST_TYPE} ${SH} ; then
echo '____________________________________________________________'
# Repeat the diff to make it better viewable in travis output
echo "Diff (cat -v):"
echo '============================================================'
check_screen_log ${SH} | cat -v
check_screen_log ${TEST_TYPE} ${SH} | cat -v
echo '____________________________________________________________'
echo "Failed ${SH}. Full output:"
echo '============================================================'
cat tests/shell/${SH}.full.log
cat tests/shell/${SH}.${TEST_TYPE}.full.log
echo '____________________________________________________________'
echo "Full output (cat -v):"
echo '============================================================'
cat -v tests/shell/${SH}.full.log
cat -v tests/shell/${SH}.${TEST_TYPE}.full.log
echo '____________________________________________________________'
case ${SH} in
*ksh)
@ -112,39 +119,52 @@ mkdir tests/shell/3rd/'(echo)'
mkdir tests/shell/3rd/'$(echo)'
mkdir tests/shell/3rd/'`echo`'
if ! run_test bash --norc --noprofile -i ; then
FAILED=1
fi
if ! run_test zsh -f -i ; then
FAILED=1
fi
mkdir tests/shell/fish_home
export XDG_CONFIG_HOME="$PWD/tests/shell/fish_home"
if ! run_test fish -i ; then
FAILED=1
fi
if ! run_test tcsh -f -i ; then
FAILED=1
fi
if ! run_test bb -i ; then
FAILED=1
fi
unset ENV
if ! run_test mksh -i ; then
FAILED=1
fi
powerline-daemon -k || true
sleep 1s
if ! run_test dash -i ; then
# dash tests are not stable, see #931
# FAILED=1
true
fi
for TEST_TYPE in "daemon" "nodaemon" ; do
if test $TEST_TYPE == daemon ; then
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
fi
if ! run_test $TEST_TYPE bash --norc --noprofile -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE zsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE fish -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE tcsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE bb -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE mksh -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE dash -i ; then
# dash tests are not stable, see #931
# FAILED=1
true
fi
if test $TEST_TYPE == daemon ; then
./scripts/powerline-daemon -k
wait $(cat tests/shell/daemon_pid)
fi
done
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
exit $FAILED

Binary file not shown.