1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

test: find $BUILD_DIR in test-functions, remove from other scripts

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.
This commit is contained in:
Dan Streetman 2020-11-17 15:39:37 -05:00
parent 42f3b48c97
commit 12d31e4ea5
5 changed files with 14 additions and 12 deletions

View 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.

View 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

View 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

View File

@ -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

View 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)