diff options
author | Jan Janssen <medhefgo@web.de> | 2021-11-24 12:00:02 +0100 |
---|---|---|
committer | Jan Janssen <medhefgo@web.de> | 2021-11-25 15:03:06 +0100 |
commit | 4f7452a8eb7a946efea927fae017d4d661097833 (patch) | |
tree | 413778cc0fb08fbbed0890130b5ba66c90581e61 /src/test/test-glob-util.c | |
parent | test-time-util: Properly restore TZ variable (diff) | |
download | systemd-4f7452a8eb7a946efea927fae017d4d661097833.tar.xz systemd-4f7452a8eb7a946efea927fae017d4d661097833.zip |
test: Use TEST macro
This converts to TEST macro where it is trivial.
Some additional notable changes:
- simplify HAVE_LIBIDN #ifdef in test-dns-domain.c
- use saved_argc/saved_argv in test-copy.c, test-path-util.c,
test-tmpfiles.c and test-unit-file.c
Diffstat (limited to 'src/test/test-glob-util.c')
-rw-r--r-- | src/test/test-glob-util.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c index 50b4924679..ec8b74f48f 100644 --- a/src/test/test-glob-util.c +++ b/src/test/test-glob-util.c @@ -10,11 +10,10 @@ #include "glob-util.h" #include "macro.h" #include "rm-rf.h" +#include "tests.h" #include "tmpfile-util.h" -static void test_glob_exists(void) { - log_info("/* %s */", __func__); - +TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; int fd = -1; int r; @@ -36,7 +35,7 @@ static void closedir_wrapper(void* v) { (void) closedir(v); } -static void test_glob_no_dot(void) { +TEST(glob_no_dot) { char template[] = "/tmp/test-glob-util.XXXXXXX"; const char *fn; @@ -50,8 +49,6 @@ static void test_glob_no_dot(void) { int r; - log_info("/* %s */", __func__); - assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -65,15 +62,13 @@ static void test_glob_no_dot(void) { (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); } -static void test_safe_glob(void) { +TEST(safe_glob) { char template[] = "/tmp/test-glob-util.XXXXXXX"; const char *fn, *fn2, *fname; _cleanup_globfree_ glob_t g = {}; int r; - log_info("/* %s */", __func__); - assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -106,9 +101,7 @@ static void test_glob_non_glob_prefix_one(const char *path, const char *expected assert_se(streq(t, expected)); } -static void test_glob_non_glob(void) { - log_info("/* %s */", __func__); - +TEST(glob_non_glob) { test_glob_non_glob_prefix_one("/tmp/.X11-*", "/tmp/"); test_glob_non_glob_prefix_one("/tmp/*", "/tmp/"); test_glob_non_glob_prefix_one("/tmp*", "/"); @@ -120,11 +113,4 @@ static void test_glob_non_glob(void) { assert_se(glob_non_glob_prefix("?", &x) == -ENOENT); } -int main(void) { - test_glob_exists(); - test_glob_no_dot(); - test_safe_glob(); - test_glob_non_glob(); - - return 0; -} +DEFINE_TEST_MAIN(LOG_INFO); |