test: use setup_fake_runtime_dir() in test-execute
This commit is contained in:
parent
3153ded003
commit
ac1f08b92b
|
@ -551,6 +551,7 @@ static int run_tests(UnitFileScope scope, const test_function_t *tests) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
_cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
|
||||||
static const test_function_t user_tests[] = {
|
static const test_function_t user_tests[] = {
|
||||||
test_exec_bindpaths,
|
test_exec_bindpaths,
|
||||||
test_exec_capabilityambientset,
|
test_exec_capabilityambientset,
|
||||||
|
@ -611,7 +612,7 @@ int main(int argc, char *argv[]) {
|
||||||
return EXIT_TEST_SKIP;
|
return EXIT_TEST_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_se(setenv("XDG_RUNTIME_DIR", "/tmp/", 1) == 0);
|
assert_se(runtime_dir = setup_fake_runtime_dir());
|
||||||
assert_se(set_unit_path(get_testdata_dir("/test-execute")) >= 0);
|
assert_se(set_unit_path(get_testdata_dir("/test-execute")) >= 0);
|
||||||
|
|
||||||
/* Unset VAR1, VAR2 and VAR3 which are used in the PassEnvironment test
|
/* Unset VAR1, VAR2 and VAR3 which are used in the PassEnvironment test
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Description=Test for RuntimeDirectoryMode
|
Description=Test for RuntimeDirectoryMode
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/bin/sh -x -c 'mode=$$(stat -c %%a /tmp/test-exec_runtimedirectory-mode); test "$$mode" = "750"'
|
ExecStart=/bin/sh -x -c 'mode=$$(stat -c %%a %t/test-exec_runtimedirectory-mode); test "$$mode" = "750"'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RuntimeDirectory=test-exec_runtimedirectory-mode
|
RuntimeDirectory=test-exec_runtimedirectory-mode
|
||||||
RuntimeDirectoryMode=0750
|
RuntimeDirectoryMode=0750
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
|
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G /tmp/test-exec_runtimedirectory-owner); test "$$group" = "nfsnobody"'
|
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner); test "$$group" = "nfsnobody"'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
Group=nfsnobody
|
Group=nfsnobody
|
||||||
User=root
|
User=root
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
|
Description=Test for RuntimeDirectory owner (must not be the default group of the user if Group is set)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G /tmp/test-exec_runtimedirectory-owner); test "$$group" = "nobody"'
|
ExecStart=/bin/sh -x -c 'group=$$(stat -c %%G %t/test-exec_runtimedirectory-owner); test "$$group" = "nobody"'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
Group=nobody
|
Group=nobody
|
||||||
User=root
|
User=root
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
Description=Test for RuntimeDirectory
|
Description=Test for RuntimeDirectory
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/bin/sh -x -c 'test -d /tmp/test-exec_runtimedirectory'
|
ExecStart=/bin/sh -x -c 'test -d %t/test-exec_runtimedirectory'
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RuntimeDirectory=test-exec_runtimedirectory
|
RuntimeDirectory=test-exec_runtimedirectory
|
||||||
|
|
Loading…
Reference in New Issue