]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Stop log_heartbeat test from failing in timezones with non-integer offsets
authorFergus Dall <fergus@beware.dropbear.id.au>
Tue, 12 Jan 2016 07:39:16 +0000 (18:09 +1030)
committerFergus Dall <fergus@beware.dropbear.id.au>
Tue, 12 Jan 2016 11:31:46 +0000 (22:01 +1030)
Instead of comparing the end of the time string against a constant,
compare it to the output of format_local_iso_time when given the
correct input.

changes/log_heartbeat_test [new file with mode: 0644]
src/test/test_status.c

diff --git a/changes/log_heartbeat_test b/changes/log_heartbeat_test
new file mode 100644 (file)
index 0000000..f0d143b
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfix (testing):
+    - The test for log_heartbeat was incorrectly failing in timezones
+      with non-integer offsets. Instead of comparing the end of the
+      time string against a constant, compare it to the output of
+      format_local_iso_time when given the correct input.
index 57d69b1cc3b3408fb94c637204a37d3ed5e87b68..84a0f6c0241be7c6ecc8117c0e35df2bbd494c22 100644 (file)
@@ -714,9 +714,11 @@ NS(logv)(int severity, log_domain_mask_t domain,
       tt_str_op(va_arg(ap, char *), OP_EQ, "0 kB");  /* acc_used */
       tt_str_op(va_arg(ap, char *), OP_EQ, "0 kB");  /* acc_max */
       tt_str_op(va_arg(ap, char *), OP_EQ, "max");  /* acc_rule */
-      /* format_local_iso_time uses local tz, just check mins and secs. */
-      tt_ptr_op(strstr(va_arg(ap, char *), ":01:00"),
-                OP_NE, NULL); /* end_buf */
+      /* format_local_iso_time uses local tz, so we can't just compare
+       * the string against a constant */
+      char datetime[ISO_TIME_LEN+1];
+      format_local_iso_time(datetime, 60);
+      tt_str_op(va_arg(ap, char *), OP_EQ, datetime); /* end_buf */
       tt_str_op(va_arg(ap, char *), OP_EQ, "0:01 hours");   /* remaining */
       break;
     case 2: