Move some code away of test_tmux.sh

This commit is contained in:
Foo 2017-04-30 13:40:29 +03:00
parent 65130ae6ff
commit a05857e64e
3 changed files with 33 additions and 14 deletions

View File

@ -3,9 +3,11 @@ set +x
: ${PYTHON:=python} : ${PYTHON:=python}
FAILED=0 if test -z "$FAILED" ; then
FAILED=0
FAIL_SUMMARY="" FAIL_SUMMARY=""
fi
enter_suite() { enter_suite() {
local suite_name="$1" local suite_name="$1"

View File

@ -1,23 +1,18 @@
#!/bin/sh #!/bin/sh
. tests/common.sh . tests/common.sh
. tests/vterm.sh
enter_suite tmux enter_suite tmux
VTERM_TEST_DIR="$ROOT/tests/vterm_tmux" VTERM_TEST_DIR="$ROOT/tests/vterm_tmux"
rm -rf "$VTERM_TEST_DIR" vterm_setup "$VTERM_TEST_DIR"
mkdir "$VTERM_TEST_DIR"
mkdir "$VTERM_TEST_DIR/path"
ln -s "$(which "${PYTHON}")" "$VTERM_TEST_DIR/path/python"
ln -s "$(which bash)" "$VTERM_TEST_DIR/path"
ln -s "$(which env)" "$VTERM_TEST_DIR/path" ln -s "$(which env)" "$VTERM_TEST_DIR/path"
ln -s "$(which cut)" "$VTERM_TEST_DIR/path" ln -s "$(which cut)" "$VTERM_TEST_DIR/path"
ln -s "$ROOT/scripts/powerline-render" "$VTERM_TEST_DIR/path" ln -s "$ROOT/scripts/powerline-render" "$VTERM_TEST_DIR/path"
ln -s "$ROOT/scripts/powerline-config" "$VTERM_TEST_DIR/path" ln -s "$ROOT/scripts/powerline-config" "$VTERM_TEST_DIR/path"
cp -r "$ROOT/tests/terminfo" "$VTERM_TEST_DIR"
test_tmux() { test_tmux() {
if test "$PYTHON_IMPLEMENTATION" = PyPy; then if test "$PYTHON_IMPLEMENTATION" = PyPy; then
# FIXME PyPy3 segfaults for some reason, PyPy does it as well, but # FIXME PyPy3 segfaults for some reason, PyPy does it as well, but
@ -46,10 +41,6 @@ else
test_tmux || true test_tmux || true
fi fi
if test $FAILED -eq 0 ; then vterm_shutdown "$VTERM_TEST_DIR"
rm -rf "$VTERM_TEST_DIR"
else
echo "$FAIL_SUMMARY"
fi
exit_suite exit_suite

26
tests/vterm.sh Normal file
View File

@ -0,0 +1,26 @@
. tests/common.sh
. tests/bot-ci/scripts/common/main.sh
set +x
vterm_setup() {
local test_dir="$1" ; shift
rm -rf "$test_dir"
mkdir "$test_dir"
mkdir "$test_dir/path"
ln -s "$(which "${PYTHON}")" "$test_dir/path/python"
ln -s "$(which bash)" "$test_dir/path"
cp -r "$ROOT/tests/terminfo" "$test_dir"
}
vterm_shutdown() {
local test_dir="$1" ; shift
if test $FAILED -eq 0 ; then
rm -rf "$test_dir"
else
echo "$FAIL_SUMMARY"
fi
}