Merge pull request #18088 from bluca/test_force_nspawn

tests: add TEST_QEMU_ONLY variable to run only tests where qemu is mandatory, TEST_PREFER_NSPAWN to run under nspawn unless unsupported, fix some testsuite issues on Debian
master
Zbigniew Jędrzejewski-Szmek 2 years ago committed by GitHub
commit 0bae3f1059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      test/README.testsuite
  2. 2
      test/TEST-01-BASIC/test.sh
  3. 2
      test/run-integration-tests.sh
  4. 34
      test/test-functions

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

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

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

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

Loading…
Cancel
Save