diff --git a/tests/test_shells/postproc.py b/tests/test_shells/postproc.py index 1654bc7c..9696b5b9 100755 --- a/tests/test_shells/postproc.py +++ b/tests/test_shells/postproc.py @@ -8,11 +8,11 @@ import sys import codecs -fname = sys.argv[1] -new_fname = fname + '.new' -pid_fname = 'tests/shell/3rd/pid' +shell = sys.argv[1] +fname = os.path.join('tests', 'shell', shell + '.full.log') +new_fname = os.path.join('tests', 'shell', shell + '.log') +pid_fname = os.path.join('tests', 'shell', '3rd', 'pid') -shell = sys.argv[2] with open(pid_fname, 'r') as P: pid = P.read().strip() @@ -42,5 +42,3 @@ with codecs.open(fname, 'r', encoding='utf-8') as R: except ValueError: line = '' W.write(line) - -os.rename(new_fname, fname) diff --git a/tests/test_shells/screenrc b/tests/test_shells/screenrc index ad5a1466..d998652a 100644 --- a/tests/test_shells/screenrc +++ b/tests/test_shells/screenrc @@ -1,3 +1,3 @@ width 1024 height 1 -logfile "tests/shell/screen.log" +logfile "tests/shell/${SH}.full.log" diff --git a/tests/test_shells/test.sh b/tests/test_shells/test.sh index 3d8b8cc2..a53d507f 100755 --- a/tests/test_shells/test.sh +++ b/tests/test_shells/test.sh @@ -3,11 +3,12 @@ FAILED=0 ONLY_SHELL="$1" check_screen_log() { - if test -e tests/test_shells/${1}.ok ; then - diff -u tests/test_shells/${1}.ok tests/shell/screen.log + SH="$1" + if test -e tests/test_shells/${SH}.ok ; then + diff -u tests/test_shells/${SH}.ok tests/shell/${SH}.log return $? else - cat tests/shell/screen.log + cat tests/shell/${SH}.log return 1 fi } @@ -20,22 +21,21 @@ run_test() { which "${SH}" || return 0 + export SH + screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \ env LANG=en_US.UTF-8 BINDFILE="$BINDFILE" "$@" screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH # Wait for screen to initialize sleep 1s 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 # Wait for screen to exit (sending command to non-existing screen session # fails; when launched instance exits corresponding session is deleted) while screen -S "$SESNAME" -X blankerprg "" > /dev/null ; do sleep 0.1s done - cp tests/shell/screen.log tests/shell/${SH}.full.log - ./tests/test_shells/postproc.py tests/shell/screen.log ${SH} - cp tests/shell/screen.log tests/shell/${SH}.log + ./tests/test_shells/postproc.py ${SH} if ! check_screen_log ${SH} ; then echo '____________________________________________________________' # Repeat the diff to make it better viewable in travis output @@ -52,10 +52,8 @@ run_test() { cat -v tests/shell/${SH}.full.log echo '____________________________________________________________' ${SH} --version - rm tests/shell/screen.log return 1 fi - rm tests/shell/screen.log return 0 } @@ -63,6 +61,7 @@ test -d tests/shell && rm -r tests/shell mkdir tests/shell git init tests/shell/3rd git --git-dir=tests/shell/3rd/.git checkout -b BRANCH +mkdir tests/shell/3rd/"$(printf '\x08')" if ! run_test bash --norc --noprofile -i ; then FAILED=1