diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-09-16 21:24:13 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-16 21:24:13 +0900 |
commit | f39fc2d88b049669de798f1b944e180e75213af0 (patch) | |
tree | e560522b31a3e325dc19e4e59b19a76646446e5a /src/test | |
parent | 71de68476c1897b8624538ce32218891251fa5f6 (diff) | |
parent | 36b12282e1b68b963a3df1d2e6e0597a0847f792 (diff) | |
download | systemd-f39fc2d88b049669de798f1b944e180e75213af0.tar.gz systemd-f39fc2d88b049669de798f1b944e180e75213af0.tar.bz2 systemd-f39fc2d88b049669de798f1b944e180e75213af0.zip |
Merge pull request #13354 from keszybz/two-refactoring-patches
Two or more refactoring patches
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-conf-files.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/test/test-conf-files.c b/src/test/test-conf-files.c index 61811311f4..f37f32f1b5 100644 --- a/src/test/test-conf-files.c +++ b/src/test/test-conf-files.c @@ -42,38 +42,34 @@ static void setup_test_dir(char *tmp_dir, const char *files, ...) { static void test_conf_files_list(bool use_root) { char tmp_dir[] = "/tmp/test-conf-files-XXXXXX"; _cleanup_strv_free_ char **found_files = NULL, **found_files2 = NULL; - const char *root_dir, *search_1, *search_2, *expect_a, *expect_b, *expect_c, *mask; + const char *root_dir, *search, *expect_a, *expect_b, *expect_c, *mask; - log_debug("/* %s(%s) */", __func__, yes_no(use_root)); + log_info("/* %s(%s) */", __func__, yes_no(use_root)); setup_test_dir(tmp_dir, - "/dir1/a.conf", - "/dir2/a.conf", - "/dir2/b.conf", - "/dir2/c.foo", - "/dir2/d.conf", + "/dir/a.conf", + "/dir/b.conf", + "/dir/c.foo", NULL); - mask = strjoina(tmp_dir, "/dir1/d.conf"); + mask = strjoina(tmp_dir, "/dir/d.conf"); assert_se(symlink("/dev/null", mask) >= 0); if (use_root) { root_dir = tmp_dir; - search_1 = "/dir1"; - search_2 = "/dir2"; + search = "/dir"; } else { root_dir = NULL; - search_1 = strjoina(tmp_dir, "/dir1"); - search_2 = strjoina(tmp_dir, "/dir2"); + search = strjoina(tmp_dir, "/dir"); } - expect_a = strjoina(tmp_dir, "/dir1/a.conf"); - expect_b = strjoina(tmp_dir, "/dir2/b.conf"); - expect_c = strjoina(tmp_dir, "/dir2/c.foo"); + expect_a = strjoina(tmp_dir, "/dir/a.conf"); + expect_b = strjoina(tmp_dir, "/dir/b.conf"); + expect_c = strjoina(tmp_dir, "/dir/c.foo"); log_debug("/* Check when filtered by suffix */"); - assert_se(conf_files_list(&found_files, ".conf", root_dir, CONF_FILES_FILTER_MASKED, search_1, search_2, NULL) == 0); + assert_se(conf_files_list(&found_files, ".conf", root_dir, CONF_FILES_FILTER_MASKED, search) == 0); strv_print(found_files); assert_se(found_files); @@ -82,7 +78,7 @@ static void test_conf_files_list(bool use_root) { assert_se(!found_files[2]); log_debug("/* Check when unfiltered */"); - assert_se(conf_files_list(&found_files2, NULL, root_dir, CONF_FILES_FILTER_MASKED, search_1, search_2, NULL) == 0); + assert_se(conf_files_list(&found_files2, NULL, root_dir, CONF_FILES_FILTER_MASKED, search) == 0); strv_print(found_files2); assert_se(found_files2); |