Compare commits

...

10 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 0bae3f1059
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
2021-01-04 20:53:38 +01:00
milovlad 150a29122b Update 60-sensor.hwdb
hwdb: Add accelerometer orientation quirk for the MYRIA MY8312
2021-01-04 17:34:05 +01:00
Lennart Poettering c024f320ff man: use 'weak' and 'strong' for explaining difference between Wants= + Requires=
A minor tweak, that hopefully makes things a bit clearer, given that we
previously used "requirement dependency" when referring to Wants=, which
might be confusing given that we have Requires=
2021-01-04 16:48:51 +01:00
Luca Boccassi eb3785f367 tests: add TEST_PREFER_NSPAWN variable to run as many as possible under nspawn
By default the test suite prefers qemu, and uses nspawn only if
a test specifically says it doesn't support qemu.
Add a variable to allow flipping the default, and run as many
tests under nspawn as possible.
2021-01-01 21:33:16 +00:00
Luca Boccassi 51d56d3be0 tests: add TEST_QEMU_ONLY variable to run only tests where qemu is mandatory
Allows to split the test run in two parts. Most tests can run under
nspawn which is much faster, and they can be ran in one chunk with
TEST_NO_QEMU=1. The qemu-only tests, which are just a handful, can
be ran in another chunk with TEST_QEMU_ONLY=1.

Allows autopkgtest to be split in two parts.
2021-01-01 21:33:16 +00:00
Luca Boccassi 84d9358586 Do not run ninja in run-integration-tests.sh
It is typically ran as root, while builds are done as normal users.
It is documented anyway to build beforehand.
2021-01-01 21:33:16 +00:00
Luca Boccassi aeac20fc69 test: shortcut skip if both TEST_NO_QEMU and TEST_NO_NSPAWN are set
Allows to run all tests in bulk with TEST_NO_QEMU, skipping those where it is
mandatory, without wasting time building the image.
2021-01-01 21:33:16 +00:00
Luca Boccassi 0515e4c17d test: check for binariers in [usr/][s]bin
The image build function greps for ExecStart lines in unit files, but some
of them (eg: systemd-firstboot) do not use a full path.
It then falls back to 'type -P' but that only works if you have the binary
installed. For optional binaries like systemd-firstboot, the installation
can then fail.

Manually check if the binary already exists in /[usr/][s]bin.
2021-01-01 21:33:16 +00:00
Luca Boccassi 53a1c94480 test: use pkg-config to get user unit dir when installing dbus user socket
Usually on Debian ROOTLIBDIR is /lib/<arch triplet>, which is not the right place.
Use pkg-config since we define it, and then fallback to /usr/lib/systemd/user which is
the canonical location.
On both Debian&friends and Fedora dbus/dbus-broker install the user socket/service
under /usr/lib/systemd/user, not /lib/systemd/systemd/user.
2021-01-01 21:33:16 +00:00
Luca Boccassi bb64bec589 test: update test_create_image
Run mask_supporting_services, which was missing, and remove setup_nspawn_root which
is now already called outside test_create_image
2021-01-01 21:33:16 +00:00
6 changed files with 44 additions and 16 deletions

View File

@ -580,6 +580,10 @@ sensor:modalias:acpi:SMO8500*:dmi:*:svnMicro-StarInternationalCo.,Ltd.:pnS100:*
sensor:modalias:acpi:BOSC0200*:dmi:*:svnCompletElectroServ:pnMY8307:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1
# MY8312
sensor:modalias:acpi:KIOX010A*:dmi:*:svnCompletElectroServSA:pnMY8312:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1
#########################################
# Nuvision (TMax)
#########################################

View File

@ -596,11 +596,11 @@
<varlistentry>
<term><varname>Wants=</varname></term>
<listitem><para>Configures requirement dependencies on other units. This option may be specified more
than once or multiple space-separated units may be specified in one option in which case dependencies
for all listed names will be created. Dependencies of this type may also be configured outside of the
unit configuration file by adding a symlink to a <filename>.wants/</filename> directory accompanying
the unit file. For details, see above.</para>
<listitem><para>Configures (weak) requirement dependencies on other units. This option may be
specified more than once or multiple space-separated units may be specified in one option in which
case dependencies for all listed names will be created. Dependencies of this type may also be
configured outside of the unit configuration file by adding a symlink to a
<filename>.wants/</filename> directory accompanying the unit file. For details, see above.</para>
<para>Units listed in this option will be started if the configuring unit is. However, if the listed
units fail to start or cannot be added to the transaction, this has no impact on the validity of the
@ -619,7 +619,7 @@
<varlistentry>
<term><varname>Requires=</varname></term>
<listitem><para>Similar to <varname>Wants=</varname>, but declares a stronger
<listitem><para>Similar to <varname>Wants=</varname>, but declares a stronger requirement
dependency. Dependencies of this type may also be configured by adding a symlink to a
<filename>.requires/</filename> directory accompanying the unit file.</para>

View File

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

View File

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

View File

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

View File

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