Merge pull request #974 from ZyX-I/shell-tests-improvements

Shell tests improvements
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-08-10 17:20:27 +04:00
commit c8cc7e464e
16 changed files with 32 additions and 28 deletions

View File

@ -2,11 +2,11 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1s
[1]+ Terminated bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done'
[1]+ Terminated bgscript.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd "$DIR1"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  cd ../"$DIR2"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  cd ../'\[\]'

5
tests/test_shells/bgscript.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
echo $$ > pid
while true ; do
sleep 0.1s
done

View File

@ -2,10 +2,10 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1s
[1]+ Terminated bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done"
[1]+ Terminated bgscript.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  cd "$DIR1"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  cd ../"$DIR2"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  cd ../'\[\]'

View File

@ -2,10 +2,10 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1s
[1] + Terminated bash -c "echo \$\$>pid ; while true ; do sleep 0.1s ; done"
[1] + Terminated bgscript.sh
cd "$DIR1"
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1    HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  cd ../"$DIR2"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  cd ../'\[\]'

View File

@ -8,7 +8,7 @@ cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill `cat pid` ; sleep 1s
cd "$DIR1"

View File

@ -8,7 +8,7 @@ cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill `cat pid` ; sleep 1s
cd "$DIR1"

View File

@ -8,7 +8,7 @@ cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill `cat pid` ; sleep 1s
cd "$DIR1"

View File

@ -9,7 +9,7 @@ cd .git
cd ..
setenv VIRTUAL_ENV "$HOME/.virtenvs/some-virtual-environment"
setenv VIRTUAL_ENV
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill (cat pid) ; sleep 1s
cd "$DIR1"

View File

@ -8,7 +8,7 @@ cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill `cat pid` ; sleep 1
cd "$DIR1"

View File

@ -6,7 +6,7 @@ cd .git
cd ..
setenv VIRTUAL_ENV "/home/foo/.virtenvs/some-virtual-environment"
unsetenv VIRTUAL_ENV
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false # Warning: currently tcsh bindings do not support job count
kill `cat pid` ; sleep 1s
cd $DIR1:q

View File

@ -14,7 +14,7 @@ cd .git
cd ..
VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
VIRTUAL_ENV=
bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
bgscript.sh & waitpid.sh
false
kill `cat pid` ; sleep 1s
cd "$DIR1"

View File

@ -3,7 +3,7 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1

View File

@ -46,15 +46,7 @@ run_test() {
test "x$ONLY_SHELL" = "x" || test "x$ONLY_SHELL" = "x$SH" || return 0
if ! which "${SH}" ; then
if test "x${SH}" = "xbb" ; then
if ! which busybox ; then
return 0
fi
shift
ARGS=( busybox ash "$@" )
else
return 0
fi
return 0
fi
export TEST_TYPE
@ -86,6 +78,7 @@ run_test() {
sleep 0.1s
done
./tests/test_shells/postproc.py ${TEST_TYPE} ${SH}
rm -f tests/shell/3rd/pid
if ! check_screen_log ${TEST_TYPE} ${SH} ; then
echo '____________________________________________________________'
# Repeat the diff to make it better viewable in travis output
@ -108,8 +101,8 @@ run_test() {
dash)
# ?
;;
bb)
bb --help
busybox)
busybox --help
;;
*)
${SH} --version
@ -159,6 +152,8 @@ ln -s "$(which cut)" tests/shell/path
ln -s "$(which bc)" tests/shell/path
ln -s "$(which expr)" tests/shell/path
ln -s "$(which mktemp)" tests/shell/path
ln -s ../../test_shells/bgscript.sh tests/shell/path
ln -s ../../test_shells/waitpid.sh tests/shell/path
for pexe in powerline powerline-config ; do
if test -e scripts/$pexe ; then
ln -s "$PWD/scripts/$pexe" tests/shell/path
@ -204,7 +199,7 @@ if test -z "${ONLY_SHELL}" || test "x${ONLY_SHELL%sh}" != "x${ONLY_SHELL}" || te
FAILED=1
fi
if ! run_test $TEST_TYPE bb -i ; then
if ! run_test $TEST_TYPE busybox ash -i ; then
FAILED=1
fi

4
tests/test_shells/waitpid.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
while ! test -e pid ; do
sleep 0.1s
done

Binary file not shown.

View File

@ -3,11 +3,11 @@
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  .git  cd ..
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV="$HOME/.virtenvs/some-virtual-environment"
  HOSTNAME  USER  ⓔ  some-virtual-environment   BRANCH  ⋯  tests  shell  3rd  VIRTUAL_ENV=
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done' &
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  bgscript.sh & waitpid.sh
[1] PID
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  false
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  1  1  kill `cat pid` ; sleep 1s
[1] + terminated bash -c 'echo $$>pid ; while true ; do sleep 0.1s ; done'
[1] + terminated bgscript.sh
  HOSTNAME  USER   BRANCH  ⋯  tests  shell  3rd  cd "$DIR1"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^[[32m  cd ../"$DIR2"
  HOSTNAME  USER   BRANCH  ⋯  shell  3rd  ^H  cd ../'\[\]'