diff --git a/test/README.testsuite b/test/README.testsuite index 5d9e498c51..5dd559e365 100644 --- a/test/README.testsuite +++ b/test/README.testsuite @@ -47,9 +47,15 @@ Configuration variables TEST_NO_QEMU=1 Don't run tests under QEMU +TEST_QEMU_ONLY=1 + Run only tests that require QEMU + TEST_NO_NSPAWN=1 Don't run tests under systemd-nspawn +TEST_PREFER_NSPAWN=1 + Run all tests that do not require qemu under systemd-nspawn + TEST_NO_KVM=1 Disable QEMU KVM auto-detection (may be necessary when you're trying to run the *vanilla* QEMU and have both qemu and qemu-kvm installed) diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 58f6cd1414..58ad6f8fd2 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -14,12 +14,12 @@ test_create_image() { ( LOG_LEVEL=5 setup_basic_environment + mask_supporting_services # install tests manually so the test is functional even when -Dinstall-tests=false mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/ cp -v $(dirname $0)/../units/{testsuite-01,end}.service $initdir/usr/lib/systemd/tests/testdata/units/ ) - setup_nspawn_root } do_test "$@" 01 diff --git a/test/run-integration-tests.sh b/test/run-integration-tests.sh index 3c01adfca3..e9307601ff 100755 --- a/test/run-integration-tests.sh +++ b/test/run-integration-tests.sh @@ -10,8 +10,6 @@ fi args_no_clean=$(sed -r 's/\bclean.*\b//g' <<<$args) do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? ) -ninja -C "$BUILD_DIR" - declare -A results declare -A times diff --git a/test/test-functions b/test/test-functions index 482cb7b490..06dea3c7be 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1058,8 +1058,14 @@ EOF } install_user_dbus() { - inst $ROOTLIBDIR/user/dbus.socket - inst_symlink /usr/lib/systemd/user/sockets.target.wants/dbus.socket || inst_symlink /etc/systemd/user/sockets.target.wants/dbus.socket + local userunitdir + if ! userunitdir=$(pkg-config --variable=systemduserunitdir systemd); then + echo "WARNING! Cannot determine userunitdir from pkg-config, assuming /usr/lib/systemd/user" >&2 + local userunitdir=/usr/lib/systemd/user + fi + + inst $userunitdir/dbus.socket + inst_symlink $userunitdir/sockets.target.wants/dbus.socket || inst_symlink /etc/systemd/user/sockets.target.wants/dbus.socket # Append the After= dependency on dbus in case it isn't already set up mkdir -p "$initdir/etc/systemd/system/user@.service.d/" @@ -1069,16 +1075,16 @@ After=dbus.service EOF # Newer Fedora versions use dbus-broker by default. Let's install it if it's available. - if [ -f $ROOTLIBDIR/user/dbus-broker.service ]; then - inst $ROOTLIBDIR/user/dbus-broker.service + if [ -f $userunitdir/dbus-broker.service ]; then + inst $userunitdir/dbus-broker.service inst_symlink /etc/systemd/user/dbus.service elif [ -f $ROOTLIBDIR/system/dbus-daemon.service ]; then # Fedora rawhide replaced dbus.service with dbus-daemon.service - inst $ROOTLIBDIR/user/dbus-daemon.service + inst $userunitdir/dbus-daemon.service # Alias symlink inst_symlink /etc/systemd/user/dbus.service else - inst $ROOTLIBDIR/user/dbus.service + inst $userunitdir/dbus.service fi } @@ -1569,7 +1575,7 @@ inst_binary() { # In such cases, let's check if the binary indeed exists in the image # before doing any other chcecks. If it does, immediately return with # success. - [[ $# -eq 1 && -e $initdir/$1 ]] && return 0 + [[ $# -eq 1 && -e $initdir/$1 || -e $initdir/bin/$1 || -e $initdir/sbin/$1 || -e $initdir/usr/bin/$1 || -e $initdir/usr/sbin/$1 ]] && return 0 _bin=$(find_binary "$1") || return 1 _target=${2:-$_bin} @@ -2101,6 +2107,20 @@ do_test() { exit 0 fi + if [ -n "$TEST_NO_QEMU" ] && [ -n "$TEST_NO_NSPAWN" ]; then + echo "TEST: $TEST_DESCRIPTION [SKIPPED]: both QEMU and nspawn disabled" >&2 + exit 0 + fi + + if [ -n "$TEST_QEMU_ONLY" ] && [ -z "$TEST_NO_NSPAWN" ]; then + echo "TEST: $TEST_DESCRIPTION [SKIPPED]: QEMU-only tests requested" >&2 + exit 0 + fi + + if [ -n "$TEST_PREFER_NSPAWN" ] && [ -z "$TEST_NO_NSPAWN" ]; then + TEST_NO_QEMU=1 + fi + # Detect lib paths [[ $libdir ]] || for libdir in /lib64 /lib; do [[ -d $libdir ]] && libdirs+=" $libdir" && break