diff options
Diffstat (limited to 'test')
56 files changed, 198 insertions, 310 deletions
diff --git a/test/README.testsuite b/test/README.testsuite index 2753ed6e3a..9e0c36512c 100644 --- a/test/README.testsuite +++ b/test/README.testsuite @@ -97,3 +97,26 @@ kernel command line parameter with $KERNEL_APPEND and then log in as root. $ sudo make -C test/TEST-01-BASIC KERNEL_APPEND="systemd.unit=multi-user.target" run Root password is empty. + +Ubuntu CI +========= + +New PR submitted to the project are run through regression tests, and one set +of those is the 'autopkgtest' runs for several different architectures, called +'Ubuntu CI'. Part of that testing is to run all these tests. Sometimes these +tests are temporarily blacklisted from running in the 'autopkgtest' tests while +debugging a flaky test; that is done by creating a file in the test directory +named 'blacklist-ubuntu-ci', for example to prevent the TEST-01-BASIC test from +running in the 'autopkgtest' runs, create the file +'TEST-01-BASIC/blacklist-ubuntu-ci'. + +The tests may be disabled only for specific archs, by creating a blacklist file +with the arch name at the end, e.g. +'TEST-01-BASIC/blacklist-ubuntu-ci-arm64' to disable the TEST-01-BASIC test +only on test runs for the 'arm64' architecture. + +Note the arch naming is not from 'uname -m', it is Debian arch names: +https://wiki.debian.org/ArchitectureSpecificsMemo + +For PRs that fix a currently blacklisted test, the PR should include removal +of the blacklist file. diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh index 801dc71569..a7563f4462 100755 --- a/test/TEST-02-CRYPTSETUP/test.sh +++ b/test/TEST-02-CRYPTSETUP/test.sh @@ -40,14 +40,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh index b815e7cb67..50b7bce3ed 100755 --- a/test/TEST-03-JOBS/test.sh +++ b/test/TEST-03-JOBS/test.sh @@ -14,14 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -32,8 +25,6 @@ After=multi-user.target [Service] ExecStart=/test-jobs.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF # copy the units used by this test diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh index cabc71f4ff..a18d21533e 100755 --- a/test/TEST-04-JOURNAL/test.sh +++ b/test/TEST-04-JOURNAL/test.sh @@ -13,14 +13,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh index 159c1e0ea8..87fb89e781 100755 --- a/test/TEST-05-RLIMITS/test.sh +++ b/test/TEST-05-RLIMITS/test.sh @@ -13,14 +13,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services cat >$initdir/etc/systemd/system.conf <<EOF [Manager] diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh index 2e983f7879..646dfe024a 100755 --- a/test/TEST-06-SELINUX/test.sh +++ b/test/TEST-06-SELINUX/test.sh @@ -24,6 +24,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services # setup the testsuite service cat <<EOF >$initdir/etc/systemd/system/testsuite.service @@ -91,13 +92,6 @@ EOF dracut_install runcon dracut_install checkmodule semodule semodule_package m4 make /usr/libexec/selinux/hll/pp load_policy sefcontext_compile ) - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service } do_test "$@" diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh index 2e4f67c5fe..199b4f85a8 100755 --- a/test/TEST-07-ISSUE-1981/test.sh +++ b/test/TEST-07-ISSUE-1981/test.sh @@ -16,14 +16,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh index 8643842e81..a9e6ffa79d 100755 --- a/test/TEST-08-ISSUE-2730/test.sh +++ b/test/TEST-08-ISSUE-2730/test.sh @@ -64,12 +64,7 @@ EOF mkdir -p $initdir/etc/systemd/system/local-fs.target.wants ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/local-fs.target.wants/-.mount - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + mask_supporting_services } do_test "$@" diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh index 1a8b900672..ca3e69d2ca 100755 --- a/test/TEST-09-ISSUE-2691/test.sh +++ b/test/TEST-09-ISSUE-2691/test.sh @@ -15,6 +15,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<'EOF' @@ -31,13 +32,6 @@ EOF setup_testsuite ) - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service } do_test "$@" diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh index e0e78b1100..7bb2569630 100755 --- a/test/TEST-10-ISSUE-2467/test.sh +++ b/test/TEST-10-ISSUE-2467/test.sh @@ -13,6 +13,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install true rm socat # setup the testsuite service @@ -22,8 +23,6 @@ Description=Testsuite service [Service] Type=oneshot -StandardOutput=tty -StandardError=tty ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; printf x > test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok' EOF @@ -44,13 +43,6 @@ EOF setup_testsuite ) setup_nspawn_root - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service } do_test "$@" diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh index c50efb8c9b..81c12a2783 100755 --- a/test/TEST-11-ISSUE-3166/test.sh +++ b/test/TEST-11-ISSUE-3166/test.sh @@ -14,16 +14,9 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install false touch - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF [Unit] diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh index 5b1c3aa313..d9a0e1a3dd 100755 --- a/test/TEST-12-ISSUE-3171/test.sh +++ b/test/TEST-12-ISSUE-3171/test.sh @@ -14,16 +14,9 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install cat mv stat nc - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF [Unit] diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh index f89bdca99f..747d30d952 100755 --- a/test/TEST-13-NSPAWN-SMOKE/test.sh +++ b/test/TEST-13-NSPAWN-SMOKE/test.sh @@ -14,16 +14,9 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install busybox chmod rmdir unshare ip sysctl - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - cp create-busybox-container $initdir/ ./create-busybox-container $initdir/nc-container @@ -37,8 +30,6 @@ Description=Testsuite service [Service] ExecStart=/test-nspawn.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cat >$initdir/test-nspawn.sh <<'EOF' diff --git a/test/TEST-14-MACHINE-ID/test.sh b/test/TEST-14-MACHINE-ID/test.sh index e52377c79d..72d7eacbf6 100755 --- a/test/TEST-14-MACHINE-ID/test.sh +++ b/test/TEST-14-MACHINE-ID/test.sh @@ -14,6 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services printf "556f48e837bc4424a710fa2e2c9d3e3c\ne3d\n" >$initdir/etc/machine-id dracut_install mount cmp @@ -72,13 +73,6 @@ chmod +x $initdir/test-machine-id-setup.sh setup_testsuite ) - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service } do_test "$@" diff --git a/test/TEST-15-DROPIN/test.sh b/test/TEST-15-DROPIN/test.sh index 9d5ea138b9..a1d0c618d9 100755 --- a/test/TEST-15-DROPIN/test.sh +++ b/test/TEST-15-DROPIN/test.sh @@ -8,13 +8,7 @@ TEST_NO_QEMU=1 test_setup() { # create the basic filesystem layout setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + mask_supporting_services # import the test scripts in the rootfs and plug them in systemd cp testsuite.service $initdir/etc/systemd/system/ diff --git a/test/TEST-16-EXTEND-TIMEOUT/test.sh b/test/TEST-16-EXTEND-TIMEOUT/test.sh index 368c9e63ca..c5f8af6ec6 100755 --- a/test/TEST-16-EXTEND-TIMEOUT/test.sh +++ b/test/TEST-16-EXTEND-TIMEOUT/test.sh @@ -14,6 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services for s in success-all success-start success-stop success-runtime \ fail-start fail-stop fail-runtime @@ -27,12 +28,6 @@ test_setup() { setup_testsuite ) - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service setup_nspawn_root } diff --git a/test/TEST-17-UDEV-WANTS/test.sh b/test/TEST-17-UDEV-WANTS/test.sh index 8727432e30..1cdbbd2d8a 100755 --- a/test/TEST-17-UDEV-WANTS/test.sh +++ b/test/TEST-17-UDEV-WANTS/test.sh @@ -14,13 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -30,8 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh index 503c5ca551..e9f6ee7afe 100755 --- a/test/TEST-18-FAILUREACTION/test.sh +++ b/test/TEST-18-FAILUREACTION/test.sh @@ -13,6 +13,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -22,21 +23,13 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ setup_testsuite ) - setup_nspawn_root - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + setup_nspawn_root } do_test "$@" diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh index 348c697f63..706f0e9fbb 100755 --- a/test/TEST-19-DELEGATE/test.sh +++ b/test/TEST-19-DELEGATE/test.sh @@ -15,14 +15,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -32,8 +25,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh index 457ef6ae74..0ba30bdb00 100755 --- a/test/TEST-20-MAINPIDGAMES/test.sh +++ b/test/TEST-20-MAINPIDGAMES/test.sh @@ -12,14 +12,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -29,14 +22,13 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty NotifyAccess=all EOF cp testsuite.sh $initdir/ setup_testsuite ) + setup_nspawn_root } diff --git a/test/TEST-22-TMPFILES/test.sh b/test/TEST-22-TMPFILES/test.sh index 5c509f63fb..32c3abdeab 100755 --- a/test/TEST-22-TMPFILES/test.sh +++ b/test/TEST-22-TMPFILES/test.sh @@ -8,6 +8,7 @@ TEST_NO_QEMU=1 test_setup() { # create the basic filesystem layout setup_basic_environment + mask_supporting_services inst_binary mv inst_binary stat inst_binary seq @@ -15,14 +16,6 @@ test_setup() { inst_binary mkfifo inst_binary readlink - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - # setup the testsuite service cp testsuite.service $initdir/etc/systemd/system/ setup_testsuite diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh index 9163f88c82..127d39319a 100755 --- a/test/TEST-23-TYPE-EXEC/test.sh +++ b/test/TEST-23-TYPE-EXEC/test.sh @@ -12,14 +12,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -29,9 +22,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-24-UNIT-TESTS/blacklist-ubuntu-ci-ppc64el b/test/TEST-24-UNIT-TESTS/blacklist-ubuntu-ci-ppc64el new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-24-UNIT-TESTS/blacklist-ubuntu-ci-ppc64el diff --git a/test/TEST-25-IMPORT/blacklist-ubuntu-ci b/test/TEST-25-IMPORT/blacklist-ubuntu-ci new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-25-IMPORT/blacklist-ubuntu-ci diff --git a/test/TEST-25-IMPORT/test.sh b/test/TEST-25-IMPORT/test.sh index 026c38a264..c0f51f3b89 100755 --- a/test/TEST-25-IMPORT/test.sh +++ b/test/TEST-25-IMPORT/test.sh @@ -22,9 +22,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-26-SETENV/test.sh b/test/TEST-26-SETENV/test.sh index fc216ee5bf..065a8e461c 100755 --- a/test/TEST-26-SETENV/test.sh +++ b/test/TEST-26-SETENV/test.sh @@ -21,9 +21,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh index d481f1b8bf..c8338736bb 100755 --- a/test/TEST-27-STDOUTFILE/test.sh +++ b/test/TEST-27-STDOUTFILE/test.sh @@ -11,17 +11,9 @@ test_setup() { LOG_LEVEL=5 eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) - inst_binary cmp - setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services + inst_binary cmp # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -31,9 +23,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh index 1fb9825bf8..3427ba7a91 100755 --- a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh +++ b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh @@ -14,6 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services # Set up the services. cat >$initdir/etc/systemd/system/specifier-j-wants.service << EOF @@ -48,14 +49,8 @@ EOF setup_testsuite ) - setup_nspawn_root - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + setup_nspawn_root } do_test "$@" diff --git a/test/TEST-29-UDEV-ID_RENAMING/test.sh b/test/TEST-29-UDEV-ID_RENAMING/test.sh index 67641746d8..7d173c8422 100755 --- a/test/TEST-29-UDEV-ID_RENAMING/test.sh +++ b/test/TEST-29-UDEV-ID_RENAMING/test.sh @@ -14,13 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -30,8 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-30-ONCLOCKCHANGE/blacklist-ubuntu-ci-i386 b/test/TEST-30-ONCLOCKCHANGE/blacklist-ubuntu-ci-i386 new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-30-ONCLOCKCHANGE/blacklist-ubuntu-ci-i386 diff --git a/test/TEST-30-ONCLOCKCHANGE/test.sh b/test/TEST-30-ONCLOCKCHANGE/test.sh index 98a9db8007..8976e95308 100755 --- a/test/TEST-30-ONCLOCKCHANGE/test.sh +++ b/test/TEST-30-ONCLOCKCHANGE/test.sh @@ -16,14 +16,7 @@ test_setup() { inst_any /usr/share/zoneinfo/Europe/Berlin setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # extend the watchdog mkdir -p $initdir/etc/systemd/system/systemd-timedated.service.d @@ -40,9 +33,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh index 064daf9235..e88e0c367a 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/test.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh @@ -14,13 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -30,8 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh b/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh index aa94d59bd3..047c1be06f 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/testsuite.sh @@ -1,8 +1,8 @@ #!/bin/bash -set -ex +set -e set -o pipefail -if journalctl -b | grep -e '\.device: Changed plugged -> dead'; then +if journalctl -b -t systemd --grep '\.device: Changed plugged -> dead'; then exit 1 fi diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh index 17610af21d..1726b21fc3 100755 --- a/test/TEST-32-OOMPOLICY/test.sh +++ b/test/TEST-32-OOMPOLICY/test.sh @@ -15,14 +15,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -32,8 +25,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty MemoryAccounting=yes EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-33-CLEAN-UNIT/test.sh b/test/TEST-33-CLEAN-UNIT/test.sh index aeda69baae..b3316bdc26 100755 --- a/test/TEST-33-CLEAN-UNIT/test.sh +++ b/test/TEST-33-CLEAN-UNIT/test.sh @@ -14,14 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -31,8 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh index 7339d3b656..c7c1b29d86 100755 --- a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh +++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh @@ -12,14 +12,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -29,9 +22,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-36-NUMAPOLICY/blacklist-ubuntu-ci-s390x b/test/TEST-36-NUMAPOLICY/blacklist-ubuntu-ci-s390x new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-36-NUMAPOLICY/blacklist-ubuntu-ci-s390x diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh index a586f9dc90..e4c0e45ebe 100755 --- a/test/TEST-36-NUMAPOLICY/test.sh +++ b/test/TEST-36-NUMAPOLICY/test.sh @@ -15,16 +15,9 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install mktemp - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF [Unit] @@ -33,9 +26,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh index 9e87e61dcd..ffe0ee9499 100755 --- a/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh +++ b/test/TEST-37-RUNTIMEDIRECTORYPRESERVE/test.sh @@ -14,14 +14,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -31,8 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-39-EXECRELOAD/test.sh b/test/TEST-39-EXECRELOAD/test.sh index 7eb9db415a..d2b1663aa3 100755 --- a/test/TEST-39-EXECRELOAD/test.sh +++ b/test/TEST-39-EXECRELOAD/test.sh @@ -13,16 +13,9 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment + mask_supporting_services dracut_install mktemp - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service - # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF [Unit] @@ -31,9 +24,6 @@ Description=Testsuite service [Service] ExecStart=/bin/bash -x /testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-40-EXEC-COMMAND-EX/blacklist-ubuntu-ci-arm64 b/test/TEST-40-EXEC-COMMAND-EX/blacklist-ubuntu-ci-arm64 new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/TEST-40-EXEC-COMMAND-EX/blacklist-ubuntu-ci-arm64 diff --git a/test/TEST-40-EXEC-COMMAND-EX/test.sh b/test/TEST-40-EXEC-COMMAND-EX/test.sh index 723c9ccd4b..01d725eb5e 100755 --- a/test/TEST-40-EXEC-COMMAND-EX/test.sh +++ b/test/TEST-40-EXEC-COMMAND-EX/test.sh @@ -12,14 +12,7 @@ test_setup() { eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) setup_basic_environment - - # mask some services that we do not want to run in these tests - ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket - ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service - ln -fs /dev/null $initdir/etc/systemd/system/systemd-machined.service + mask_supporting_services # setup the testsuite service cat >$initdir/etc/systemd/system/testsuite.service <<EOF @@ -29,9 +22,6 @@ Description=Testsuite service [Service] ExecStart=/testsuite.sh Type=oneshot -StandardOutput=tty -StandardError=tty -NotifyAccess=all EOF cp testsuite.sh $initdir/ diff --git a/test/TEST-41-ONESHOT-RESTART/Makefile b/test/TEST-41-ONESHOT-RESTART/Makefile new file mode 100644 index 0000000000..45e9bfc67c --- /dev/null +++ b/test/TEST-41-ONESHOT-RESTART/Makefile @@ -0,0 +1,9 @@ +BUILD_DIR=$(shell ../../tools/find-build-dir.sh) + +all setup run: + @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@ + +clean clean-again: + @basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --clean + +.PHONY: all setup run clean clean-again diff --git a/test/TEST-41-ONESHOT-RESTART/test.sh b/test/TEST-41-ONESHOT-RESTART/test.sh new file mode 100755 index 0000000000..96c21da642 --- /dev/null +++ b/test/TEST-41-ONESHOT-RESTART/test.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +TEST_DESCRIPTION="Test oneshot unit restart on failure" +. $TEST_BASE_DIR/test-functions + +test_setup() { + create_empty_image_rootdir + + ( + LOG_LEVEL=5 + eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) + + setup_basic_environment + mask_supporting_services + + # setup the testsuite service + cat >$initdir/etc/systemd/system/testsuite.service <<EOF +[Unit] +Description=Testsuite service + +[Service] +ExecStart=/testsuite.sh +Type=oneshot +EOF + cp testsuite.sh $initdir/ + + setup_testsuite + ) + setup_nspawn_root +} + +do_test "$@" diff --git a/test/TEST-41-ONESHOT-RESTART/testsuite.sh b/test/TEST-41-ONESHOT-RESTART/testsuite.sh new file mode 100755 index 0000000000..f7423dbf9a --- /dev/null +++ b/test/TEST-41-ONESHOT-RESTART/testsuite.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -ex +set -o pipefail + +systemd-analyze log-level debug +systemd-analyze log-target console + +# These three commands should succeed. +! systemd-run --unit=one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1" + +sleep 5 + +if [[ "$(systemctl show one.service -p NRestarts --value)" -le 0 ]]; then + exit 1 +fi + +TMP_FILE="/test-41-oneshot-restart-test" + +touch $TMP_FILE + +! systemd-run --unit=two -p StartLimitBurst=3 -p Type=oneshot -p Restart=on-failure -p ExecStart="/bin/bash -c \"printf a >> $TMP_FILE\"" /bin/bash -c "exit 1" + +sleep 5 + +if [[ $(cat $TMP_FILE) != "aaa" ]]; then + exit 1 +fi + +systemd-analyze log-level info + +echo OK > /testok + +exit 0 diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index 24d94033fc..ae8af3aba2 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -94,6 +94,7 @@ RequestOptions= SendRelease= MaxAttempts= IPServiceType= +SendOptions= [DHCPv6] UseNTP= UseDNS= @@ -255,3 +256,6 @@ MaxLeaseTimeSec= DefaultLeaseTimeSec= EmitTimezone= DNS= +[NextHop] +Id= +Gateway= diff --git a/test/hwdb-test.sh b/test/hwdb-test.sh index 05363e9ad6..d12f82fa2d 100755 --- a/test/hwdb-test.sh +++ b/test/hwdb-test.sh @@ -21,7 +21,7 @@ fi D=$(mktemp --directory) trap "rm -rf '$D'" EXIT INT QUIT PIPE mkdir -p "$D/etc/udev" -ln -s "$ROOTDIR/hwdb" "$D/etc/udev/hwdb.d" +ln -s "$ROOTDIR/hwdb.d" "$D/etc/udev/hwdb.d" # Test "good" properties" — no warnings or errors allowed err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$? @@ -42,7 +42,7 @@ fi # Test "bad" properties" — warnings required, errors not allowed rm -f "$D/etc/udev/hwdb.bin" "$D/etc/udev/hwdb.d" -ln -s "$ROOTDIR/test/hwdb" "$D/etc/udev/hwdb.d" +ln -s "$ROOTDIR/test/hwdb.d" "$D/etc/udev/hwdb.d" err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$? if [ -n "$rc" ]; then echo "$SYSTEMD_HWDB returned $rc" diff --git a/test/hwdb/10-bad.hwdb b/test/hwdb.d/10-bad.hwdb index 0e1e147323..0e1e147323 100644 --- a/test/hwdb/10-bad.hwdb +++ b/test/hwdb.d/10-bad.hwdb diff --git a/test/meson.build b/test/meson.build index 36d9df729c..24ab4d1dee 100644 --- a/test/meson.build +++ b/test/meson.build @@ -26,7 +26,7 @@ test_data_files = ''' h.service hello-after-sleep.target hello.service - hwdb/10-bad.hwdb + hwdb.d/10-bad.hwdb i.service journal-data/journal-1.txt journal-data/journal-2.txt diff --git a/test/test-execute/exec-personality-x86.service b/test/test-execute/exec-personality-x86.service index a623a08cbe..4ece7de718 100644 --- a/test/test-execute/exec-personality-x86.service +++ b/test/test-execute/exec-personality-x86.service @@ -2,6 +2,6 @@ Description=Test for Personality=x86 [Service] -ExecStart=/bin/sh -x -c 'c=$$(uname -m); test "$$c" = "i686"' +ExecStart=/bin/sh -x -c 'c=$$(uname -m); test "$$c" = "i686" -o "$$c" = "x86_64"' Type=oneshot Personality=x86 diff --git a/test/test-functions b/test/test-functions index 359fd4026e..3afc324110 100644 --- a/test/test-functions +++ b/test/test-functions @@ -913,6 +913,15 @@ setup_basic_dirs() { ln -sfn /run/lock "$initdir/var/lock" } +mask_supporting_services() { + # mask some services that we do not want to run in these tests + ln -fs /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service + ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket + ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service +} + inst_libs() { local _bin=$1 local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)' diff --git a/test/test-network/conf/25-nexthop.network b/test/test-network/conf/25-nexthop.network new file mode 100644 index 0000000000..3eea077345 --- /dev/null +++ b/test/test-network/conf/25-nexthop.network @@ -0,0 +1,11 @@ +[Match] +Name=veth99 + +[Network] +IPv6AcceptRA=no +Address=192.168.5.10/24 +Gateway=192.168.5.1 + +[NextHop] +Id=1 +Gateway=192.168.5.1 diff --git a/test/test-network/conf/25-veth-peer.network b/test/test-network/conf/25-veth-peer.network new file mode 100644 index 0000000000..f24956fe4e --- /dev/null +++ b/test/test-network/conf/25-veth-peer.network @@ -0,0 +1,7 @@ +[Match] +Name=veth-peer + +[Network] +IPv6AcceptRA=no +Address=2600::1/0 +Address=192.168.5.1/24 diff --git a/test/test-network/conf/dhcp-server-veth-peer.network b/test/test-network/conf/dhcp-server-veth-peer.network index 33d8be3964..f24956fe4e 100644 --- a/test/test-network/conf/dhcp-server-veth-peer.network +++ b/test/test-network/conf/dhcp-server-veth-peer.network @@ -2,5 +2,6 @@ Name=veth-peer [Network] +IPv6AcceptRA=no Address=2600::1/0 Address=192.168.5.1/24 diff --git a/test/test-network/conf/dhcp-v4-server-veth-peer.network b/test/test-network/conf/dhcp-v4-server-veth-peer.network index 3dfc5290ad..4d4a815a65 100644 --- a/test/test-network/conf/dhcp-v4-server-veth-peer.network +++ b/test/test-network/conf/dhcp-v4-server-veth-peer.network @@ -2,5 +2,6 @@ Name=veth-peer [Network] +IPv6AcceptRA=no Address=192.168.0.1/24 Address=192.168.5.1/24 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 87a76a502c..d100921709 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -113,6 +113,16 @@ def expectedFailureIfLinkFileFieldIsNotSet(): return f +def expectedFailureIfNexthopIsNotAvailable(): + def f(func): + rc = call('ip nexthop list') + if rc == 0: + return func + else: + return unittest.expectedFailure(func) + + return f + def setUpModule(): global running_units @@ -1402,7 +1412,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): 'dummy99', 'gretun97', 'ip6gretun97', - 'test1' + 'test1', + 'veth99', ] units = [ @@ -1426,6 +1437,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): '25-neighbor-ipv6.network', '25-neighbor-ip-dummy.network', '25-neighbor-ip.network', + '25-nexthop.network', '25-link-local-addressing-no.network', '25-link-local-addressing-yes.network', '25-link-section-unmanaged.network', @@ -1435,6 +1447,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): '25-gateway-next-static.network', '25-sysctl-disable-ipv6.network', '25-sysctl.network', + '25-veth-peer.network', + '25-veth.netdev', '26-link-local-addressing-ipv6.network', 'configure-without-carrier.network', 'routing-policy-rule-dummy98.network', @@ -1974,6 +1988,16 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): self.assertRegex(output, 'inet 10.1.2.3/16 scope global dummy98') self.assertNotRegex(output, 'inet 10.2.3.4/16 scope global dynamic dummy98') + @expectedFailureIfNexthopIsNotAvailable() + def test_nexthop(self): + copy_unit_to_networkd_unit_path('25-nexthop.network', '25-veth.netdev', '25-veth-peer.network') + start_networkd() + self.wait_online(['veth99:routable', 'veth-peer:routable']) + + output = check_output('ip nexthop list dev veth99') + print(output) + self.assertRegex(output, '192.168.5.1') + class NetworkdStateFileTests(unittest.TestCase, Utilities): links = [ 'dummy98', |