]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-date: add more logging on error
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 17 Sep 2017 07:50:52 +0000 (09:50 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 17 Sep 2017 09:57:00 +0000 (11:57 +0200)
src/test/test-date.c

index 5cbb8bcc3ce0446ecdd35fe0550b8c08fbba3434..c09d61539648041f3c4f57c0097301a4d59a5f64 100644 (file)
@@ -33,6 +33,12 @@ static void test_should_pass(const char *p) {
         log_info("\"%s\" → \"%s\"", p, buf);
 
         assert_se(parse_timestamp(buf, &q) >= 0);
+        if (q != t) {
+                char tmp[FORMAT_TIMESTAMP_MAX];
+
+                log_error("round-trip failed: \"%s\" → \"%s\"",
+                          buf, format_timestamp_us(tmp, sizeof(tmp), q));
+        }
         assert_se(q == t);
 
         assert_se(format_timestamp_relative(buf_relative, sizeof(buf_relative), t));
@@ -77,6 +83,10 @@ static void test_one_noutc(const char *p) {
 }
 
 int main(int argc, char *argv[]) {
+        log_set_max_level(LOG_DEBUG);
+        log_parse_environment();
+        log_open();
+
         test_one("17:41");
         test_one("18:42:44");
         test_one("18:42:44.0");