]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: find $BUILD_DIR in test-functions, remove from other scripts
authorDan Streetman <ddstreet@canonical.com>
Tue, 17 Nov 2020 20:39:37 +0000 (15:39 -0500)
committerDan Streetman <ddstreet@canonical.com>
Tue, 26 Jan 2021 22:09:48 +0000 (17:09 -0500)
The $BUILD_DIR is only used in test-functions, and doesn't need to
be specified in any other scripts. Additionally, to be able to allow
the integration test suite to be run against locally installed binaries,
instead of built binaries, moving BUILD_DIR logic completely into
test-functions allows later patches to be simpler.

test/README.testsuite
test/TEST-01-BASIC/Makefile
test/TEST-52-HONORFIRSTSHUTDOWN/Makefile
test/run-integration-tests.sh
test/test-functions

index 1b4736013dccd3e49e8aa98b2206061a17ab169f..a05a9936a69ffc6d5524ea612346b9da62cee3d2 100644 (file)
@@ -8,7 +8,7 @@ $ sudo test/run-integration-tests.sh
 ninja: Entering directory `/home/zbyszek/src/systemd/build'
 ninja: no work to do.
 --x-- Running TEST-01-BASIC --x--
-+ make -C TEST-01-BASIC BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
++ make -C TEST-01-BASIC clean setup run
 make: Entering directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
 TEST-01-BASIC CLEANUP: Basic systemd setup
 TEST-01-BASIC SETUP: Basic systemd setup
@@ -17,7 +17,7 @@ TEST-01-BASIC RUN: Basic systemd setup [OK]
 make: Leaving directory '/home/zbyszek/src/systemd/test/TEST-01-BASIC'
 --x-- Result of TEST-01-BASIC: 0 --x--
 --x-- Running TEST-02-CRYPTSETUP --x--
-+ make -C TEST-02-CRYPTSETUP BUILD_DIR=/home/zbyszek/src/systemd/build clean setup run
++ make -C TEST-02-CRYPTSETUP clean setup run
 
 If one of the tests fails, then $subdir/test.log contains the log file of
 the test.
index bee382b8b1c5c360ea2a0726685296d8ce7285c4..9b90a1c2bc39c18587c3b15b10d7036b0887d04a 100644 (file)
@@ -1,6 +1,4 @@
-BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
-
 all setup run clean clean-again:
-       @TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
+       @TEST_BASE_DIR=../ ./test.sh --$@
 
 .PHONY: all setup run clean clean-again
index 46a28ac810ed00a866b6bf1482376d14cb58a2bf..71487d707608f24b6fa8d7d6c0cd1fe6371ff543 100644 (file)
@@ -1,7 +1,5 @@
-BUILD_DIR=$(shell ../../tools/find-build-dir.sh)
-
 all setup run clean clean-again:
-       @TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
+       @TEST_BASE_DIR=../ ./test.sh --$@
 
 # finish option is used to run checks that can only be run outside of
 # the test execution. Example case, honor first shutdown, proof is obtained
@@ -11,6 +9,6 @@ all setup run clean clean-again:
 # the test will loop and will be terminated via a command timeout.
 # This just provides concrete confirmation.
 finish:
-       @TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./fini.sh --$@
+       @TEST_BASE_DIR=../ ./fini.sh --$@
 
 .PHONY: all setup run clean clean-again finish
index e9307601ff0c1679c2f8e7170638d711ce6a9e0b..219216ac566664afc50465a8fa0fb89a0f872e6d 100755 (executable)
@@ -22,7 +22,7 @@ cd "$(dirname "$0")"
 # cache.
 if [ $do_clean = 1 ]; then
     for TEST in TEST-??-* ; do
-        ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
+        ( set -x ; make -C "$TEST" clean )
     done
 
     [ -n "$args_no_clean" ] || exit 0
@@ -46,7 +46,7 @@ for TEST in TEST-??-* ; do
 
     echo -e "\n--x-- Running $TEST --x--"
     set +e
-    ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args_no_clean )
+    ( set -x ; make -C "$TEST" $args_no_clean )
     RESULT=$?
     set -e
     echo "--x-- Result of $TEST: $RESULT --x--"
@@ -59,7 +59,7 @@ done
 
 if [ $FAILURES -eq 0 -a $do_clean = 1 ]; then
     for TEST in ${!results[@]}; do
-        ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean-again )
+        ( set -x ; make -C "$TEST" clean-again )
     done
 fi
 
index 928d3fc0ad6c59dc146a1d9b544b988f951a491d..947ba223573cd0ab77868590e5fb3faf14acfeae 100644 (file)
@@ -49,6 +49,12 @@ TEST_UNITS_DIR="$TEST_BASE_DIR/units"
 SOURCE_DIR=$(realpath "$TEST_BASE_DIR/..")
 TOOLS_DIR="$SOURCE_DIR/tools"
 
+# note that find-build-dir.sh will return $BUILD_DIR if provided, else it will try to find it
+if ! BUILD_DIR=$($TOOLS_DIR/find-build-dir.sh); then
+    echo "ERROR: no build found, please set BUILD_DIR" >&2
+    exit 1
+fi
+
 PATH_TO_INIT=$ROOTLIBDIR/systemd
 [ "$SYSTEMD_JOURNALD" ] || SYSTEMD_JOURNALD=$(which -a $BUILD_DIR/systemd-journald $ROOTLIBDIR/systemd-journald 2>/dev/null | grep '^/' -m1)
 [ "$SYSTEMD_JOURNAL_REMOTE" ] || SYSTEMD_JOURNAL_REMOTE=$(which -a $BUILD_DIR/systemd-journal-remote $ROOTLIBDIR/systemd-journal-remote 2>/dev/null | grep '^/' -m1)