mirror of
https://github.com/powerline/powerline.git
synced 2025-07-27 07:44:36 +02:00
Improve test_shells/test.sh:
- Add argument that makes it run only one shell - Make this argument also force skipping removal of tests/shell directory - Make it copy logs to tests/shell before and after processing
This commit is contained in:
parent
11f86e77b0
commit
166f827c9f
@ -1,15 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
FAILED=0
|
FAILED=0
|
||||||
|
ONLY_SHELL="$1"
|
||||||
if [ "$(echo '\e')" != '\e' ] ; then
|
|
||||||
safe_echo() {
|
|
||||||
echo -E "$@"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
safe_echo() {
|
|
||||||
echo "$@"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_screen_log() {
|
check_screen_log() {
|
||||||
if test -e tests/test_shells/${1}.ok ; then
|
if test -e tests/test_shells/${1}.ok ; then
|
||||||
@ -23,12 +14,15 @@ check_screen_log() {
|
|||||||
|
|
||||||
run_test() {
|
run_test() {
|
||||||
SH="$1"
|
SH="$1"
|
||||||
SESNAME="powerline-shell-test-$$"
|
SESNAME="powerline-shell-test-${SH}-$$"
|
||||||
|
|
||||||
|
test "x$ONLY_SHELL" = "x" || test "x$ONLY_SHELL" = "x$SH" || return 0
|
||||||
|
|
||||||
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 0.3s
|
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 logfile tests/shell/screen.log
|
||||||
screen -S "$SESNAME" -p 0 -X paste a
|
screen -S "$SESNAME" -p 0 -X paste a
|
||||||
@ -37,16 +31,21 @@ run_test() {
|
|||||||
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 tests/shell/screen.log
|
./tests/test_shells/postproc.py tests/shell/screen.log
|
||||||
|
cp tests/shell/screen.log tests/shell/${SH}.log
|
||||||
if ! check_screen_log ${SH} ; then
|
if ! check_screen_log ${SH} ; then
|
||||||
# Repeat the diff to make it better viewable in travis output
|
# Repeat the diff to make it better viewable in travis output
|
||||||
check_screen_log ${SH} | cat -v
|
check_screen_log ${SH} | cat -v
|
||||||
echo "Failed ${SH}"
|
echo "Failed ${SH}"
|
||||||
|
rm tests/shell/screen.log
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
rm tests/shell/screen.log
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
@ -54,18 +53,15 @@ git --git-dir=tests/shell/3rd/.git checkout -b BRANCH
|
|||||||
if ! run_test bash --norc --noprofile -i ; then
|
if ! run_test bash --norc --noprofile -i ; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
rm tests/shell/screen.log
|
|
||||||
|
|
||||||
if ! run_test zsh -f -i ; then
|
if ! run_test zsh -f -i ; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
rm tests/shell/screen.log
|
|
||||||
|
|
||||||
export XDG_CONFIG_HOME=/dev/null
|
export XDG_CONFIG_HOME=/dev/null
|
||||||
if ! run_test fish -i ; then
|
if ! run_test fish -i ; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
rm tests/shell/screen.log
|
|
||||||
|
|
||||||
rm -r tests/shell
|
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
|
||||||
exit $FAILED
|
exit $FAILED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user