From 0545f64d24e04a44fc44e67cd23f631fa5b01135 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Wed, 7 Mar 2018 23:50:00 +0000 Subject: [PATCH 1/2] test: Increase time limit for IP creation in an HS test. This should avoid most intermittent test failures on developer and CI machines, but there could (and probably should) be a more elegant solution. Also, this test was testing that the IP was created and its expiration time was set to a time greater than or equal to `now+INTRO_POINT_LIFETIME_MIN_SECONDS+5`: /* Time to expire MUST also be in that range. We add 5 seconds because * there could be a gap between setting now and the time taken in * service_intro_point_new. On ARM, it can be surprisingly slow... */ tt_u64_op(ip->time_to_expire, OP_GE, now + INTRO_POINT_LIFETIME_MIN_SECONDS + 5); However, this appears to be a typo, since, according to the comment above it, adding five seconds was done because the IP creation can be slow on some systems. But the five seconds is added to the *minimum* time we're comparing against, and so it actually functions to make this test *more* likely to fail on slower systems. (It should either subtract five seconds, or instead add it to time_to_expire.) * FIXES #25450: https://bugs.torproject.org/25450 --- changes/bug25450 | 9 +++++++++ src/test/test_hs_service.c | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 changes/bug25450 diff --git a/changes/bug25450 b/changes/bug25450 new file mode 100644 index 000000000..d6127a5d2 --- /dev/null +++ b/changes/bug25450 @@ -0,0 +1,9 @@ + o Minor bugfixes (testing): + - Avoid intermittent test failures due to relying on hidden service + introductory point creation within 5 seconds of real clock time. The + time limit for the test has been increased to 500 seconds, which may + still result in intermittent failures (e.g. if the system doing the + testing enters sleep/hibernation or experiences some other clock jump). + However, this should elliminate test failures currently happening on + developer and CI systems. Fixes bug 25450 (shoddily); bugfix on + 0.3.1.3-alpha. diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index 8407eccfa..4f5e8ba45 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -413,13 +413,14 @@ test_service_intro_point(void *arg) INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS); tt_u64_op(ip->introduce2_max, OP_LE, INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS); - /* Time to expire MUST also be in that range. We add 5 seconds because - * there could be a gap between setting now and the time taken in - * service_intro_point_new. On ARM, it can be surprisingly slow... */ + /* Time to expire MUST also be in that range. We subtract 500 seconds + * because there could be a gap between setting now and the time taken in + * service_intro_point_new. On ARM and other older CPUs, it can be + * surprisingly slow... */ tt_u64_op(ip->time_to_expire, OP_GE, - now + INTRO_POINT_LIFETIME_MIN_SECONDS + 5); + now + INTRO_POINT_LIFETIME_MIN_SECONDS - 500); tt_u64_op(ip->time_to_expire, OP_LE, - now + INTRO_POINT_LIFETIME_MAX_SECONDS + 5); + now + INTRO_POINT_LIFETIME_MAX_SECONDS - 500); tt_assert(ip->replay_cache); tt_assert(ip->base.link_specifiers); /* By default, this is NOT a legacy object. */ From 9191d962f9f6226ae2ded6006571b1e03ab7970f Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Thu, 8 Mar 2018 00:47:34 +0000 Subject: [PATCH 2/2] changes: Fix changes file for bug25450. It didn't like me insulting my patch, I guess. --- changes/bug25450 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/changes/bug25450 b/changes/bug25450 index d6127a5d2..ae14135a7 100644 --- a/changes/bug25450 +++ b/changes/bug25450 @@ -5,5 +5,4 @@ still result in intermittent failures (e.g. if the system doing the testing enters sleep/hibernation or experiences some other clock jump). However, this should elliminate test failures currently happening on - developer and CI systems. Fixes bug 25450 (shoddily); bugfix on - 0.3.1.3-alpha. + developer and CI systems. Fixes bug 25450; bugfix on 0.3.1.3-alpha.