ctdb-tests: Add new variable CTDB_TEST_TMP_DIR
authorMartin Schwenke <martin@meltin.net>
Thu, 5 Sep 2019 03:42:26 +0000 (13:42 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 24 Sep 2019 02:27:29 +0000 (02:27 +0000)
This is a subdirectory of TEST_VAR_DIR that is unique to the current
test suite.  It is recreated for each individual test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/run_tests.sh

index 5cca297fd64b21d1d73e2ae4d1932995e004ac66..367f9388c41bd709306b78d53f6905eb753706fd 100755 (executable)
@@ -188,6 +188,20 @@ run_one_test ()
            CTDB_TEST_SUITE_DIR=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
     fi
 
+    # Set CTDB_TEST_TMP_DIR
+    #
+    # Determine the relative test suite subdirectory.  The top-level
+    # test directory needs to be a prefix of the test suite directory,
+    # so make absolute versions of both.
+    local test_dir test_suite_dir reldir
+    test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
+    test_suite_dir=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
+    reldir="${test_suite_dir#${test_dir}/}"
+
+    export CTDB_TEST_TMP_DIR="${TEST_VAR_DIR}/${reldir}"
+    rm -rf "$CTDB_TEST_TMP_DIR"
+    mkdir -p "$CTDB_TEST_TMP_DIR"
+
     tests_total=$((tests_total + 1))
 
     ctdb_test_run "$f" | show_progress