From fed43e8af50a428ee2d2058d9a682974918df578 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 2 Aug 2014 21:02:26 +0400 Subject: [PATCH] Run shell tests with and without daemon --- tests/test_shells/postproc.py | 7 +-- tests/test_shells/screenrc | 2 +- tests/test_shells/test.sh | 92 +++++++++++++++++++------------- tests/test_shells/zsh.daemon.ok | Bin 0 -> 11672 bytes 4 files changed, 61 insertions(+), 40 deletions(-) create mode 100644 tests/test_shells/zsh.daemon.ok diff --git a/tests/test_shells/postproc.py b/tests/test_shells/postproc.py index ce68c9d5..f34fa81c 100755 --- a/tests/test_shells/postproc.py +++ b/tests/test_shells/postproc.py @@ -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') diff --git a/tests/test_shells/screenrc b/tests/test_shells/screenrc index d998652a..7c9674e5 100644 --- a/tests/test_shells/screenrc +++ b/tests/test_shells/screenrc @@ -1,3 +1,3 @@ width 1024 height 1 -logfile "tests/shell/${SH}.full.log" +logfile "tests/shell/${SH}.${TEST_TYPE}.full.log" diff --git a/tests/test_shells/test.sh b/tests/test_shells/test.sh index b0f30fed..656f2f71 100755 --- a/tests/test_shells/test.sh +++ b/tests/test_shells/test.sh @@ -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 diff --git a/tests/test_shells/zsh.daemon.ok b/tests/test_shells/zsh.daemon.ok new file mode 100644 index 0000000000000000000000000000000000000000..3e4000aed992ae14f684fbc9e44e4f914e4d5377 GIT binary patch literal 11672 zcmeHNTW;Dw6zw-#$j?=3N>Izg50X|Wm1u$#ssIsr^uwXS;7M`uBeET;D9TTM``Io4 zbpvg;z*4e+tf4cuNe2=fQ&qts0}|jF-!U`i-ZN+JOkzpS8%wevk`D=gyvGGa@pZ9K z6oh;qQOq4bfJ|Oz~j6q5Eh&>!^_Zq`3(OAaS~>0M3fS$m=lnlNf|M z%@}+HnF#o08G0UNOhqrg;dfAJ?CqDfkIJ=!^<{3WUM=Ucea&`}*>`e|WuOeXI#u)x zF41huG?3{o#{us(i6)YO>qlI?CK*@Xz7H|oPU{2Z*0?2~e;I+}>9R1!0F&f#o4{!g zii2OUX_$zfSy5~&P8TvANTE*G0*-roqNz}XFI`PX;M%7MU#J#1IzlIq&+?9UZK4#s zNXUE>b}E|;{6{kh1akNe0;R<=PjRFtk0+$tv7$SOp}y#-6KBD6GJR205DeN?2=z>O zii332aY1Q!Kr=x_$MC7E!RMYH<~`#ShG%lG5i+Mg{QG8^NY-eRy;H4)=my}I&;A&v zh3Qe-MoMoXdZSt;cIKDE`9J!hr|CMhI*JQeY__nV^wlNrc#0BUf{ScJGZh!90RJpdnOi*?fij^Q zaB6Uw+pIMBSmYbxysn&2cJQMtivmumhl(ST-_7Pc90i7>ucD{s3Fn04*lxrf0@ued zbtoS;Q;bf->2y925@;d?Vk((r5XLeJlgVfRK9}2;uChQ3_DW;Mr2#t8pj;u#?KF$W zSjM9dPBb7nh9uc^7@c2;Sxg4#M1!(LVzR|zGL|vvgA)ZvCR4*@YJ5*5?9@M$8{3sy z`DmkFt(Iz=>np(BDwO$GQWLmy?)-LDp?Q%z($TSNnfloUq;Y1ct(j^Mok6A_3&$7{ z<=7cB`n=Wx9`uUC0k5Yx?#$uo`GO9zS(oZF9*kiFKc|8BHZjQ_<~{qE54NfF6lupl G9P$SVyM#di literal 0 HcmV?d00001