[tor-commits] [tor/master] In networkstatus_consensus_has_ipv6 test, use approx_time()

nickm at torproject.org nickm at torproject.org
Wed Jan 3 15:58:49 UTC 2018


commit b56ce79e6310d779762478410831a594a135c0bf
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jan 3 10:57:44 2018 -0500

    In networkstatus_consensus_has_ipv6 test, use approx_time()
    
    This may (or may not) fix up some reliability issues we've been
    seeing with this test on windows.
---
 src/test/test_dir.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 6092a5a4d..f2223ee17 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -6256,13 +6256,13 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg)
       MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
 
   /* Reasonably live */
-  mock_networkstatus->valid_until = time(NULL) - 60;
+  mock_networkstatus->valid_until = approx_time() - 60;
   has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
   tt_assert(has_ipv6);
 
   /* Not reasonably live */
-  mock_networkstatus->valid_after = time(NULL) - 24*60*60 - 3600;
-  mock_networkstatus->valid_until = time(NULL) - 24*60*60 - 60;
+  mock_networkstatus->valid_after = approx_time() - 24*60*60 - 3600;
+  mock_networkstatus->valid_until = approx_time() - 24*60*60 - 60;
   has_ipv6 = networkstatus_consensus_has_ipv6(get_options());
   tt_assert(!has_ipv6);
 
@@ -6343,7 +6343,7 @@ struct testcase_t dir_tests[] = {
   DIR(assumed_flags, 0),
   DIR(networkstatus_compute_bw_weights_v10, 0),
   DIR(platform_str, 0),
-  DIR(networkstatus_consensus_has_ipv6, 0),
+  DIR(networkstatus_consensus_has_ipv6, TT_FORK),
   END_OF_TESTCASES
 };
 



More information about the tor-commits mailing list