diff --git a/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf b/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf index 25edbc526a..30e8fda59e 100644 --- a/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf +++ b/mkosi.images/minimal-base/mkosi.conf.d/10-arch.conf @@ -8,3 +8,29 @@ Packages= inetutils iproute openbsd-netcat + +RemoveFiles= + # Arch Linux doesn't split their gcc-libs package so we manually remove + # unneeded stuff here to make sure it doesn't end up in the image. + /usr/lib/libgfortran.so* + /usr/lib/libgo.so* + /usr/lib/libgomp.so* + /usr/lib/libgphobos.so* + /usr/lib/libobjc.so* + /usr/lib/libasan.so* + /usr/lib/libtsan.so* + /usr/lib/liblsan.so* + /usr/lib/libubsan.so* + /usr/lib/libstdc++.so* + /usr/lib/libgdruntime.so* + + # Remove all files that are only required for development. + /usr/lib/*.a + /usr/include/* + + /usr/share/i18n/* + /usr/share/hwdata/* + /usr/share/iana-etc/* + /usr/share/locale/* + /usr/share/terminfo/* + /usr/share/zoneinfo/* diff --git a/mkosi.images/minimal-base/mkosi.postinst b/mkosi.images/minimal-base/mkosi.postinst new file mode 100755 index 0000000000..c76fb0a011 --- /dev/null +++ b/mkosi.images/minimal-base/mkosi.postinst @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# We don't use mkosi.extra because /usr/sbin could be a symlink and cp doesn't handle that properly until +# coreutils 9.5 or newer. +cat >"$BUILDROOT/sbin/init" <>"pkg/$ID/files.systemd" + grep -v ".debug" /tmp/unpackaged-files >>"pkg/$ID/files.systemd" build --noprep --nocheck fi diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf index 95c5c194a4..d7248bec24 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -63,6 +63,7 @@ Packages= shadow squashfs timezone + tpm2.0-tools user(bin) user(daemon) user(games) diff --git a/test/TEST-09-REBOOT/meson.build b/test/TEST-09-REBOOT/meson.build new file mode 100644 index 0000000000..30a5a10707 --- /dev/null +++ b/test/TEST-09-REBOOT/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +test_params = test_params + { + 'storage': 'persistent', +} diff --git a/test/TEST-13-NSPAWN/test.sh b/test/TEST-13-NSPAWN/test.sh index 6dfb527718..744e793ac2 100755 --- a/test/TEST-13-NSPAWN/test.sh +++ b/test/TEST-13-NSPAWN/test.sh @@ -5,13 +5,15 @@ set -e TEST_DESCRIPTION="systemd-nspawn tests" IMAGE_NAME="nspawn" TEST_NO_NSPAWN=1 +IMAGE_ADDITIONAL_ROOT_SIZE=500 +TEST_FORCE_NEWIMAGE=1 # shellcheck source=test/test-functions . "${TEST_BASE_DIR:?}/test-functions" test_append_files() { local workspace="${1:?}" - local container="$workspace/testsuite-13-container-template" + local container="$workspace/usr/share/testsuite-13-container-template" # For virtual wlan interface. instmods mac80211_hwsim diff --git a/test/integration-test-wrapper.py b/test/integration-test-wrapper.py index 1e003342df..1954d0fec0 100755 --- a/test/integration-test-wrapper.py +++ b/test/integration-test-wrapper.py @@ -47,6 +47,7 @@ def main(): parser.add_argument('--meson-build-dir', required=True, type=Path) parser.add_argument('--test-name', required=True) parser.add_argument('--test-number', required=True) + parser.add_argument('--storage', required=True) parser.add_argument('mkosi_args', nargs="*") args = parser.parse_args() @@ -93,9 +94,6 @@ def main(): f"systemd.extra-unit.emergency-exit.service={shlex.quote(EMERGENCY_EXIT_SERVICE)}", '--credential', f"systemd.unit-dropin.emergency.target={shlex.quote(EMERGENCY_EXIT_DROPIN)}", - '--kernel-command-line-extra=systemd.mask=serial-getty@.service systemd.show_status=no systemd.crash_shell=0 systemd.crash_reboot', - # Custom firmware variables allow bypassing the EFI auto-enrollment reboot so we only reboot on crash - '--qemu-firmware-variables=custom', ] if not sys.stderr.isatty() else [] @@ -103,17 +101,28 @@ def main(): '--credential', f"systemd.unit-dropin.{test_unit}={shlex.quote(dropin)}", '--runtime-network=none', + '--runtime-scratch=no', '--append', '--kernel-command-line-extra', ' '.join([ 'systemd.hostname=H', f"SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-{args.test_number}.units:/usr/lib/systemd/tests/testdata/units:", f"systemd.unit={test_unit}", + 'systemd.mask=systemd-networkd-wait-online.service', + *( + [ + "systemd.mask=serial-getty@.service", + "systemd.show_status=no", + "systemd.crash_shell=0", + "systemd.crash_action=poweroff", + ] + if not sys.stderr.isatty() + else [] + ), ]), - '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else 'runtime'}" , + '--credential', f"journal.storage={'persistent' if sys.stderr.isatty() else args.storage}" , *args.mkosi_args, 'qemu', - *(['-no-reboot'] if not sys.stderr.isatty() else []) ] result = subprocess.run(cmd) diff --git a/test/meson.build b/test/meson.build index 235c68ae29..7290b98f0d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -339,42 +339,72 @@ integration_tests = { '01': 'TEST-01-BASIC', '02': 'TEST-02-UNITTESTS', '03': 'TEST-03-JOBS', + # '04': 'TEST-04-JOURNAL', # Extremely flaky '05': 'TEST-05-RLIMITS', + # '06': 'TEST-06-SELINUX', + # '07': 'TEST-07-PID1', + # '08': 'TEST-08-INITRD', + '09': 'TEST-09-REBOOT', + '13': 'TEST-13-NSPAWN', + '15': 'TEST-15-DROPIN', '16': 'TEST-16-EXTEND-TIMEOUT', '17': 'TEST-17-UDEV', # Can be flaky when overloaded if timeout abort test is slow + '18': 'TEST-18-FAILUREACTION', '19': 'TEST-19-CGROUP', + # '21': 'TEST-21-DFUZZER', + '22': 'TEST-22-TMPFILES', + # '23': 'TEST-23-UNIT-FILE', + # '24': 'TEST-24-CRYPTSETUP', '25': 'TEST-25-IMPORT', '26': 'TEST-26-SYSTEMCTL', '29': 'TEST-29-PORTABLE', '30': 'TEST-30-ONCLOCKCHANGE', + # '31': 'TEST-31-DEVICE-ENUMERATION', '32': 'TEST-32-OOMPOLICY', '34': 'TEST-34-DYNAMICUSERMIGRATE', + '35': 'TEST-35-LOGIN', '36': 'TEST-36-NUMAPOLICY', '38': 'TEST-38-FREEZER', '43': 'TEST-43-PRIVATEUSER-UNPRIV', '44': 'TEST-44-LOG-NAMESPACE', '45': 'TEST-45-TIMEDATE', + # '46': 'TEST-46-HOMED', '50': 'TEST-50-DISSECT', + # '52': 'TEST-52-HONORFIRSTSHUTDOWN', + # '53': 'TEST-53-ISSUE-16347', + # '54': 'TEST-54-CREDS', + # '55': 'TEST-55-OOMD', + # '58': 'TEST-58-REPART', # Can be flaky when overloaded if daemon-reload is too slow to be rate-limited '59': 'TEST-59-RELOADING-RESTART', '60': 'TEST-60-MOUNT-RATELIMIT', '62': 'TEST-62-RESTRICT-IFACES', '63': 'TEST-63-PATH', + # '64': 'TEST-54-UDEV-STORAGE', + '65': 'TEST-65-ANALYZE', '66': 'TEST-66-DEVICE-ISOLATION', '67': 'TEST-67-INTEGRITY', '68': 'TEST-68-PROPAGATE-EXIT-STATUS', + '70': 'TEST-70-TPM2', + '71': 'TEST-71-HOSTNAME', '72': 'TEST-72-SYSUPDATE', + # '73': 'TEST-73-LOCALE', + # '74': 'TEST-74-AUX-UTILS', + # '75': 'TEST-75-RESOLVED', '76': 'TEST-76-SYSCTL', '78': 'TEST-78-SIGQUEUE', '79': 'TEST-79-MEMPRESS', '80': 'TEST-80-NOTIFYACCESS', '81': 'TEST-81-GENERATORS', + # '82': 'TEST-82-SOFTREBOOT', + '83': 'TEST-83-BTRFS', '84': 'TEST-84-STORAGETM', } foreach test_number, dirname : integration_tests test_params = { 'mkosi_args' : [], - 'timeout' : 600, + 'timeout' : 1800, + 'storage': 'volatile', } # TODO: This fs.exists call isn't included in rebuild logic @@ -389,6 +419,7 @@ foreach test_number, dirname : integration_tests '--meson-build-dir', meson.project_build_root(), '--test-name', dirname, '--test-number', test_number, + '--storage', test_params['storage'], '--', ] + test_params['mkosi_args'] diff --git a/test/test-functions b/test/test-functions index 59242b3569..10ea6ef03a 100644 --- a/test/test-functions +++ b/test/test-functions @@ -476,8 +476,7 @@ run_qemu() { local CONSOLE=ttyS0 - # Reset the boot counter, if present - rm -f "${initdir:?}/var/tmp/.systemd_reboot_count" + find "${initdir:?}/var/tmp" -mindepth 1 -delete rm -f "$initdir"/{testok,failed,skipped} # make sure the initdir is not mounted to avoid concurrent access cleanup_initdir @@ -651,8 +650,7 @@ run_qemu() { # success), or 1 if nspawn is not available. run_nspawn() { [[ -d /run/systemd/system ]] || return 1 - # Reset the boot counter, if present - rm -f "${initdir:?}/var/tmp/.systemd_reboot_count" + find "${initdir:?}/var/tmp" -mindepth 1 -delete rm -f "${initdir:?}"/{testok,failed,skipped} local nspawn_cmd=() diff --git a/test/testsuite-04.units/delegated-cgroup-filtering.service b/test/testsuite-04.units/delegated-cgroup-filtering.service index 2c4201a27b..a12b12ac4a 100644 --- a/test/testsuite-04.units/delegated-cgroup-filtering.service +++ b/test/testsuite-04.units/delegated-cgroup-filtering.service @@ -2,7 +2,7 @@ Description=Test service for delegated logs filtering [Service] -Type=simple +Type=oneshot ExecStart=/usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload.sh Delegate=yes SyslogLevel=notice diff --git a/test/testsuite-04.units/logs-filtering.service b/test/testsuite-04.units/logs-filtering.service index 6e2af9a2a1..a5aba1859c 100644 --- a/test/testsuite-04.units/logs-filtering.service +++ b/test/testsuite-04.units/logs-filtering.service @@ -2,5 +2,6 @@ Description=Log filtering unit [Service] -ExecStart=sh -c 'while true; do echo "Logging from the service, and ~more~ foo bar"; sleep .25; done' +Type=oneshot +ExecStart=sh -c 'echo "Logging from the service, and ~more~ foo bar" && sleep 2' SyslogLevel=notice diff --git a/test/units/delegated_cgroup_filtering_payload.sh b/test/units/delegated_cgroup_filtering_payload.sh index 50d01a5d4a..7ad486bcad 100755 --- a/test/units/delegated_cgroup_filtering_payload.sh +++ b/test/units/delegated_cgroup_filtering_payload.sh @@ -2,11 +2,8 @@ # SPDX-License-Identifier: LGPL-2.1-or-later mkdir /sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child -/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh & +/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh -while true -do - echo "parent_process: hello, world!" - echo "parent_process: hello, people!" - sleep .15 -done +echo "parent_process: hello, world!" +echo "parent_process: hello, people!" +sleep .15 diff --git a/test/units/delegated_cgroup_filtering_payload_child.sh b/test/units/delegated_cgroup_filtering_payload_child.sh index b5635b58e5..94f0d3acef 100755 --- a/test/units/delegated_cgroup_filtering_payload_child.sh +++ b/test/units/delegated_cgroup_filtering_payload_child.sh @@ -3,9 +3,6 @@ echo $$ >/sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child/cgroup.procs -while true -do - echo "child_process: hello, world!" - echo "child_process: hello, people!" - sleep .15 -done +echo "child_process: hello, world!" +echo "child_process: hello, people!" +sleep .15 diff --git a/test/units/testsuite-04.LogFilterPatterns.sh b/test/units/testsuite-04.LogFilterPatterns.sh index d5d610fe02..dfa9652ee2 100755 --- a/test/units/testsuite-04.LogFilterPatterns.sh +++ b/test/units/testsuite-04.LogFilterPatterns.sh @@ -18,16 +18,12 @@ add_logs_filtering_override() { run_service_and_fetch_logs() { local unit="${1:?}" - local start end + local start start="$(date '+%Y-%m-%d %T.%6N')" - systemctl restart "$unit" - sleep .5 + systemctl start "$unit" journalctl --sync - end="$(date '+%Y-%m-%d %T.%6N')" - - journalctl -q -u "$unit" -S "$start" -U "$end" -p notice - systemctl stop "$unit" + journalctl -q -u "$unit" -S "$start" -p notice } if cgroupfs_supports_user_xattrs; then diff --git a/test/units/testsuite-09.journal.sh b/test/units/testsuite-09.journal.sh index 136d905ab9..5248d70d84 100755 --- a/test/units/testsuite-09.journal.sh +++ b/test/units/testsuite-09.journal.sh @@ -84,7 +84,7 @@ verify_seqnum() { journalctl --system --header - (! journalctl --system -q -o short-monotonic -u systemd-journald.service --grep 'rotating') + (! journalctl --system -q -o short-monotonic -u systemd-journald.service --grep 'Journal file uses a different sequence number ID, rotating') set +x previous_seqnum=0 diff --git a/test/units/testsuite-13.machinectl.sh b/test/units/testsuite-13.machinectl.sh index c3bfde2768..6e2ad165bd 100755 --- a/test/units/testsuite-13.machinectl.sh +++ b/test/units/testsuite-13.machinectl.sh @@ -23,9 +23,9 @@ trap at_exit EXIT systemctl service-log-level systemd-machined debug systemctl service-log-level systemd-importd debug -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Create a couple of containers we can refer to in tests for i in {0..4}; do @@ -154,37 +154,37 @@ test ! -d /var/lib/machines/.hidden1 # Prepare a simple raw container mkdir -p /tmp/mnt -dd if=/dev/zero of=/tmp/container.raw bs=1M count=64 -mkfs.ext4 /tmp/container.raw -mount -o loop /tmp/container.raw /tmp/mnt +dd if=/dev/zero of=/var/tmp/container.raw bs=1M count=256 +mkfs.ext4 /var/tmp/container.raw +mount -o loop /var/tmp/container.raw /tmp/mnt cp -r /var/lib/machines/container1/* /tmp/mnt umount /tmp/mnt # Try to import it, run it, export it, and re-import it -machinectl import-raw /tmp/container.raw container-raw +machinectl import-raw /var/tmp/container.raw container-raw [[ "$(machinectl show-image --property=Type --value container-raw)" == "raw" ]] machinectl start container-raw -machinectl export-raw container-raw /tmp/container-export.raw -machinectl import-raw /tmp/container-export.raw container-raw-reimport +machinectl export-raw container-raw /var/tmp/container-export.raw +machinectl import-raw /var/tmp/container-export.raw container-raw-reimport [[ "$(machinectl show-image --property=Type --value container-raw-reimport)" == "raw" ]] -rm -f /tmp/container{,-export}.raw +rm -f /var/tmp/container{,-export}.raw # Prepare a simple tar.gz container -tar -pczf /tmp/container.tar.gz -C /var/lib/machines/container1 . +tar -pczf /var/tmp/container.tar.gz -C /var/lib/machines/container1 . # Try to import it, run it, export it, and re-import it -machinectl import-tar /tmp/container.tar.gz container-tar -[[ "$(machinectl show-image --property=Type --value container-tar)" == "directory" ]] +machinectl import-tar /var/tmp/container.tar.gz container-tar +[[ "$(machinectl show-image --property=Type --value container-tar)" =~ directory|subvolume ]] machinectl start container-tar -machinectl export-tar container-tar /tmp/container-export.tar.gz -machinectl import-tar /tmp/container-export.tar.gz container-tar-reimport -[[ "$(machinectl show-image --property=Type --value container-tar-reimport)" == "directory" ]] -rm -f /tmp/container{,-export}.tar.gz +machinectl export-tar container-tar /var/tmp/container-export.tar.gz +machinectl import-tar /var/tmp/container-export.tar.gz container-tar-reimport +[[ "$(machinectl show-image --property=Type --value container-tar-reimport)" =~ directory|subvolume ]] +rm -f /var/tmp/container{,-export}.tar.gz # Try to import a container directory & run it -cp -r /var/lib/machines/container1 /tmp/container.dir -machinectl import-fs /tmp/container.dir container-dir -[[ "$(machinectl show-image --property=Type --value container-dir)" == "directory" ]] +cp -r /var/lib/machines/container1 /var/tmp/container.dir +machinectl import-fs /var/tmp/container.dir container-dir +[[ "$(machinectl show-image --property=Type --value container-dir)" =~ directory|subvolume ]] machinectl start container-dir -rm -fr /tmp/container.dir +rm -fr /var/tmp/container.dir timeout 10 bash -c "until machinectl clean --all; do sleep .5; done" diff --git a/test/units/testsuite-13.nspawn-oci.sh b/test/units/testsuite-13.nspawn-oci.sh index 8fa0bc4290..b8a76fa172 100755 --- a/test/units/testsuite-13.nspawn-oci.sh +++ b/test/units/testsuite-13.nspawn-oci.sh @@ -23,9 +23,9 @@ at_exit() { trap at_exit EXIT -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Setup a couple of dirs/devices for the OCI containers DEV="$(mktemp -u /dev/oci-dev-XXX)" diff --git a/test/units/testsuite-13.nspawn.sh b/test/units/testsuite-13.nspawn.sh index 5b67cf8c7e..026ed23fcd 100755 --- a/test/units/testsuite-13.nspawn.sh +++ b/test/units/testsuite-13.nspawn.sh @@ -71,9 +71,9 @@ if unshare -U bash -c :; then IS_USERNS_SUPPORTED=yes fi -# Mount tmpfs over /var/lib/machines to not pollute the image +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines testcase_sanity() { local template root image uuid tmpdir @@ -83,7 +83,7 @@ testcase_sanity() { create_dummy_container "$template" # Create a simple image from the just created container template image="$(mktemp /var/lib/machines/testsuite-13.image-XXX.img)" - dd if=/dev/zero of="$image" bs=1M count=64 + dd if=/dev/zero of="$image" bs=1M count=256 mkfs.ext4 "$image" mkdir -p /mnt mount -o loop "$image" /mnt diff --git a/test/units/testsuite-13.nss-mymachines.sh b/test/units/testsuite-13.nss-mymachines.sh index 931b93f953..817431b449 100755 --- a/test/units/testsuite-13.nss-mymachines.sh +++ b/test/units/testsuite-13.nss-mymachines.sh @@ -17,8 +17,9 @@ at_exit() { trap at_exit EXIT +# Mount temporary directory over /var/lib/machines to not pollute the image mkdir -p /var/lib/machines -mount -t tmpfs tmpfs /var/lib/machines +mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines # Create a bunch of containers that: # 1) Have no IP addresses assigned diff --git a/test/units/testsuite-13.sh b/test/units/testsuite-13.sh index 9c2a033aa9..dd7f274631 100755 --- a/test/units/testsuite-13.sh +++ b/test/units/testsuite-13.sh @@ -3,6 +3,13 @@ set -eux set -o pipefail +FSTYPE="$(stat --file-system --format "%T" /)" + +if [[ "$FSTYPE" == "fuseblk" ]]; then + echo "Root filesystem is virtiofs, skipping" + exit 77 +fi + # shellcheck source=test/units/test-control.sh . "$(dirname "$0")"/test-control.sh diff --git a/test/units/testsuite-15.sh b/test/units/testsuite-15.sh index 204fa99219..7143a1597a 100755 --- a/test/units/testsuite-15.sh +++ b/test/units/testsuite-15.sh @@ -8,10 +8,6 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh -# Needed to write units to /usr/lib/systemd/system to test /etc and /run overrides. -maybe_mount_usr_overlay -trap 'maybe_umount_usr_overlay' EXIT - clear_unit() { local unit_name="${1:?}" local base suffix diff --git a/test/units/testsuite-18.sh b/test/units/testsuite-18.sh index 44b792f003..364c20d863 100755 --- a/test/units/testsuite-18.sh +++ b/test/units/testsuite-18.sh @@ -11,7 +11,7 @@ if ! test -f /firstphase ; then systemd-run --wait -p SuccessAction=reboot true else echo OK >/testok - systemd-run --wait -p FailureAction=poweroff false + systemd-run --wait -p FailureAction=exit -p FailureActionExitStatus=123 false fi sleep infinity diff --git a/test/units/testsuite-25.sh b/test/units/testsuite-25.sh index 24b02cedcf..b298c506e1 100755 --- a/test/units/testsuite-25.sh +++ b/test/units/testsuite-25.sh @@ -3,11 +3,6 @@ set -eux set -o pipefail -if ! command -v importctl >/dev/null; then - echo "importctl is not available to be chain-loaded from machinectl, skipping" >>/skipped - exit 77 -fi - export SYSTEMD_PAGER=cat dd if=/dev/urandom of=/var/tmp/testimage.raw bs=$((1024*1024+7)) count=5 diff --git a/test/units/testsuite-26.sh b/test/units/testsuite-26.sh index 27aa98edb7..61b0ffd812 100755 --- a/test/units/testsuite-26.sh +++ b/test/units/testsuite-26.sh @@ -12,16 +12,10 @@ at_exit() { rm -fvr "/usr/lib/systemd/system/$UNIT_NAME" "/etc/systemd/system/$UNIT_NAME.d" "+4" fi - maybe_umount_usr_overlay - rm -f /etc/init.d/issue-24990 return 0 } -# Needed for /usr/lib/systemd/system/$UNIT_NAME to test overrides in /etc and /run -maybe_mount_usr_overlay -trap at_exit EXIT - # Create a simple unit file for testing # Note: the service file is created under /usr on purpose to test # the 'revert' verb as well diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh index e9af67f358..0f4b770de3 100755 --- a/test/units/testsuite-35.sh +++ b/test/units/testsuite-35.sh @@ -390,7 +390,7 @@ testcase_sanity_check() { # We're not in the same session scope, so in this case we need to specify # the session ID explicitly - session=$(loginctl --no-legend | awk '$3 == "logind-test-user" { print $1; exit; }') + session=$(loginctl --no-legend | grep -v manager | awk '$3 == "logind-test-user" { print $1; exit; }') loginctl kill-session --signal=SIGCONT "$session" # FIXME(?) #loginctl kill-session --signal=SIGCONT --kill-whom=leader "$session" @@ -524,11 +524,15 @@ EOF # least one session, so minimum of 2 "Lock" signals must have been sent. timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 1 ]]; do sleep 1; done" + # We need to know that a new message was sent after waking up, + # so we must track how many happened before sleeping to check we have extra. + locks="$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'Sent message type=signal .* member=Lock')" + # Wakeup touch /dev/tty2 # Wait again - timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt 2 ]]; do sleep 1; done" + timeout 35 bash -c "while [[ \"\$(journalctl -b -u systemd-logind.service --since=$ts | grep -c 'Sent message type=signal .* member=Lock')\" -lt $((locks + 1)) ]]; do sleep 1; done" if [[ "$(journalctl -b -u systemd-logind.service --since="$ts" | grep -c 'System idle. Will be locked now.')" -lt 2 ]]; then echo >&2 "System haven't entered idle state at least 2 times." diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh index d9ba83aa82..7d84b0d04d 100755 --- a/test/units/testsuite-46.sh +++ b/test/units/testsuite-46.sh @@ -511,7 +511,11 @@ if command -v ssh &>/dev/null && command -v sshd &>/dev/null && ! [[ -v ASAN_OPT rm -f /tmp/homed.id_ecdsa /run/systemd/system/mysshserver{@.service,.socket} systemctl daemon-reload homectl remove homedsshtest - mv /etc/pam.d/sshd.bak /etc/pam.d/sshd + for dir in /etc /usr/lib; do + if [[ -f "$dir/pam.d/sshd.bak" ]]; then + mv "$dir/pam.d/sshd.bak" "$dir/pam.d/sshd" + fi + done } trap at_exit EXIT @@ -538,8 +542,10 @@ if command -v ssh &>/dev/null && command -v sshd &>/dev/null && ! [[ -v ASAN_OPT # are aware of distros use mkdir -p /usr/share/empty.sshd /var/empty /var/empty/sshd /run/sshd - mv /etc/pam.d/sshd /etc/pam.d/sshd.bak - cat >/etc/pam.d/sshd <"$dir/pam.d/sshd" </etc/ssh/sshd_config <>/run/systemd/system/systemd-localed.service.d/override.conf <&2 "Missing container template, probably not running in TEST-13-NSPAWN?" exit 1 fi mkdir -p "$root" - cp -a /testsuite-13-container-template/* "$root" + cp -a /usr/share/testsuite-13-container-template/* "$root" coverage_create_nspawn_dropin "$root" } @@ -226,22 +226,6 @@ kernel_supports_lsm() { return 1 } -MOUNTED_USR_OVERLAY=false - -maybe_mount_usr_overlay() { - if [[ ! -w /usr ]]; then - mkdir -p /tmp/usr-overlay/{upperdir,workdir} - mount -t overlay -o lowerdir=/usr,upperdir=/tmp/usr-overlay/upperdir,workdir=/tmp/usr-overlay/workdir overlay /usr - MOUNTED_USR_OVERLAY=true - fi -} - -maybe_umount_usr_overlay() { - if "$MOUNTED_USR_OVERLAY"; then - umount -l /usr - fi -} - install_extension_images() { local os_release os_release="$(test -e /etc/os-release && echo /etc/os-release || echo /usr/lib/os-release)"