diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-12 19:27:14 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-12 19:27:14 -0500 |
commit | 9abef516f609a619b25e8f53a413a2e3df05bde8 (patch) | |
tree | 2b80767e1ad490e20e4e2de034145594173b3171 /src/test/test_dir.c | |
parent | 13455c0f1a191824d383339c9efcc3b31ecd8e6f (diff) | |
parent | bf89b089306067cffa4d2ca6b7fa7cd54790a961 (diff) | |
download | tor-9abef516f609a619b25e8f53a413a2e3df05bde8.tar.gz tor-9abef516f609a619b25e8f53a413a2e3df05bde8.zip |
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r-- | src/test/test_dir.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c index c85f7f0652..6092a5a4d0 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -5877,11 +5877,12 @@ mock_networkstatus_consensus_can_use_extra_fallbacks( return mock_networkstatus_consensus_can_use_extra_fallbacks_value; } -static int mock_any_bridge_descriptors_known_value = 0; +static int mock_num_bridges_usable_value = 0; static int -mock_any_bridge_descriptors_known(void) +mock_num_bridges_usable(int use_maybe_reachable) { - return mock_any_bridge_descriptors_known_value; + (void)use_maybe_reachable; + return mock_num_bridges_usable_value; } /* data is a 3 character nul-terminated string. @@ -5910,17 +5911,18 @@ test_dir_find_dl_schedule(void* data) } if (str[2] == 'r') { - mock_any_bridge_descriptors_known_value = 1; + /* Any positive, non-zero value should work */ + mock_num_bridges_usable_value = 2; } else { - mock_any_bridge_descriptors_known_value = 0; + mock_num_bridges_usable_value = 0; } MOCK(networkstatus_consensus_is_bootstrapping, mock_networkstatus_consensus_is_bootstrapping); MOCK(networkstatus_consensus_can_use_extra_fallbacks, mock_networkstatus_consensus_can_use_extra_fallbacks); - MOCK(any_bridge_descriptors_known, - mock_any_bridge_descriptors_known); + MOCK(num_bridges_usable, + mock_num_bridges_usable); download_status_t dls; smartlist_t server, client, server_cons, client_cons; @@ -6032,7 +6034,7 @@ test_dir_find_dl_schedule(void* data) /* client */ mock_options->ClientOnly = 1; mock_options->UseBridges = 1; - if (any_bridge_descriptors_known()) { + if (num_bridges_usable(0) > 0) { tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &bridge); } else { tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &bridge_bootstrap); @@ -6041,7 +6043,7 @@ test_dir_find_dl_schedule(void* data) done: UNMOCK(networkstatus_consensus_is_bootstrapping); UNMOCK(networkstatus_consensus_can_use_extra_fallbacks); - UNMOCK(any_bridge_descriptors_known); + UNMOCK(num_bridges_usable); UNMOCK(get_options); tor_free(mock_options); mock_options = NULL; @@ -6319,7 +6321,7 @@ struct testcase_t dir_tests[] = { DIR(download_status_schedule, 0), DIR(download_status_random_backoff, 0), DIR(download_status_random_backoff_ranges, 0), - DIR(download_status_increment, 0), + DIR(download_status_increment, TT_FORK), DIR(authdir_type_to_string, 0), DIR(conn_purpose_to_string, 0), DIR(should_use_directory_guards, 0), |