Merge branch 'ticket25996'

This commit is contained in:
Nick Mathewson 2018-05-02 08:45:35 -04:00
commit f26d6ead21
2 changed files with 16 additions and 7 deletions

5
changes/ticket25996 Normal file
View File

@ -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.

View File

@ -397,21 +397,25 @@ test_client_pick_intro(void *arg)
} SMARTLIST_FOREACH_END(ip); } SMARTLIST_FOREACH_END(ip);
/* Try to get a random intro: Should return the chosen one! */ /* Try to get a random intro: Should return the chosen one! */
/* (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); extend_info_t *ip = client_get_random_intro(&service_kp.pubkey);
tor_assert(ip); tor_assert(ip);
tt_assert(!tor_mem_is_zero((char*)ip->identity_digest, DIGEST_LEN)); 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, tt_mem_op(ip->identity_digest, OP_EQ, chosen_intro_ei->identity_digest,
DIGEST_LEN); DIGEST_LEN);
extend_info_free(ip);
}
extend_info_free(chosen_intro_ei); 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 /* Now also mark the chosen one as failed: See that we can't get any intro
points anymore. */ points anymore. */
hs_cache_client_intro_state_note(&service_kp.pubkey, hs_cache_client_intro_state_note(&service_kp.pubkey,
&chosen_intro_point->auth_key_cert->signed_key, &chosen_intro_point->auth_key_cert->signed_key,
INTRO_POINT_FAILURE_TIMEOUT); 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); tor_assert(!ip);
} }