]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix test for TemporaryFileSystem= (#8241)
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 21 Feb 2018 15:43:35 +0000 (00:43 +0900)
committerLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2018 15:43:35 +0000 (16:43 +0100)
This makes test-execute work on SELinux enabled systems.

Fixes the issue reported at
https://github.com/systemd/systemd/pull/7908#discussion_r169583540

test/test-execute/exec-temporaryfilesystem-options.service

index 1d5d76c81c47eff2082e8fa58e008bdf05f8da6b..7b4f48c66ada82269e8760c121105fd800bdb824 100644 (file)
@@ -4,8 +4,14 @@ Description=Test for TemporaryFileSystem with mount options
 [Service]
 Type=oneshot
 
+# The mount options default to "mode=0755,nodev,strictatime".
+# Let's override some of them, and test the behaviour of "ro".
+TemporaryFileSystem=/var:ro,mode=0700,nostrictatime
+
 # Check /proc/self/mountinfo
-ExecStart=/bin/sh -c 'test $$(awk \'$$5 == "/var" { print $$6 }\' /proc/self/mountinfo) = "ro,nodev,relatime"'
-ExecStart=/bin/sh -c 'test $$(awk \'$$5 == "/var" { print $$11 }\' /proc/self/mountinfo) = "ro,mode=700"'
+ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)ro(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
+ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)mode=700(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
 
-TemporaryFileSystem=/var:ro,mode=0700,nostrictatime
+ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)ro(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
+ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)nodev(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
+ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 ~ /(^|,)strictatime(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'