From: Timothée Ravier Date: Thu, 25 May 2017 04:47:08 +0000 (+0200) Subject: test: ensure 'InaccessiblePaths=/proc' option works (#6017) X-Git-Tag: v234~167 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c090d74dd974994552f1a29a2d65400f0c07dd9a;p=thirdparty%2Fsystemd.git test: ensure 'InaccessiblePaths=/proc' option works (#6017) Test case for PR #5985. --- diff --git a/Makefile.am b/Makefile.am index 1cbb278c68e..e95cbe4b975 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1737,6 +1737,7 @@ TEST_DATA_FILES += \ test/test-execute/exec-readonlypaths-mount-propagation.service \ test/test-execute/exec-readwritepaths-mount-propagation.service \ test/test-execute/exec-inaccessiblepaths-mount-propagation.service \ + test/test-execute/exec-inaccessiblepaths-proc.service \ test/test-execute/exec-spec-interpolation.service \ test/test-execute/exec-systemcallerrornumber.service \ test/test-execute/exec-systemcallfilter-failing2.service \ diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 90540b884bf..2dfa90ed199 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -233,6 +233,10 @@ static void test_exec_inaccessiblepaths(Manager *m) { test(m, "exec-inaccessiblepaths-mount-propagation.service", 0, CLD_EXITED); } +static void test_exec_inaccessiblepaths_proc(Manager *m) { + test(m, "exec-inaccessiblepaths-proc.service", 0, CLD_EXITED); +} + static void test_exec_systemcallfilter(Manager *m) { #ifdef HAVE_SECCOMP if (!is_seccomp_available()) @@ -479,6 +483,7 @@ int main(int argc, char *argv[]) { test_exec_readonlypaths, test_exec_readwritepaths, test_exec_inaccessiblepaths, + test_exec_inaccessiblepaths_proc, test_exec_privatenetwork, test_exec_systemcallfilter, test_exec_systemcallerrornumber, diff --git a/test/meson.build b/test/meson.build index b7fb507c9ca..55e693ac72c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -85,6 +85,7 @@ test_data_files = ''' test-execute/exec-readonlypaths-mount-propagation.service test-execute/exec-readwritepaths-mount-propagation.service test-execute/exec-inaccessiblepaths-mount-propagation.service + test-execute/exec-inaccessiblepaths-proc.service test-execute/exec-spec-interpolation.service test-execute/exec-systemcallerrornumber.service test-execute/exec-systemcallfilter-failing2.service diff --git a/test/test-execute/exec-inaccessiblepaths-proc.service b/test/test-execute/exec-inaccessiblepaths-proc.service new file mode 100644 index 00000000000..ebdb4843d1b --- /dev/null +++ b/test/test-execute/exec-inaccessiblepaths-proc.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test to make sure that mount namespace setup works properly with the 'InaccessiblePaths=/proc' option + +[Service] +InaccessiblePaths=/proc +ExecStart=/bin/sh -x -c 'test "$$(stat -c %%a /proc)" = "0"' +Type=oneshot