summaryrefslogtreecommitdiff
path: root/src/test/test-path-lookup.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 15:55:59 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 16:17:57 +0200
commitb380b6438361e39ad5076bfa58d2021621a957af (patch)
tree41ef3c9738a5989af15ce0a3626a966716ef9d1f /src/test/test-path-lookup.c
parent5c29de29b43829ba09967b05ae2f136356c8c0d2 (diff)
downloadsystemd-b380b6438361e39ad5076bfa58d2021621a957af.tar.gz
Rename UnitFileScope to LookupScope
As suggested in https://github.com/systemd/systemd/pull/22649/commits/8b3ad3983f5440eef812b34e5ed862ca59fdf7f7#r837345892 The define is generalized and moved to path-lookup.h, where it seems to fit better. This allows a recursive include to be removed and in general makes things simpler.
Diffstat (limited to 'src/test/test-path-lookup.c')
-rw-r--r--src/test/test-path-lookup.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index dfb7550543..c98a1f4b73 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -11,7 +11,7 @@
#include "tests.h"
#include "tmpfile-util.h"
-static void test_paths_one(UnitFileScope scope) {
+static void test_paths_one(LookupScope scope) {
_cleanup_(rm_rf_physical_and_freep) char *tmp = NULL;
_cleanup_(lookup_paths_free) LookupPaths lp_without_env = {};
_cleanup_(lookup_paths_free) LookupPaths lp_with_env = {};
@@ -34,9 +34,9 @@ static void test_paths_one(UnitFileScope scope) {
}
TEST(paths) {
- test_paths_one(UNIT_FILE_SYSTEM);
- test_paths_one(UNIT_FILE_USER);
- test_paths_one(UNIT_FILE_GLOBAL);
+ test_paths_one(LOOKUP_SCOPE_SYSTEM);
+ test_paths_one(LOOKUP_SCOPE_USER);
+ test_paths_one(LOOKUP_SCOPE_GLOBAL);
}
TEST(user_and_global_paths) {
@@ -48,8 +48,8 @@ TEST(user_and_global_paths) {
assert_se(unsetenv("XDG_DATA_DIRS") == 0);
assert_se(unsetenv("XDG_CONFIG_DIRS") == 0);
- assert_se(lookup_paths_init(&lp_global, UNIT_FILE_GLOBAL, 0, NULL) == 0);
- assert_se(lookup_paths_init(&lp_user, UNIT_FILE_USER, 0, NULL) == 0);
+ assert_se(lookup_paths_init(&lp_global, LOOKUP_SCOPE_GLOBAL, 0, NULL) == 0);
+ assert_se(lookup_paths_init(&lp_user, LOOKUP_SCOPE_USER, 0, NULL) == 0);
g = lp_global.search_path;
u = lp_user.search_path;
@@ -70,7 +70,7 @@ TEST(user_and_global_paths) {
log_info("+ %s", *p);
}
-static void test_generator_binary_paths_one(UnitFileScope scope) {
+static void test_generator_binary_paths_one(LookupScope scope) {
_cleanup_(rm_rf_physical_and_freep) char *tmp = NULL;
_cleanup_strv_free_ char **gp_without_env = NULL;
_cleanup_strv_free_ char **env_gp_without_env = NULL;
@@ -85,13 +85,13 @@ static void test_generator_binary_paths_one(UnitFileScope scope) {
assert_se(unsetenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH") == 0);
gp_without_env = generator_binary_paths(scope);
- env_gp_without_env = env_generator_binary_paths(scope == UNIT_FILE_SYSTEM ? true : false);
+ env_gp_without_env = env_generator_binary_paths(scope == LOOKUP_SCOPE_SYSTEM ? true : false);
- log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
+ log_info("Generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user");
STRV_FOREACH(dir, gp_without_env)
log_info(" %s", *dir);
- log_info("Environment generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
+ log_info("Environment generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user");
STRV_FOREACH(dir, env_gp_without_env)
log_info(" %s", *dir);
@@ -104,13 +104,13 @@ static void test_generator_binary_paths_one(UnitFileScope scope) {
assert_se(setenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH", systemd_env_generator_path, 1) == 0);
gp_with_env = generator_binary_paths(scope);
- env_gp_with_env = env_generator_binary_paths(scope == UNIT_FILE_SYSTEM ? true : false);
+ env_gp_with_env = env_generator_binary_paths(scope == LOOKUP_SCOPE_SYSTEM ? true : false);
- log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
+ log_info("Generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user");
STRV_FOREACH(dir, gp_with_env)
log_info(" %s", *dir);
- log_info("Environment generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
+ log_info("Environment generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user");
STRV_FOREACH(dir, env_gp_with_env)
log_info(" %s", *dir);
@@ -119,8 +119,8 @@ static void test_generator_binary_paths_one(UnitFileScope scope) {
}
TEST(generator_binary_paths) {
- test_generator_binary_paths_one(UNIT_FILE_SYSTEM);
- test_generator_binary_paths_one(UNIT_FILE_USER);
+ test_generator_binary_paths_one(LOOKUP_SCOPE_SYSTEM);
+ test_generator_binary_paths_one(LOOKUP_SCOPE_USER);
}
DEFINE_TEST_MAIN(LOG_DEBUG);