]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
test: Update approx_time before the test starts
authorDavid Goulet <dgoulet@torproject.org>
Mon, 24 Sep 2018 13:48:28 +0000 (09:48 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 16 Oct 2018 12:03:55 +0000 (08:03 -0400)
This way we have the same time source when the IP is created and tested later.

Fixes #27810

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket27810 [new file with mode: 0644]
src/test/test_hs_service.c

diff --git a/changes/ticket27810 b/changes/ticket27810
new file mode 100644 (file)
index 0000000..119f781
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (test, hidden service v3):
+    - Make the the hs_service tests uses the same time source when creating
+      the introduction point and testing it. This helps make test work on very
+      slow system like ARM or Travis. Fixes bug 27810; bugfix on
+      0.3.2.1-alpha.
index d715f90d971f5623487db9188e445549b5cb6a6f..7972434d69664df8cc97ffd64cda59092adf6229 100644 (file)
@@ -492,6 +492,8 @@ test_helper_functions(void *arg)
   MOCK(node_get_by_id, mock_node_get_by_id);
 
   hs_service_init();
+  time_t now = time(NULL);
+  update_approx_time(now);
 
   service = helper_create_service();
 
@@ -551,7 +553,6 @@ test_helper_functions(void *arg)
 
   /* Testing can_service_launch_intro_circuit() */
   {
-    time_t now = time(NULL);
     /* Put the start of the retry period back in time, we should be allowed.
      * to launch intro circuit. */
     service->state.num_intro_circ_launched = 2;
@@ -575,7 +576,6 @@ test_helper_functions(void *arg)
 
   /* Testing intro_point_should_expire(). */
   {
-    time_t now = time(NULL);
     /* Just some basic test of the current state. */
     tt_u64_op(ip->introduce2_max, OP_GE,
               INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS);