From 95400d1d8365e20cca3ab60ec138104110925076 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 21 May 2024 15:04:22 +0200 Subject: [PATCH 1/2] test: make TEST-65-ANALYZE happy when built with gcov systemd-analyze runs the generators in a sandbox, which makes gcov unhappy since it can't update its counters. Let's "silence" gcov in this particular case by telling it to look for gcov note files in /tmp (where shouldn't be any, so gcov won't try to update any counters). --- test/units/TEST-65-ANALYZE.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/units/TEST-65-ANALYZE.sh b/test/units/TEST-65-ANALYZE.sh index 5f650ade05..18f5c4d804 100755 --- a/test/units/TEST-65-ANALYZE.sh +++ b/test/units/TEST-65-ANALYZE.sh @@ -303,7 +303,9 @@ systemd-analyze security --offline=true /tmp/testfile.service systemd-analyze security --offline=true /tmp/testfile.service | grep -q -F "/dev/sda" # Make sure that running generators under systemd-analyze verify works. -systemd-analyze verify --generators /tmp/testfile.service +# Note: sd-analyze spawns generators in a sandbox which makes gcov unhapy, so temporarily override +# $GCOV_PREFIX to make it skip generating any coverage reports +GCOV_PREFIX=/tmp systemd-analyze verify --generators /tmp/testfile.service rm /tmp/testfile.service From d3c14f78cd66a498c2ff8a836bfc4f6a110315fe Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 21 May 2024 15:08:07 +0200 Subject: [PATCH 2/2] test: add a brief comment for the chattr check Addresses: https://github.com/systemd/systemd/pull/32907#discussion_r1605919598 --- test/units/TEST-13-NSPAWN.machinectl.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/units/TEST-13-NSPAWN.machinectl.sh b/test/units/TEST-13-NSPAWN.machinectl.sh index c27207bcc7..462cc6a8c3 100755 --- a/test/units/TEST-13-NSPAWN.machinectl.sh +++ b/test/units/TEST-13-NSPAWN.machinectl.sh @@ -132,6 +132,9 @@ machinectl show-image clone1 machinectl rename clone1 clone2 (! machinectl show-image clone1) machinectl show-image clone2 +# `machinectl read-only` uses chattr (ioctl(FS_IOC_SETFLAGS)) when the container is backed by a directory, +# and this operation might not be implemented on certain filesystems (i.e. tmpfs on older kernels), so check +# if we have chattr support before running following tests if lsattr -d /var/lib/machines >/dev/null; then [[ "$(machinectl show-image --property=ReadOnly --value clone2)" == no ]] machinectl read-only clone2 yes