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-id128.c | |
parent | 4d5ad9d951299c905453ac8e3769dc82b0a09fb4 (diff) | |
download | systemd-4f7452a8eb7a946efea927fae017d4d661097833.tar.gz |
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-id128.c')
-rw-r--r-- | src/test/test-id128.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/test/test-id128.c b/src/test/test-id128.c index 79dc7de159..33c4f1a5ea 100644 --- a/src/test/test-id128.c +++ b/src/test/test-id128.c @@ -19,14 +19,12 @@ #define STR_WALDI "0102030405060708090a0b0c0d0e0f10" #define UUID_WALDI "01020304-0506-0708-090a-0b0c0d0e0f10" -static void test_id128(void) { +TEST(id128) { sd_id128_t id, id2; char t[SD_ID128_STRING_MAX], q[ID128_UUID_STRING_MAX]; _cleanup_free_ char *b = NULL; _cleanup_close_ int fd = -1; - log_info("/* %s */", __func__); - assert_se(sd_id128_randomize(&id) == 0); printf("random: %s\n", sd_id128_to_string(id, t)); @@ -154,12 +152,10 @@ static void test_id128(void) { assert_se(!sd_id128_equal(id, id2)); } -static void test_sd_id128_get_invocation(void) { +TEST(sd_id128_get_invocation) { sd_id128_t id; int r; - log_info("/* %s */", __func__); - /* Query the invocation ID */ r = sd_id128_get_invocation(&id); if (r < 0) @@ -168,7 +164,7 @@ static void test_sd_id128_get_invocation(void) { log_info("Invocation ID: " SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(id)); } -static void benchmark_sd_id128_get_machine_app_specific(void) { +TEST(benchmark_sd_id128_get_machine_app_specific) { unsigned iterations = slow_tests_enabled() ? 1000000 : 1000; usec_t t, q; @@ -189,12 +185,4 @@ static void benchmark_sd_id128_get_machine_app_specific(void) { log_info("%lf µs each\n", (double) q / iterations); } -int main(int argc, char *argv[]) { - test_setup_logging(LOG_INFO); - - test_id128(); - test_sd_id128_get_invocation(); - benchmark_sd_id128_get_machine_app_specific(); - - return 0; -} +DEFINE_TEST_MAIN(LOG_INFO); |