aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_dir.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-09 20:10:43 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-07-01 14:01:42 -0400
commit6927467bef1b5c46b85d30ac77b364ed407f6d72 (patch)
tree443f428f611c01150ba6e7eb5dd868305e0a85fb /src/test/test_dir.c
parent09ecbdd8eef02228764018250b00ae8d8b64bb97 (diff)
downloadtor-6927467bef1b5c46b85d30ac77b364ed407f6d72.tar.gz
tor-6927467bef1b5c46b85d30ac77b364ed407f6d72.zip
Refactor parameter computation and add a helper function
This patch makes us retain the intermediate list of K=V entries for the duration of computing our vote, and lets us use that list with a new function in order to look up parameters before the consensus is published. We can't actually use this function yet because of #19011: our existing code to do this doesn't actually work, and we'll need a new consensus method to start using it. Closes ticket #19012.
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r--src/test/test_dir.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index b0ae2d99c8..1f1b3002b6 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1436,6 +1436,19 @@ test_dir_measured_bw_kb_cache(void *arg)
return;
}
+static char *
+my_dirvote_compute_params(smartlist_t *votes, int method, int total_authorities)
+{
+ smartlist_t *s = dirvote_compute_params(votes, method, total_authorities);
+ tor_assert(s);
+ char *res = smartlist_join_strings(s, " ", 0, NULL);
+ SMARTLIST_FOREACH(s, char *, cp, tor_free(cp));
+ smartlist_free(s);
+ return res;
+}
+
+#define dirvote_compute_params my_dirvote_compute_params
+
static void
test_dir_param_voting(void *arg)
{
@@ -4298,6 +4311,7 @@ struct testcase_t dir_tests[] = {
DIR_LEGACY(measured_bw_kb),
DIR_LEGACY(measured_bw_kb_cache),
DIR_LEGACY(param_voting),
+ DIR(param_voting_lookup, 0),
DIR_LEGACY(v3_networkstatus),
DIR(random_weighted, 0),
DIR(scale_bw, 0),