Skip to content

Commit dcbf670

Browse files
authored
Merge pull request #32957 from mrc0mmand/fix-coverage-builds
test: make TEST-65-ANALYZE happy when built with gcov
2 parents a5edb9b + d3c14f7 commit dcbf670

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

test/units/TEST-13-NSPAWN.machinectl.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ machinectl show-image clone1
132132
machinectl rename clone1 clone2
133133
(! machinectl show-image clone1)
134134
machinectl show-image clone2
135+
# `machinectl read-only` uses chattr (ioctl(FS_IOC_SETFLAGS)) when the container is backed by a directory,
136+
# and this operation might not be implemented on certain filesystems (i.e. tmpfs on older kernels), so check
137+
# if we have chattr support before running following tests
135138
if lsattr -d /var/lib/machines >/dev/null; then
136139
[[ "$(machinectl show-image --property=ReadOnly --value clone2)" == no ]]
137140
machinectl read-only clone2 yes

test/units/TEST-65-ANALYZE.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ systemd-analyze security --offline=true /tmp/testfile.service
303303
systemd-analyze security --offline=true /tmp/testfile.service | grep -q -F "/dev/sda"
304304

305305
# Make sure that running generators under systemd-analyze verify works.
306-
systemd-analyze verify --generators /tmp/testfile.service
306+
# Note: sd-analyze spawns generators in a sandbox which makes gcov unhapy, so temporarily override
307+
# $GCOV_PREFIX to make it skip generating any coverage reports
308+
GCOV_PREFIX=/tmp systemd-analyze verify --generators /tmp/testfile.service
307309

308310
rm /tmp/testfile.service
309311

0 commit comments

Comments
 (0)