1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

test: add a testcase for ProtectHome=tmpfs vs ProtectSystem=strict

This commit is contained in:
Yu Watanabe 2018-12-28 16:30:21 +09:00
parent 5beb8688e0
commit 7e46b29bd3
3 changed files with 15 additions and 0 deletions

View File

@ -269,6 +269,10 @@ static void test_exec_privatedevices(Manager *m) {
test(m, "exec-privatedevices-no-capability-sys-rawio.service", 0, CLD_EXITED);
}
static void test_exec_protecthome(Manager *m) {
test(m, "exec-protecthome-tmpfs-vs-protectsystem-strict.service", can_unshare ? 0 : EXIT_FAILURE, CLD_EXITED);
}
static void test_exec_protectkernelmodules(Manager *m) {
int r;
@ -732,6 +736,7 @@ int main(int argc, char *argv[]) {
test_exec_privatedevices,
test_exec_privatenetwork,
test_exec_privatetmp,
test_exec_protecthome,
test_exec_protectkernelmodules,
test_exec_readonlypaths,
test_exec_readwritepaths,

View File

@ -94,6 +94,7 @@ test_data_files = '''
test-execute/exec-privatenetwork-yes.service
test-execute/exec-privatetmp-no.service
test-execute/exec-privatetmp-yes.service
test-execute/exec-protecthome-tmpfs-vs-protectsystem-strict.service
test-execute/exec-protectkernelmodules-no-capabilities.service
test-execute/exec-protectkernelmodules-yes-capabilities.service
test-execute/exec-protectkernelmodules-yes-mount-propagation.service

View File

@ -0,0 +1,9 @@
[Unit]
Description=Test ProtectHome=tmpfs vs ProtectSystem=strict
# Test for #11276
[Service]
ProtectHome=tmpfs
ProtectSystem=strict
Type=oneshot
ExecStart=/bin/sh -x -c 'test "$$(stat -fc %%T /home)" = "tmpfs"'