diff options
context:
space:
mode:
Diffstat (limited to 'tests/setup.sh')
-rwxr-xr-xtests/setup.sh25
1 file changed, 21 insertions, 4 deletions
diff --git a/tests/setup.sh b/tests/setup.sh
index 44751b4..757ae04 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -12,7 +12,11 @@
# that none holds a newline of its own.
LF='
'
-test_argv=
+# Trash directories are collected under one trash/ rather than left beside
+# the scripts, which keeps the ignore and clean rules to a single plain
+# name. The option is seeded ahead of the real arguments so one given on
+# the command line still wins.
+test_argv="${LF}--root=trash"
while test $# != 0
do
@@ -40,19 +44,32 @@ IFS=$OLDIFS
TEST_NO_CREATE_REPO=YesPlease
. "$TEST_DIRECTORY"/test-lib.sh
+# The library spells its results directory test-results and derives these
+# variables before it can be told otherwise, so they are re-pointed here and
+# every count lands under the plainer results/ instead. The rarely used
+# --tee and --stress options write their raw logs before this line and keep
+# the library's own name.
+TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/results"
+TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME$TEST_STRESS_JOB_SFX"
+TEST_RESULTS_SAN_DIR="$TEST_RESULTS_BASE.$TEST_RESULTS_SAN_DIR_SFX"
+
+# The library has moved into the trash directory by now, so everything the
+# tests reach outside it is anchored to TEST_OUTPUT_DIRECTORY, which still
+# names this directory whatever depth the trash sits at.
+
# The tests run cgit by name, so the binary just built has to come ahead of any
# copy already installed. Under Valgrind the wrappers take that place instead.
if test -n "$cgit_valgrind"
then
GIT_VALGRIND="$TEST_DIRECTORY/valgrind"
- CGIT_VALGRIND=$(cd ../valgrind && pwd)
+ CGIT_VALGRIND=$(cd "$TEST_OUTPUT_DIRECTORY/valgrind" && pwd)
PATH="$CGIT_VALGRIND/bin:$PATH"
export GIT_VALGRIND CGIT_VALGRIND
else
- PATH="$(pwd)/../../build:$PATH"
+ PATH="$TEST_OUTPUT_DIRECTORY/../build:$PATH"
fi
-FILTER_DIRECTORY=$(cd ../filters && pwd)
+FILTER_DIRECTORY=$(cd "$TEST_OUTPUT_DIRECTORY/filters" && pwd)
# Lua filters only work when cgit was compiled with Lua, so the tests that use
# them have to ask the binary rather than assume.