]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add tests for simple ReadOnlyPaths= case
authorDjalal Harouni <tixxdz@opendz.org>
Sun, 25 Sep 2016 17:24:25 +0000 (19:24 +0200)
committerDjalal Harouni <tixxdz@opendz.org>
Tue, 27 Sep 2016 07:24:43 +0000 (09:24 +0200)
Makefile.am
src/test/test-execute.c
test/test-execute/exec-readonlypaths.service [new file with mode: 0644]

index 66dbbeca0ea92196064c8eee731d314a84859b47..0417a0511fd75bb1b040f4f8e7c4bb70ac421afa 100644 (file)
@@ -1643,6 +1643,7 @@ EXTRA_DIST += \
        test/test-execute/exec-privatedevices-yes-capability-mknod.service \
        test/test-execute/exec-privatetmp-no.service \
        test/test-execute/exec-privatetmp-yes.service \
+       test/test-execute/exec-readonlypaths.service \
        test/test-execute/exec-spec-interpolation.service \
        test/test-execute/exec-systemcallerrornumber.service \
        test/test-execute/exec-systemcallfilter-failing2.service \
index 2bc1854485b2a9190306e647fcbec7e6ae595647..aa8544e21a74a3db37125f2e073c238157287aa8 100644 (file)
@@ -142,6 +142,10 @@ static void test_exec_privatedevices_capabilities(Manager *m) {
         test(m, "exec-privatedevices-no-capability-mknod.service", 0, CLD_EXITED);
 }
 
+static void test_exec_readonlypaths(Manager *m) {
+        test(m, "exec-readonlypaths.service", 0, CLD_EXITED);
+}
+
 static void test_exec_systemcallfilter(Manager *m) {
 #ifdef HAVE_SECCOMP
         if (!is_seccomp_available())
@@ -355,6 +359,7 @@ int main(int argc, char *argv[]) {
                 test_exec_privatetmp,
                 test_exec_privatedevices,
                 test_exec_privatedevices_capabilities,
+                test_exec_readonlypaths,
                 test_exec_privatenetwork,
                 test_exec_systemcallfilter,
                 test_exec_systemcallerrornumber,
diff --git a/test/test-execute/exec-readonlypaths.service b/test/test-execute/exec-readonlypaths.service
new file mode 100644 (file)
index 0000000..6866fdc
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Test for ReadOnlyPaths=
+
+[Service]
+ReadOnlyPaths=/etc -/i-dont-exist /usr
+ExecStart=/bin/sh -x -c 'test ! -w /etc && test ! -w /usr && test ! -e /i-dont-exist && test -w /var'
+Type=oneshot