mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 14:54:54 +02:00
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
|
import codecs
|
||||||
|
|
||||||
|
|
||||||
fname = sys.argv[1]
|
shell = sys.argv[1]
|
||||||
new_fname = fname + '.new'
|
fname = os.path.join('tests', 'shell', shell + '.full.log')
|
||||||
pid_fname = 'tests/shell/3rd/pid'
|
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:
|
with open(pid_fname, 'r') as P:
|
||||||
pid = P.read().strip()
|
pid = P.read().strip()
|
||||||
@ -42,5 +42,3 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
line = ''
|
line = ''
|
||||||
W.write(line)
|
W.write(line)
|
||||||
|
|
||||||
os.rename(new_fname, fname)
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
width 1024
|
width 1024
|
||||||
height 1
|
height 1
|
||||||
logfile "tests/shell/screen.log"
|
logfile "tests/shell/${SH}.full.log"
|
||||||
|
@ -3,11 +3,12 @@ FAILED=0
|
|||||||
ONLY_SHELL="$1"
|
ONLY_SHELL="$1"
|
||||||
|
|
||||||
check_screen_log() {
|
check_screen_log() {
|
||||||
if test -e tests/test_shells/${1}.ok ; then
|
SH="$1"
|
||||||
diff -u tests/test_shells/${1}.ok tests/shell/screen.log
|
if test -e tests/test_shells/${SH}.ok ; then
|
||||||
|
diff -u tests/test_shells/${SH}.ok tests/shell/${SH}.log
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
cat tests/shell/screen.log
|
cat tests/shell/${SH}.log
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -20,22 +21,21 @@ run_test() {
|
|||||||
|
|
||||||
which "${SH}" || return 0
|
which "${SH}" || return 0
|
||||||
|
|
||||||
|
export SH
|
||||||
|
|
||||||
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
screen -L -c tests/test_shells/screenrc -d -m -S "$SESNAME" \
|
||||||
env LANG=en_US.UTF-8 BINDFILE="$BINDFILE" "$@"
|
env LANG=en_US.UTF-8 BINDFILE="$BINDFILE" "$@"
|
||||||
screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH
|
screen -S "$SESNAME" -X readreg a tests/test_shells/input.$SH
|
||||||
# Wait for screen to initialize
|
# Wait for screen to initialize
|
||||||
sleep 1s
|
sleep 1s
|
||||||
screen -S "$SESNAME" -p 0 -X width 300 1
|
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
|
screen -S "$SESNAME" -p 0 -X paste a
|
||||||
# Wait for screen to exit (sending command to non-existing screen session
|
# Wait for screen to exit (sending command to non-existing screen session
|
||||||
# fails; when launched instance exits corresponding session is deleted)
|
# fails; when launched instance exits corresponding session is deleted)
|
||||||
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
|
||||||
cp tests/shell/screen.log tests/shell/${SH}.full.log
|
./tests/test_shells/postproc.py ${SH}
|
||||||
./tests/test_shells/postproc.py tests/shell/screen.log ${SH}
|
|
||||||
cp tests/shell/screen.log tests/shell/${SH}.log
|
|
||||||
if ! check_screen_log ${SH} ; then
|
if ! check_screen_log ${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
|
||||||
@ -52,10 +52,8 @@ run_test() {
|
|||||||
cat -v tests/shell/${SH}.full.log
|
cat -v tests/shell/${SH}.full.log
|
||||||
echo '____________________________________________________________'
|
echo '____________________________________________________________'
|
||||||
${SH} --version
|
${SH} --version
|
||||||
rm tests/shell/screen.log
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
rm tests/shell/screen.log
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +61,7 @@ test -d tests/shell && rm -r tests/shell
|
|||||||
mkdir tests/shell
|
mkdir tests/shell
|
||||||
git init tests/shell/3rd
|
git init tests/shell/3rd
|
||||||
git --git-dir=tests/shell/3rd/.git checkout -b BRANCH
|
git --git-dir=tests/shell/3rd/.git checkout -b BRANCH
|
||||||
|
mkdir tests/shell/3rd/"$(printf '\x08')"
|
||||||
|
|
||||||
if ! run_test bash --norc --noprofile -i ; then
|
if ! run_test bash --norc --noprofile -i ; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user