diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-03-28 17:59:26 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-19 16:49:41 +0200 |
commit | 771fded37f4858375a1d3f5f30ffc72fdc9fbed6 (patch) | |
tree | 0c332298d23088759c993ab9dcfa94cd2b8b25c0 | |
parent | 6176e89c2072a3687d358ab104b7c9c5066aeadc (diff) | |
download | systemd-771fded37f4858375a1d3f5f30ffc72fdc9fbed6.tar.gz systemd-771fded37f4858375a1d3f5f30ffc72fdc9fbed6.tar.bz2 systemd-771fded37f4858375a1d3f5f30ffc72fdc9fbed6.zip |
test-path-util: add function headers
-rw-r--r-- | src/test/test-path-util.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index 413816ceb8..21ef552d46 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -25,6 +25,8 @@ static void test_path_simplify(const char *in, const char *out, const char *out_dot) { char *p; + log_info("/* %s */", __func__); + p = strdupa(in); assert_se(streq(path_simplify(p, false), out)); @@ -35,6 +37,8 @@ static void test_path_simplify(const char *in, const char *out, const char *out_ static void test_path(void) { _cleanup_close_ int fd = -1; + log_info("/* %s */", __func__); + test_path_compare("/goo", "/goo", 0); test_path_compare("/goo", "/goo", 0); test_path_compare("//goo", "/goo", 0); @@ -114,6 +118,8 @@ static void test_path(void) { static void test_path_equal_root(void) { /* Nail down the details of how path_equal("/", ...) works. */ + log_info("/* %s */", __func__); + assert_se(path_equal("/", "/")); assert_se(path_equal("/", "//")); @@ -156,6 +162,8 @@ static void test_path_equal_root(void) { static void test_find_binary(const char *self) { char *p; + log_info("/* %s */", __func__); + assert_se(find_binary("/bin/sh", &p) == 0); puts(p); assert_se(path_equal(p, "/bin/sh")); @@ -191,6 +199,8 @@ static void test_prefixes(void) { char s[PATH_MAX]; bool b; + log_info("/* %s */", __func__); + i = 0; PATH_FOREACH_PREFIX_MORE(s, "/a/b/c/d") { log_error("---%s---", s); @@ -238,6 +248,7 @@ static void test_prefixes(void) { } static void test_path_join(void) { + log_info("/* %s */", __func__); #define test_join(expected, ...) { \ _cleanup_free_ char *z = NULL; \ @@ -283,6 +294,8 @@ static void test_path_join(void) { } static void test_fsck_exists(void) { + log_info("/* %s */", __func__); + /* Ensure we use a sane default for PATH. */ unsetenv("PATH"); @@ -296,6 +309,8 @@ static void test_fsck_exists(void) { static void test_make_relative(void) { char *result; + log_info("/* %s */", __func__); + assert_se(path_make_relative("some/relative/path", "/some/path", &result) < 0); assert_se(path_make_relative("/some/path", "some/relative/path", &result) < 0); assert_se(path_make_relative("/some/dotdot/../path", "/some/path", &result) < 0); @@ -347,6 +362,8 @@ static void test_strv_resolve(void) { static void test_path_startswith(void) { const char *p; + log_info("/* %s */", __func__); + p = path_startswith("/foo/bar/barfoo/", "/foo"); assert_se(streq_ptr(p, "bar/barfoo/")); @@ -397,6 +414,8 @@ static void test_prefix_root_one(const char *r, const char *p, const char *expec } static void test_prefix_root(void) { + log_info("/* %s */", __func__); + test_prefix_root_one("/", "/foo", "/foo"); test_prefix_root_one(NULL, "/foo", "/foo"); test_prefix_root_one("", "/foo", "/foo"); @@ -418,6 +437,8 @@ static void test_prefix_root(void) { static void test_file_in_same_dir(void) { char *t; + log_info("/* %s */", __func__); + t = file_in_same_dir("/", "a"); assert_se(streq(t, "/a")); free(t); @@ -470,6 +491,8 @@ static void test_path_extract_filename_one(const char *input, const char *output } static void test_path_extract_filename(void) { + log_info("/* %s */", __func__); + test_path_extract_filename_one(NULL, NULL, -EINVAL); test_path_extract_filename_one("a/b/c", "c", 0); test_path_extract_filename_one("a/b/c/", "c", 0); @@ -502,6 +525,8 @@ static void test_filename_is_valid(void) { char foo[FILENAME_MAX+2]; int i; + log_info("/* %s */", __func__); + assert_se(!filename_is_valid("")); assert_se(!filename_is_valid("/bar/foo")); assert_se(!filename_is_valid("/")); @@ -519,6 +544,8 @@ static void test_filename_is_valid(void) { } static void test_hidden_or_backup_file(void) { + log_info("/* %s */", __func__); + assert_se(hidden_or_backup_file(".hidden")); assert_se(hidden_or_backup_file("..hidden")); assert_se(!hidden_or_backup_file("hidden.")); @@ -544,6 +571,8 @@ static void test_systemd_installation_has_version(const char *path) { const unsigned versions[] = {0, 231, PROJECT_VERSION, 999}; unsigned i; + log_info("/* %s */", __func__); + for (i = 0; i < ELEMENTSOF(versions); i++) { r = systemd_installation_has_version(path, versions[i]); assert_se(r >= 0); @@ -553,6 +582,7 @@ static void test_systemd_installation_has_version(const char *path) { } static void test_skip_dev_prefix(void) { + log_info("/* %s */", __func__); assert_se(streq(skip_dev_prefix("/"), "/")); assert_se(streq(skip_dev_prefix("/dev"), "")); @@ -568,6 +598,8 @@ static void test_skip_dev_prefix(void) { } static void test_empty_or_root(void) { + log_info("/* %s */", __func__); + assert_se(empty_or_root(NULL)); assert_se(empty_or_root("")); assert_se(empty_or_root("/")); @@ -581,6 +613,7 @@ static void test_empty_or_root(void) { } static void test_path_startswith_set(void) { + log_info("/* %s */", __func__); assert_se(streq_ptr(PATH_STARTSWITH_SET("/foo/bar", "/foo/quux", "/foo/bar", "/zzz"), "")); assert_se(streq_ptr(PATH_STARTSWITH_SET("/foo/bar", "/foo/quux", "/foo/", "/zzz"), "bar")); |