Refactor make_tmp_dir to make_test_root
This fixes problem with `exit_suite --continue` wiping out tmp directory.
This commit is contained in:
parent
1303cd1b04
commit
717ae5e428
|
@ -22,7 +22,9 @@ enter_suite() {
|
|||
}
|
||||
|
||||
exit_suite() {
|
||||
rm_tmp_dir
|
||||
if test "$POWERLINE_CURRENT_SUITE" = "$POWERLINE_TMP_DIR_SUITE" ; then
|
||||
rm_test_root
|
||||
fi
|
||||
if test $FAILED -ne 0 ; then
|
||||
echo "Suite ${POWERLINE_CURRENT_SUITE} failed, summary:"
|
||||
echo "${FAIL_SUMMARY}"
|
||||
|
@ -51,10 +53,11 @@ fail() {
|
|||
fi
|
||||
}
|
||||
|
||||
make_tmp_dir() {
|
||||
local suffix="$1" ; shift
|
||||
make_test_root() {
|
||||
local suffix="${POWERLINE_CURRENT_SUITE##*/}"
|
||||
|
||||
local tmpdir="$TMP_ROOT/$suffix/"
|
||||
export POWERLINE_TMP_DIR_SUITE="$POWERLINE_CURRENT_SUITE"
|
||||
|
||||
if test -d "$tmpdir" ; then
|
||||
rm -r "$tmpdir"
|
||||
|
@ -62,15 +65,17 @@ make_tmp_dir() {
|
|||
|
||||
mkdir -p "$tmpdir"
|
||||
|
||||
printf '%s' "$tmpdir"
|
||||
export TEST_ROOT="$tmpdir"
|
||||
}
|
||||
|
||||
rm_tmp_dir() {
|
||||
rm_test_root() {
|
||||
if test -e "$FAILURES_FILE" ; then
|
||||
return 0
|
||||
fi
|
||||
if test -d "$TMP_ROOT" ; then
|
||||
rm -r "$TMP_ROOT"
|
||||
local suffix="${POWERLINE_CURRENT_SUITE##*/}"
|
||||
if test -d "$TMP_ROOT/$suffix" ; then
|
||||
rm -r "$TMP_ROOT/$suffix"
|
||||
rmdir "$TMP_ROOT" &>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
enter_suite awesome
|
||||
|
||||
TEST_ROOT="$(make_tmp_dir awesome)"
|
||||
make_test_root
|
||||
|
||||
TEST_PATH="$TEST_ROOT/path"
|
||||
TEST_STATIC_ROOT="$ROOT/tests/test_awesome"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
enter_suite bar
|
||||
|
||||
TEST_ROOT="$(make_tmp_dir bar)"
|
||||
make_test_root
|
||||
TEST_PATH="$TEST_ROOT/path"
|
||||
TEST_STATIC_ROOT="$ROOT/tests/test_bar"
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
enter_suite vim
|
||||
|
||||
make_test_root
|
||||
|
||||
# Define some overrides. These ones must be ignored and do not affect Vim
|
||||
# status/tab lines.
|
||||
export POWERLINE_CONFIG_OVERRIDES='common.default_top_theme=ascii'
|
||||
|
@ -28,11 +30,9 @@ test_script() {
|
|||
fi
|
||||
}
|
||||
|
||||
TMPDIR="$(make_tmp_dir vim)"
|
||||
|
||||
TEST_SCRIPT_ROOT="$ROOT/tests/test_vim/tests"
|
||||
|
||||
cd "$TMPDIR"
|
||||
cd "$TEST_ROOT"
|
||||
|
||||
for script in "$TEST_SCRIPT_ROOT"/*.vim ; do
|
||||
if test "${script%.old.vim}" = "${script}" ; then
|
||||
|
|
Loading…
Reference in New Issue