aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-21 17:02:51 -0500
committerNick Mathewson <nickm@torproject.org>2016-11-30 14:42:53 -0500
commit8dc6048c02806e8d30740c5a2a0dd11476909ce4 (patch)
tree25012412136c445f5148d80cfefa16f4f2f9ecd9 /src/test/test_entrynodes.c
parent238828c92b1cc186577e44490caf4fa3870e724d (diff)
downloadtor-8dc6048c02806e8d30740c5a2a0dd11476909ce4.tar.gz
tor-8dc6048c02806e8d30740c5a2a0dd11476909ce4.zip
Add an (as yet) unused UseDeprecatedGuardAlgorithm_ option.
I expect we'll be ripping this out somewhere in 0.3.0, but let's keep it around for a little while in case it turns out to be the only way to avert disaster?
Diffstat (limited to 'src/test/test_entrynodes.c')
-rw-r--r--src/test/test_entrynodes.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 8e90b000fc..65118594ea 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -212,6 +212,7 @@ test_choose_random_entry_no_guards(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientPreferIPv6ORPort = 0;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
/* Try to pick an entry even though none of our routers are guards. */
chosen_entry = choose_random_entry(NULL);
@@ -236,6 +237,7 @@ test_choose_random_entry_no_guards(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 0;
mocked_options.ClientPreferIPv6ORPort = 0;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
@@ -248,6 +250,7 @@ test_choose_random_entry_no_guards(void *arg)
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientUseIPv6 = 1;
mocked_options.ClientPreferIPv6ORPort = 1;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
tt_assert(chosen_entry);
@@ -257,6 +260,7 @@ test_choose_random_entry_no_guards(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientPreferIPv6ORPort = -1;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
tt_assert(chosen_entry);
@@ -295,6 +299,7 @@ test_choose_random_entry_one_possible_guard(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientPreferIPv6ORPort = 0;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
/* Pick an entry. Make sure we pick the node we marked as guard. */
chosen_entry = choose_random_entry(NULL);
@@ -315,6 +320,7 @@ test_choose_random_entry_one_possible_guard(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 0;
mocked_options.ClientPreferIPv6ORPort = 0;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
@@ -327,6 +333,7 @@ test_choose_random_entry_one_possible_guard(void *arg)
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientUseIPv6 = 1;
mocked_options.ClientPreferIPv6ORPort = 1;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
@@ -339,6 +346,7 @@ test_choose_random_entry_one_possible_guard(void *arg)
memset(&mocked_options, 0, sizeof(mocked_options));
mocked_options.ClientUseIPv4 = 1;
mocked_options.ClientPreferIPv6ORPort = -1;
+ mocked_options.UseDeprecatedGuardAlgorithm = 1;
chosen_entry = choose_random_entry(NULL);
@@ -701,6 +709,7 @@ static void
test_entry_guards_set_from_config(void *arg)
{
or_options_t *options = get_options_mutable();
+ options->UseDeprecatedGuardAlgorithm = 1;
guard_selection_t *gs = get_guard_selection_info();
const smartlist_t *all_entry_guards =
get_entry_guards_for_guard_selection(gs);
@@ -2177,7 +2186,7 @@ struct testcase_t entrynodes_tests[] = {
TT_FORK, NULL, NULL },
{ "choose_random_entry_no_guards", test_choose_random_entry_no_guards,
TT_FORK, &fake_network, NULL },
- { "choose_random_entry_one_possibleguard",
+ { "choose_random_entry_one_possible_guard",
test_choose_random_entry_one_possible_guard,
TT_FORK, &fake_network, NULL },
{ "populate_live_entry_guards_1guard",