diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:08:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:08:41 +0000 |
commit | e31cc1efd724903b9cfeca5c070978113586ed28 (patch) | |
tree | 59e1fe0085540c2dd20a2ffa171f0bb8c732f7d4 /test | |
parent | Adding upstream version 256. (diff) | |
download | systemd-upstream/256.1.tar.xz systemd-upstream/256.1.zip |
Adding upstream version 256.1.upstream/256.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rwxr-xr-x | test/TEST-02-UNITTESTS/test.sh | 8 | ||||
-rw-r--r-- | test/TEST-06-SELINUX/meson.build | 3 | ||||
-rw-r--r-- | test/TEST-09-REBOOT/meson.build | 2 | ||||
-rw-r--r-- | test/TEST-18-FAILUREACTION/meson.build | 2 | ||||
-rwxr-xr-x | test/integration-test-wrapper.py | 9 | ||||
-rw-r--r-- | test/test-functions | 68 | ||||
-rwxr-xr-x | test/test-network/systemd-networkd-tests.py | 2 | ||||
-rwxr-xr-x | test/units/TEST-02-UNITTESTS.sh | 14 | ||||
-rwxr-xr-x | test/units/TEST-26-SYSTEMCTL.sh | 6 | ||||
-rwxr-xr-x | test/units/TEST-43-PRIVATEUSER-UNPRIV.sh | 4 |
10 files changed, 31 insertions, 87 deletions
diff --git a/test/TEST-02-UNITTESTS/test.sh b/test/TEST-02-UNITTESTS/test.sh index f165c99..2cf9c31 100755 --- a/test/TEST-02-UNITTESTS/test.sh +++ b/test/TEST-02-UNITTESTS/test.sh @@ -37,12 +37,4 @@ test_append_files() { fi } -check_result_nspawn() { - check_result_nspawn_unittests "${1}" -} - -check_result_qemu() { - check_result_qemu_unittests -} - do_test "$@" diff --git a/test/TEST-06-SELINUX/meson.build b/test/TEST-06-SELINUX/meson.build index 7a850be..9261a49 100644 --- a/test/TEST-06-SELINUX/meson.build +++ b/test/TEST-06-SELINUX/meson.build @@ -5,7 +5,8 @@ integration_tests += [ 'name' : fs.name(meson.current_source_dir()), 'cmdline' : integration_test_template['cmdline'] + ['selinux=1', 'lsm=selinux'], # FIXME; Figure out why reboot sometimes hangs with 'linux' firmware. - 'firmware' : 'uefi', + # Use 'auto' to automatically fallback on non-uefi architectures. + 'firmware' : 'auto', 'vm' : true, }, ] diff --git a/test/TEST-09-REBOOT/meson.build b/test/TEST-09-REBOOT/meson.build index c4b41bc..b755618 100644 --- a/test/TEST-09-REBOOT/meson.build +++ b/test/TEST-09-REBOOT/meson.build @@ -4,7 +4,5 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), 'storage' : 'persistent', - # FIXME; Figure out why reboot sometimes hangs with 'linux' firmware. - 'firmware' : 'uefi', }, ] diff --git a/test/TEST-18-FAILUREACTION/meson.build b/test/TEST-18-FAILUREACTION/meson.build index 5edfbca..8dec5f3 100644 --- a/test/TEST-18-FAILUREACTION/meson.build +++ b/test/TEST-18-FAILUREACTION/meson.build @@ -3,7 +3,5 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), - # FIXME; Figure out why reboot sometimes hangs with 'linux' firmware. - 'firmware' : 'uefi', }, ] diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 5b098a3..b6a16aa 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -2,10 +2,6 @@ # SPDX-License-Identifier: LGPL-2.1-or-later '''Test wrapper command for driving integration tests. - -Note: This is deliberately rough and only intended to drive existing tests -with the expectation that as part of formally defining the API it will be tidy. - ''' import argparse @@ -61,6 +57,10 @@ def main(): print(f"SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.name}", file=sys.stderr) exit(77) + if args.vm and bool(int(os.getenv("TEST_NO_QEMU", "0"))): + print(f"TEST_NO_QEMU=1, skipping {args.name}", file=sys.stderr) + exit(77) + name = args.name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "") dropin = textwrap.dedent( @@ -128,6 +128,7 @@ def main(): *args.mkosi_args, '--append', '--qemu-firmware', args.firmware, + '--qemu-kvm', "auto" if not bool(int(os.getenv("TEST_NO_KVM", "0"))) else "no", '--kernel-command-line-extra', ' '.join([ 'systemd.hostname=H', diff --git a/test/test-functions b/test/test-functions index be6eb1d..8b497b2 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1860,74 +1860,6 @@ check_result_qemu() { return $ret } -check_result_nspawn_unittests() { - local workspace="${1:?}" - local ret=1 - - [[ -e "$workspace/testok" ]] && ret=0 - - if [[ -s "$workspace/failed" ]]; then - ret=$((ret + 1)) - echo "=== Failed test log ===" - cat "$workspace/failed" - else - if [[ -s "$workspace/skipped" ]]; then - echo "=== Skipped test log ==" - cat "$workspace/skipped" - # We might have only skipped tests - that should not fail the job - ret=0 - fi - if [[ -s "$workspace/testok" ]]; then - echo "=== Passed tests ===" - cat "$workspace/testok" - fi - fi - - get_bool "${TIMED_OUT:=}" && ret=1 - check_coverage_reports "$workspace" || ret=5 - - save_journal "$workspace/var/log/journal" $ret - echo "${JOURNAL_LIST:-"No journals were saved"}" - - _umount_dir "${initdir:?}" - - return $ret -} - -check_result_qemu_unittests() { - local ret=1 - - mount_initdir - [[ -e "${initdir:?}/testok" ]] && ret=0 - - if [[ -s "$initdir/failed" ]]; then - ret=$((ret + 1)) - echo "=== Failed test log ===" - cat "$initdir/failed" - else - if [[ -s "$initdir/skipped" ]]; then - echo "=== Skipped test log ==" - cat "$initdir/skipped" - # We might have only skipped tests - that should not fail the job - ret=0 - fi - if [[ -s "$initdir/testok" ]]; then - echo "=== Passed tests ===" - cat "$initdir/testok" - fi - fi - - get_bool "${TIMED_OUT:=}" && ret=1 - check_coverage_reports "$initdir" || ret=5 - - save_journal "$initdir/var/log/journal" $ret - echo "${JOURNAL_LIST:-"No journals were saved"}" - - _umount_dir "$initdir" - - return $ret -} - create_rc_local() { dinfo "Create rc.local" mkdir -p "${initdir:?}/etc/rc.d" diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 92cb07f..0355c7a 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -5824,6 +5824,8 @@ class NetworkdRATests(unittest.TestCase, Utilities): self.assertIn('pref high', output) self.assertNotIn('pref low', output) + # radvd supports captive portal since v2.20. + # https://github.com/radvd-project/radvd/commit/791179a7f730decbddb2290ef0e34aa85d71b1bc @unittest.skipUnless(radvd_check_config('captive-portal.conf'), "Installed radvd doesn't support captive portals") def test_captive_portal(self): copy_network_unit('25-veth-client.netdev', diff --git a/test/units/TEST-02-UNITTESTS.sh b/test/units/TEST-02-UNITTESTS.sh index 6392425..4448643 100755 --- a/test/units/TEST-02-UNITTESTS.sh +++ b/test/units/TEST-02-UNITTESTS.sh @@ -95,6 +95,20 @@ export -f run_test find /usr/lib/systemd/tests/unit-tests/ -maxdepth 1 -type f -name "${TESTS_GLOB}" -print0 | xargs -0 -I {} --max-procs="$MAX_QUEUE_SIZE" bash -ec "run_test {}" +# Write all pending messages, so they don't get mixed with the summaries below +journalctl --sync + +# No need for full test logs in this case +if [[ -s /skipped-tests ]]; then + : "=== SKIPPED TESTS ===" + cat /skipped-tests +fi + +if [[ -s /failed ]]; then + : "=== FAILED TESTS ===" + cat /failed +fi + # Test logs are sometimes lost, as the system shuts down immediately after journalctl --sync diff --git a/test/units/TEST-26-SYSTEMCTL.sh b/test/units/TEST-26-SYSTEMCTL.sh index ae7a5d6..1471f3f 100755 --- a/test/units/TEST-26-SYSTEMCTL.sh +++ b/test/units/TEST-26-SYSTEMCTL.sh @@ -343,6 +343,12 @@ systemctl cat "$UNIT_NAME" systemctl help "$UNIT_NAME" systemctl service-watchdogs systemctl service-watchdogs "$(systemctl service-watchdogs)" +# Ensure that the enablement symlinks can still be removed after the user is gone, to avoid having leftovers +systemctl enable "$UNIT_NAME" +systemctl stop "$UNIT_NAME" +rm -f "/usr/lib/systemd/system/$UNIT_NAME" +systemctl daemon-reload +systemctl disable "$UNIT_NAME" # show/set-environment # Make sure PATH is set diff --git a/test/units/TEST-43-PRIVATEUSER-UNPRIV.sh b/test/units/TEST-43-PRIVATEUSER-UNPRIV.sh index 165af47..f8a2a62 100755 --- a/test/units/TEST-43-PRIVATEUSER-UNPRIV.sh +++ b/test/units/TEST-43-PRIVATEUSER-UNPRIV.sh @@ -6,13 +6,13 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh -install_extension_images - if [[ "$(sysctl -ne kernel.apparmor_restrict_unprivileged_userns)" -eq 1 ]]; then echo "Cannot create unprivileged user namespaces" >/skipped exit 77 fi +install_extension_images + systemd-analyze log-level debug runas testuser systemd-run --wait --user --unit=test-private-users \ |