summaryrefslogtreecommitdiff
path: root/src/test/test-path-lookup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-24 21:24:23 +0100
committerLennart Poettering <lennart@poettering.net>2016-04-12 13:43:30 +0200
commit463d0d15690c7abe2172a23ae23c5547693dd71f (patch)
treedd3410341fefada4758bf935ee1db9f680620ebf /src/test/test-path-lookup.c
parentc51932be73e9cfc96e7bcaea1b31347133e1f3ed (diff)
core: remove ManagerRunningAs enum
Previously, we had two enums ManagerRunningAs and UnitFileScope, that were mostly identical and converted from one to the other all the time. The latter had one more value UNIT_FILE_GLOBAL however. Let's simplify things, and remove ManagerRunningAs and replace it by UnitFileScope everywhere, thus making the translation unnecessary. Introduce two new macros MANAGER_IS_SYSTEM() and MANAGER_IS_USER() to simplify checking if we are running in one or the user context.
Diffstat (limited to 'src/test/test-path-lookup.c')
-rw-r--r--src/test/test-path-lookup.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index ebb11dcb6d..5575a364f2 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -26,7 +26,7 @@
#include "string-util.h"
#include "strv.h"
-static void test_paths(ManagerRunningAs running_as, bool personal) {
+static void test_paths(UnitFileScope scope) {
char template[] = "/tmp/test-path-lookup.XXXXXXX";
_cleanup_lookup_paths_free_ LookupPaths lp_without_env = {};
@@ -36,26 +36,26 @@ static void test_paths(ManagerRunningAs running_as, bool personal) {
assert_se(mkdtemp(template));
assert_se(unsetenv("SYSTEMD_UNIT_PATH") == 0);
- assert_se(lookup_paths_init(&lp_without_env, running_as, personal, NULL) == 0);
+ assert_se(lookup_paths_init(&lp_without_env, scope, NULL) == 0);
assert_se(!strv_isempty(lp_without_env.search_path));
systemd_unit_path = strjoina(template, "/systemd-unit-path");
assert_se(setenv("SYSTEMD_UNIT_PATH", systemd_unit_path, 1) == 0);
- assert_se(lookup_paths_init(&lp_with_env, running_as, personal, NULL) == 0);
+ assert_se(lookup_paths_init(&lp_with_env, scope, NULL) == 0);
assert_se(strv_length(lp_with_env.search_path) == 1);
assert_se(streq(lp_with_env.search_path[0], systemd_unit_path));
assert_se(rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL) >= 0);
}
-static void print_generator_paths(ManagerRunningAs running_as) {
+static void print_generator_paths(UnitFileScope scope) {
_cleanup_strv_free_ char **paths;
char **dir;
- log_info("Generators dirs (%s):", running_as == MANAGER_SYSTEM ? "system" : "user");
+ log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
- paths = generator_paths(running_as);
+ paths = generator_paths(scope);
STRV_FOREACH(dir, paths)
log_info(" %s", *dir);
}
@@ -65,13 +65,12 @@ int main(int argc, char **argv) {
log_parse_environment();
log_open();
- test_paths(MANAGER_SYSTEM, false);
- test_paths(MANAGER_SYSTEM, true);
- test_paths(MANAGER_USER, false);
- test_paths(MANAGER_USER, true);
+ test_paths(UNIT_FILE_SYSTEM);
+ test_paths(UNIT_FILE_USER);
+ test_paths(UNIT_FILE_GLOBAL);
- print_generator_paths(MANAGER_SYSTEM);
- print_generator_paths(MANAGER_USER);
+ print_generator_paths(UNIT_FILE_SYSTEM);
+ print_generator_paths(UNIT_FILE_USER);
return EXIT_SUCCESS;
}