mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-04 17:47:03 +03:00
Merge pull request #8273 from yuwata/fix-test-execute
test: cleanups for test-execute
This commit is contained in:
commit
332b090837
@ -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
|
||||||
|
@ -9,9 +9,9 @@ Type=oneshot
|
|||||||
TemporaryFileSystem=/var:ro,mode=0700,nostrictatime
|
TemporaryFileSystem=/var:ro,mode=0700,nostrictatime
|
||||||
|
|
||||||
# Check /proc/self/mountinfo
|
# Check /proc/self/mountinfo
|
||||||
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)ro(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)ro(,|$$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
||||||
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)mode=700(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$11 !~ /(^|,)mode=700(,|$$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
||||||
|
|
||||||
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)ro(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)ro(,|$$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
||||||
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)nodev(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 !~ /(^|,)nodev(,|$$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
||||||
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 ~ /(^|,)strictatime(,|$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
ExecStart=/bin/sh -x -c 'test "$$(awk \'$$5 == "/var" && $$6 ~ /(^|,)strictatime(,|$$)/ { print $$6 }\' /proc/self/mountinfo)" = ""'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user