test-execute: add tests for UMask directive
This commit is contained in:
parent
14b0295f91
commit
27c5347c8c
|
@ -1443,6 +1443,8 @@ EXTRA_DIST += \
|
||||||
test/exec-systemcallfilter-not-failing.service \
|
test/exec-systemcallfilter-not-failing.service \
|
||||||
test/exec-user.service \
|
test/exec-user.service \
|
||||||
test/exec-workingdirectory.service \
|
test/exec-workingdirectory.service \
|
||||||
|
test/exec-umask-0177.service \
|
||||||
|
test/exec-umask-default.service \
|
||||||
test/bus-policy/hello.conf \
|
test/bus-policy/hello.conf \
|
||||||
test/bus-policy/methods.conf \
|
test/bus-policy/methods.conf \
|
||||||
test/bus-policy/ownerships.conf \
|
test/bus-policy/ownerships.conf \
|
||||||
|
|
|
@ -132,6 +132,11 @@ static void test_exec_environment(Manager *m) {
|
||||||
test(m, "exec-environment-empty.service", 0, CLD_EXITED);
|
test(m, "exec-environment-empty.service", 0, CLD_EXITED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_exec_umask(Manager *m) {
|
||||||
|
test(m, "exec-umask-default.service", 0, CLD_EXITED);
|
||||||
|
test(m, "exec-umask-0177.service", 0, CLD_EXITED);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
test_function_t tests[] = {
|
test_function_t tests[] = {
|
||||||
test_exec_workingdirectory,
|
test_exec_workingdirectory,
|
||||||
|
@ -144,6 +149,7 @@ int main(int argc, char *argv[]) {
|
||||||
test_exec_user,
|
test_exec_user,
|
||||||
test_exec_group,
|
test_exec_group,
|
||||||
test_exec_environment,
|
test_exec_environment,
|
||||||
|
test_exec_umask,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
test_function_t *test = NULL;
|
test_function_t *test = NULL;
|
||||||
|
|
7
test/exec-umask-0177.service
Normal file
7
test/exec-umask-0177.service
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Test for UMask
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/sh -c 'touch /tmp/test-exec-umask; s=$(stat -c %a /tmp/test-exec-umask); echo $s; exit $(test $s = "600")'
|
||||||
|
UMask=0177
|
||||||
|
PrivateTmp=yes
|
6
test/exec-umask-default.service
Normal file
6
test/exec-umask-default.service
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Test for UMask default
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/sh -c 'touch /tmp/test-exec-umask; s=$(stat -c %a /tmp/test-exec-umask); echo $s; exit $(test $s = "644")'
|
||||||
|
PrivateTmp=yes
|
Loading…
Reference in a new issue