diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-05-02 08:45:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-02 08:45:35 -0400 |
commit | f26d6ead21015b7ba6f7d72ebfc2ebf29da0863b (patch) | |
tree | e92e0ed57278634c40755809793f0f83fb9ef05f | |
parent | da8996d611438a1e0f9ad001f95bb78398b0ad86 (diff) | |
parent | a2b53c1d0bb759bfe039bb417281bda743655bfe (diff) | |
download | tor-f26d6ead21015b7ba6f7d72ebfc2ebf29da0863b.tar.gz tor-f26d6ead21015b7ba6f7d72ebfc2ebf29da0863b.zip |
Merge branch 'ticket25996'
-rw-r--r-- | changes/ticket25996 | 5 | ||||
-rw-r--r-- | src/test/test_hs_client.c | 18 |
2 files changed, 16 insertions, 7 deletions
diff --git a/changes/ticket25996 b/changes/ticket25996 new file mode 100644 index 0000000000..f523bc6304 --- /dev/null +++ b/changes/ticket25996 @@ -0,0 +1,5 @@ + o Minor bugfixes (testing): + - Repeat part of the test in test_client_pick_intro() a number of times, + to give it consistent coverage. Fixes bug 25996; bugfix on + 0.3.2.1-alpha. + diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index 58e12abca0..50dca588ed 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -397,21 +397,25 @@ test_client_pick_intro(void *arg) } SMARTLIST_FOREACH_END(ip); /* Try to get a random intro: Should return the chosen one! */ - extend_info_t *ip = client_get_random_intro(&service_kp.pubkey); - tor_assert(ip); - tt_assert(!tor_mem_is_zero((char*)ip->identity_digest, DIGEST_LEN)); - tt_mem_op(ip->identity_digest, OP_EQ, chosen_intro_ei->identity_digest, - DIGEST_LEN); + /* (We try several times, to make sure this behavior is consistent, and to + * cover the different cases of client_get_random_intro().) */ + for (int i = 0; i < 64; ++i) { + extend_info_t *ip = client_get_random_intro(&service_kp.pubkey); + tor_assert(ip); + tt_assert(!tor_mem_is_zero((char*)ip->identity_digest, DIGEST_LEN)); + tt_mem_op(ip->identity_digest, OP_EQ, chosen_intro_ei->identity_digest, + DIGEST_LEN); + extend_info_free(ip); + } extend_info_free(chosen_intro_ei); - extend_info_free(ip); /* Now also mark the chosen one as failed: See that we can't get any intro points anymore. */ hs_cache_client_intro_state_note(&service_kp.pubkey, &chosen_intro_point->auth_key_cert->signed_key, INTRO_POINT_FAILURE_TIMEOUT); - ip = client_get_random_intro(&service_kp.pubkey); + extend_info_t *ip = client_get_random_intro(&service_kp.pubkey); tor_assert(!ip); } |