Skip to content

Commit 37e27ee

Browse files
committed
test: mask tmpfiles.d file shipped by selinux policy package in containers
This tmpfiles.d wants to write to sysfs, which is read-only in containers, so systemd-tmpfiles --create fails in TEST-22-TMPFILES when ran in nspawn if the selinux policy package is instealled. Mask it, as it's not our config file, we don't need it in the test. (cherry picked from commit 6fd3496) (cherry picked from commit 2d975f6)
1 parent 8bf58cd commit 37e27ee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/units/testsuite-22.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ set -o pipefail
66
# shellcheck source=test/units/test-control.sh
77
. "$(dirname "$0")"/test-control.sh
88

9+
if systemd-detect-virt --quiet --container; then
10+
# This comes from the selinux package and tries to write
11+
# some files under sysfs, which will be read-only in a container,
12+
# so mask it. It's not our tmpfiles.d file anyway.
13+
mkdir -p /run/tmpfiles.d/
14+
ln -s /dev/null /run/tmpfiles.d/selinux-policy.conf
15+
fi
16+
917
run_subtests
1018

1119
touch /testok

0 commit comments

Comments
 (0)