diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-06 21:29:55 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-06 21:29:55 -0500 |
commit | 2b6bf07dd23bb467099d213c97b3875c5e453491 (patch) | |
tree | 2127e24f28714b48f6c00e92eaec351bcb57e5d5 /src/test | |
parent | f4336098941f94d23f2f6c79bc8d055a0907c392 (diff) |
Get rid of our reimplementation of basename
The only problem is that libgen.h #defines basename to point to it's
own broken implementation instead of the GNU one. This can be fixed
by #undefining basename.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-install.c | 18 | ||||
-rw-r--r-- | src/test/test-path-util.c | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/test/test-install.c b/src/test/test-install.c index 2c1b9efcb8..2087d52994 100644 --- a/src/test/test-install.c +++ b/src/test/test-install.c @@ -58,7 +58,7 @@ int main(int argc, char* argv[]) { HASHMAP_FOREACH(p, h, i) { UnitFileState s; - s = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(p->path)); + s = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(p->path)); assert_se(p->state == s); @@ -176,7 +176,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_ENABLED); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == UNIT_FILE_ENABLED); log_error("disable files2"); changes = NULL; @@ -188,7 +188,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == _UNIT_FILE_STATE_INVALID); log_error("link files2"); changes = NULL; @@ -200,7 +200,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_LINKED); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == UNIT_FILE_LINKED); log_error("disable files2"); changes = NULL; @@ -212,7 +212,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == _UNIT_FILE_STATE_INVALID); log_error("link files2"); changes = NULL; @@ -224,7 +224,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_LINKED); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == UNIT_FILE_LINKED); log_error("reenable files2"); changes = NULL; @@ -236,7 +236,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == UNIT_FILE_ENABLED); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == UNIT_FILE_ENABLED); log_error("disable files2"); changes = NULL; @@ -248,7 +248,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files2[0])) == _UNIT_FILE_STATE_INVALID); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0])) == _UNIT_FILE_STATE_INVALID); log_error("preset files"); changes = NULL; n_changes = 0; @@ -259,7 +259,7 @@ int main(int argc, char* argv[]) { dump_changes(changes, n_changes); unit_file_changes_free(changes, n_changes); - assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, path_get_file_name(files[0])) == UNIT_FILE_ENABLED); + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files[0])) == UNIT_FILE_ENABLED); return 0; } diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c index ed3b315a61..bec2a83611 100644 --- a/src/test/test-path-util.c +++ b/src/test/test-path-util.c @@ -50,10 +50,10 @@ static void test_path(void) { assert_se(is_path("a/b")); assert_se(!is_path(".")); - assert_se(streq(path_get_file_name("./aa/bb/../file.da."), "file.da.")); - assert_se(streq(path_get_file_name("/aa///.file"), ".file")); - assert_se(streq(path_get_file_name("/aa///file..."), "file...")); - assert_se(streq(path_get_file_name("file.../"), "")); + assert_se(streq(basename("./aa/bb/../file.da."), "file.da.")); + assert_se(streq(basename("/aa///.file"), ".file")); + assert_se(streq(basename("/aa///file..."), "file...")); + assert_se(streq(basename("file.../"), "")); #define test_parent(x, y) { \ char _cleanup_free_ *z = NULL; \ |