mirror of
https://github.com/powerline/powerline.git
synced 2025-07-30 01:05:42 +02:00
Run shell tests with and without daemon
This commit is contained in:
parent
9290c2a23b
commit
fed43e8af5
@ -8,9 +8,10 @@ import sys
|
|||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
|
|
||||||
shell = sys.argv[1]
|
test_type = sys.argv[1]
|
||||||
fname = os.path.join('tests', 'shell', shell + '.full.log')
|
shell = sys.argv[2]
|
||||||
new_fname = os.path.join('tests', 'shell', shell + '.log')
|
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')
|
pid_fname = os.path.join('tests', 'shell', '3rd', 'pid')
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
width 1024
|
width 1024
|
||||||
height 1
|
height 1
|
||||||
logfile "tests/shell/${SH}.full.log"
|
logfile "tests/shell/${SH}.${TEST_TYPE}.full.log"
|
||||||
|
@ -3,17 +3,23 @@ FAILED=0
|
|||||||
ONLY_SHELL="$1"
|
ONLY_SHELL="$1"
|
||||||
|
|
||||||
check_screen_log() {
|
check_screen_log() {
|
||||||
SH="$1"
|
TEST_TYPE="$1"
|
||||||
if test -e tests/test_shells/${SH}.ok ; then
|
SH="$2"
|
||||||
diff -u tests/test_shells/${SH}.ok tests/shell/${SH}.log
|
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 $?
|
return $?
|
||||||
else
|
else
|
||||||
cat tests/shell/${SH}.log
|
cat tests/shell/${SH}.${TEST_TYPE}.log
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
|
TEST_TYPE="$1"
|
||||||
|
shift
|
||||||
SH="$1"
|
SH="$1"
|
||||||
SESNAME="powerline-shell-test-${SH}-$$"
|
SESNAME="powerline-shell-test-${SH}-$$"
|
||||||
ARGS=( "$@" )
|
ARGS=( "$@" )
|
||||||
@ -32,6 +38,7 @@ run_test() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export TEST_TYPE
|
||||||
export SH
|
export SH
|
||||||
|
|
||||||
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
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
|
while screen -S "$SESNAME" -X blankerprg "" > /dev/null ; do
|
||||||
sleep 0.1s
|
sleep 0.1s
|
||||||
done
|
done
|
||||||
./tests/test_shells/postproc.py ${SH}
|
./tests/test_shells/postproc.py ${TEST_TYPE} ${SH}
|
||||||
if ! check_screen_log ${SH} ; then
|
if ! check_screen_log ${TEST_TYPE} ${SH} ; then
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
# Repeat the diff to make it better viewable in travis output
|
# Repeat the diff to make it better viewable in travis output
|
||||||
echo "Diff (cat -v):"
|
echo "Diff (cat -v):"
|
||||||
echo '============================================================'
|
echo '============================================================'
|
||||||
check_screen_log ${SH} | cat -v
|
check_screen_log ${TEST_TYPE} ${SH} | cat -v
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
echo "Failed ${SH}. Full output:"
|
echo "Failed ${SH}. Full output:"
|
||||||
echo '============================================================'
|
echo '============================================================'
|
||||||
cat tests/shell/${SH}.full.log
|
cat tests/shell/${SH}.${TEST_TYPE}.full.log
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
echo "Full output (cat -v):"
|
echo "Full output (cat -v):"
|
||||||
echo '============================================================'
|
echo '============================================================'
|
||||||
cat -v tests/shell/${SH}.full.log
|
cat -v tests/shell/${SH}.${TEST_TYPE}.full.log
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
case ${SH} in
|
case ${SH} in
|
||||||
*ksh)
|
*ksh)
|
||||||
@ -112,39 +119,52 @@ mkdir tests/shell/3rd/'(echo)'
|
|||||||
mkdir tests/shell/3rd/'$(echo)'
|
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
|
mkdir tests/shell/fish_home
|
||||||
export XDG_CONFIG_HOME="$PWD/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
|
unset ENV
|
||||||
|
|
||||||
if ! run_test mksh -i ; then
|
powerline-daemon -k || true
|
||||||
FAILED=1
|
sleep 1s
|
||||||
fi
|
|
||||||
|
|
||||||
if ! run_test dash -i ; then
|
for TEST_TYPE in "daemon" "nodaemon" ; do
|
||||||
# dash tests are not stable, see #931
|
if test $TEST_TYPE == daemon ; then
|
||||||
# FAILED=1
|
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
|
||||||
true
|
fi
|
||||||
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
|
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
|
||||||
exit $FAILED
|
exit $FAILED
|
||||||
|
BIN
tests/test_shells/zsh.daemon.ok
Normal file
BIN
tests/test_shells/zsh.daemon.ok
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user