Do not do needless copying in test_shells/test.sh
This commit is contained in:
parent
e7820efe56
commit
e3bf63e55c
|
@ -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)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
width 1024
|
||||
height 1
|
||||
logfile "tests/shell/screen.log"
|
||||
logfile "tests/shell/${SH}.full.log"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue