diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-01 10:17:40 +0000 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-01 10:18:32 +0000 |
commit | 41bc83ed5187f5cb6e7243a36827fc51899652fb (patch) | |
tree | 2d56cde34a6223d81dde380bf81bdcbf9a9379c9 /src/test/test-time-util.c | |
parent | dc9849b1e568ed0c16e1b5e2c7f22e2f10ae65aa (diff) | |
download | systemd-41bc83ed5187f5cb6e7243a36827fc51899652fb.tar.gz |
test-time-util: log less verbosely
Output can always be kranked up with LOG_LEVEL=debug. But let's make less
predictable noise by default.
Diffstat (limited to 'src/test/test-time-util.c')
-rw-r--r-- | src/test/test-time-util.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c index 0ca9beeb51..6f4675aaf4 100644 --- a/src/test/test-time-util.c +++ b/src/test/test-time-util.c @@ -202,13 +202,13 @@ static void test_format_timespan_one(usec_t x, usec_t accuracy) { const char *t; usec_t y; - log_info(USEC_FMT" (at accuracy "USEC_FMT")", x, accuracy); + log_debug(USEC_FMT" (at accuracy "USEC_FMT")", x, accuracy); assert_se(t = format_timespan(l, sizeof l, x, accuracy)); - log_info(" = <%s>", t); + log_debug(" = <%s>", t); assert_se(parse_sec(t, &y) >= 0); - log_info(" = "USEC_FMT, y); + log_debug(" = "USEC_FMT, y); if (accuracy <= 0) accuracy = 1; @@ -329,11 +329,9 @@ static void test_usec_sub_signed(void) { } static void test_format_timestamp(void) { - unsigned i; - log_info("/* %s */", __func__); - for (i = 0; i < 100; i++) { + for (unsigned i = 0; i < 100; i++) { char buf[MAX(FORMAT_TIMESTAMP_MAX, FORMAT_TIMESPAN_MAX)]; usec_t x, y; @@ -341,27 +339,27 @@ static void test_format_timestamp(void) { x = x % (2147483600 * USEC_PER_SEC) + 1; assert_se(format_timestamp(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(parse_timestamp(buf, &y) >= 0); assert_se(x / USEC_PER_SEC == y / USEC_PER_SEC); assert_se(format_timestamp_style(buf, sizeof(buf), x, TIMESTAMP_UTC)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(parse_timestamp(buf, &y) >= 0); assert_se(x / USEC_PER_SEC == y / USEC_PER_SEC); assert_se(format_timestamp_style(buf, sizeof(buf), x, TIMESTAMP_US)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(parse_timestamp(buf, &y) >= 0); assert_se(x == y); assert_se(format_timestamp_style(buf, sizeof(buf), x, TIMESTAMP_US_UTC)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(parse_timestamp(buf, &y) >= 0); assert_se(x == y); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(parse_timestamp(buf, &y) >= 0); /* The two calls above will run with a slightly different local time. Make sure we are in the same @@ -385,64 +383,64 @@ static void test_format_timestamp_relative(void) { /* Years and months */ x = now(CLOCK_REALTIME) - (1*USEC_PER_YEAR + 1*USEC_PER_MONTH); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 year 1 month ago")); x = now(CLOCK_REALTIME) - (1*USEC_PER_YEAR + 2*USEC_PER_MONTH); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 year 2 months ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_YEAR + 1*USEC_PER_MONTH); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 years 1 month ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_YEAR + 2*USEC_PER_MONTH); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 years 2 months ago")); /* Months and days */ x = now(CLOCK_REALTIME) - (1*USEC_PER_MONTH + 1*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 month 1 day ago")); x = now(CLOCK_REALTIME) - (1*USEC_PER_MONTH + 2*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 month 2 days ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_MONTH + 1*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 months 1 day ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_MONTH + 2*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 months 2 days ago")); /* Weeks and days */ x = now(CLOCK_REALTIME) - (1*USEC_PER_WEEK + 1*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 week 1 day ago")); x = now(CLOCK_REALTIME) - (1*USEC_PER_WEEK + 2*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "1 week 2 days ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_WEEK + 1*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 weeks 1 day ago")); x = now(CLOCK_REALTIME) - (2*USEC_PER_WEEK + 2*USEC_PER_DAY); assert_se(format_timestamp_relative(buf, sizeof(buf), x)); - log_info("%s", buf); + log_debug("%s", buf); assert_se(streq(buf, "2 weeks 2 days ago")); } |