diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/test-exec-util.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/test/test-exec-util.c b/src/test/test-exec-util.c index 2304f6a..533c988 100644 --- a/src/test/test-exec-util.c +++ b/src/test/test-exec-util.c @@ -195,7 +195,7 @@ TEST(execution_order) { execute_directories(dirs, DEFAULT_TIMEOUT_USEC, ignore_stdout, ignore_stdout_args, NULL, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); assert_se(read_full_file(output, &contents, NULL) >= 0); - assert_se(streq(contents, "30-override\n80-foo\n90-bar\nlast\n")); + ASSERT_STREQ(contents, "30-override\n80-foo\n90-bar\nlast\n"); } static int gather_stdout_one(int fd, void *arg) { @@ -279,7 +279,7 @@ TEST(stdout_gathering) { log_info("got: %s", output); - assert_se(streq(output, "a\nb\nc\nd\n")); + ASSERT_STREQ(output, "a\nb\nc\nd\n"); } TEST(environment_gathering) { @@ -331,7 +331,7 @@ TEST(environment_gathering) { assert_se(chmod(name3, 0755) == 0); /* When booting in containers or without initrd there might not be any PATH in the environment and if - * there is no PATH /bin/sh built-in PATH may leak and override systemd's DEFAULT_PATH which is not + * there is no PATH /bin/sh built-in PATH may leak and override systemd's default path which is not * good. Force our own PATH in environment, to prevent expansion of sh built-in $PATH */ old = getenv("PATH"); r = setenv("PATH", "no-sh-built-in-path", 1); @@ -346,15 +346,14 @@ TEST(environment_gathering) { STRV_FOREACH(p, env) log_info("got env: \"%s\"", *p); - assert_se(streq(strv_env_get(env, "A"), "22:23:24")); - assert_se(streq(strv_env_get(env, "B"), "12")); - assert_se(streq(strv_env_get(env, "C"), "001")); - assert_se(streq(strv_env_get(env, "PATH"), "no-sh-built-in-path:/no/such/file")); + ASSERT_STREQ(strv_env_get(env, "A"), "22:23:24"); + ASSERT_STREQ(strv_env_get(env, "B"), "12"); + ASSERT_STREQ(strv_env_get(env, "C"), "001"); + ASSERT_STREQ(strv_env_get(env, "PATH"), "no-sh-built-in-path:/no/such/file"); - /* now retest with "default" path passed in, as created by - * manager_default_environment */ + /* Now retest with some "default" path passed. */ env = strv_free(env); - env = strv_new("PATH=" DEFAULT_PATH); + env = strv_new("PATH=" DEFAULT_PATH_WITHOUT_SBIN); assert_se(env); r = execute_directories(dirs, DEFAULT_TIMEOUT_USEC, gather_environment, args, NULL, env, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS); @@ -363,10 +362,10 @@ TEST(environment_gathering) { STRV_FOREACH(p, env) log_info("got env: \"%s\"", *p); - assert_se(streq(strv_env_get(env, "A"), "22:23:24")); - assert_se(streq(strv_env_get(env, "B"), "12")); - assert_se(streq(strv_env_get(env, "C"), "001")); - assert_se(streq(strv_env_get(env, "PATH"), DEFAULT_PATH ":/no/such/file")); + ASSERT_STREQ(strv_env_get(env, "A"), "22:23:24"); + ASSERT_STREQ(strv_env_get(env, "B"), "12"); + ASSERT_STREQ(strv_env_get(env, "C"), "001"); + ASSERT_STREQ(strv_env_get(env, "PATH"), DEFAULT_PATH_WITHOUT_SBIN ":/no/such/file"); /* reset environ PATH */ assert_se(set_unset_env("PATH", old, true) == 0); |