test-networkd-address: fix clock type
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Oct 2021 07:39:55 +0000 (09:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Oct 2021 11:29:12 +0000 (13:29 +0200)
The clock to use internally is clock_boottime_or_monotonic(), but the
test used CLOCK_MONOTONIC. After one system suspend the test thus likely
starts to fail.

src/network/test-networkd-address.c

index 564c76f8483aff8881401087b844ddf621c50817..46e8369abb48022c424b8f2a29a6f2cec89dca47 100644 (file)
@@ -16,7 +16,7 @@ static void test_FORMAT_LIFETIME(void) {
 
         log_info("/* %s */", __func__);
 
-        now_usec = now(CLOCK_MONOTONIC);
+        now_usec = now(clock_boottime_or_monotonic());
 
         test_FORMAT_LIFETIME_one(now_usec, "for 0");
         test_FORMAT_LIFETIME_one(usec_add(now_usec, 2 * USEC_PER_SEC - 1), "for 1s");
@@ -25,7 +25,7 @@ static void test_FORMAT_LIFETIME(void) {
 }
 
 int main(int argc, char *argv[]) {
-        test_setup_logging(LOG_INFO);
+        test_setup_logging(LOG_DEBUG);
 
         test_FORMAT_LIFETIME();