]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-glob-util.c
test: Use TEST macro
[thirdparty/systemd.git] / src / test / test-glob-util.c
index 50b492467915eb09216c4b82cf639d1073bd503f..ec8b74f48f3481ed1a3e92b6573176becb5d7000 100644 (file)
 #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);