diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-03-13 10:37:37 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-03-13 10:37:37 -0400 |
commit | cab93930de8888981af63f157f71721ac233db34 (patch) | |
tree | ab2844d3f72bca85adcdc5b203ce3f7d55c3ebc1 /src/test/test_circuitpadding.c | |
parent | 26b0d95397987a4458cc8afc4142b70f9f797870 (diff) | |
parent | 8b64ff7a3f2d9eb0837248a6c9b0e8b438374369 (diff) | |
download | tor-cab93930de8888981af63f157f71721ac233db34.tar.gz tor-cab93930de8888981af63f157f71721ac233db34.zip |
Merge branch 'pr_722_squashed'
Diffstat (limited to 'src/test/test_circuitpadding.c')
-rw-r--r-- | src/test/test_circuitpadding.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c index 1976e54bb9..a2381023ca 100644 --- a/src/test/test_circuitpadding.c +++ b/src/test/test_circuitpadding.c @@ -2097,6 +2097,7 @@ helper_circpad_circ_distribution_machine_setup(int min, int max) circpad_state_t *zero_st = &circ_client_machine.states[0]; zero_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 1; zero_st->iat_dist.type = CIRCPAD_DIST_UNIFORM; + /* param2 is upper bound, param1 is lower */ zero_st->iat_dist.param1 = min; zero_st->iat_dist.param2 = max; zero_st->dist_added_shift_usec = min; @@ -2105,48 +2106,50 @@ helper_circpad_circ_distribution_machine_setup(int min, int max) circpad_state_t *first_st = &circ_client_machine.states[1]; first_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 2; first_st->iat_dist.type = CIRCPAD_DIST_LOGISTIC; - first_st->iat_dist.param1 = min; - first_st->iat_dist.param2 = max; + /* param1 is Mu, param2 is sigma. */ + first_st->iat_dist.param1 = 9; + first_st->iat_dist.param2 = 3; first_st->dist_added_shift_usec = min; first_st->dist_max_sample_usec = max; circpad_state_t *second_st = &circ_client_machine.states[2]; second_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 3; second_st->iat_dist.type = CIRCPAD_DIST_LOG_LOGISTIC; - second_st->iat_dist.param1 = min; - second_st->iat_dist.param2 = max; + /* param1 is Alpha, param2 is 1.0/Beta */ + second_st->iat_dist.param1 = 1; + second_st->iat_dist.param2 = 0.5; second_st->dist_added_shift_usec = min; second_st->dist_max_sample_usec = max; circpad_state_t *third_st = &circ_client_machine.states[3]; third_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 4; third_st->iat_dist.type = CIRCPAD_DIST_GEOMETRIC; - third_st->iat_dist.param1 = min; - third_st->iat_dist.param2 = max; + /* param1 is 'p' (success probability) */ + third_st->iat_dist.param1 = 0.2; third_st->dist_added_shift_usec = min; third_st->dist_max_sample_usec = max; circpad_state_t *fourth_st = &circ_client_machine.states[4]; fourth_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 5; fourth_st->iat_dist.type = CIRCPAD_DIST_WEIBULL; - fourth_st->iat_dist.param1 = min; - fourth_st->iat_dist.param2 = max; + /* param1 is k, param2 is Lambda */ + fourth_st->iat_dist.param1 = 1.5; + fourth_st->iat_dist.param2 = 1; fourth_st->dist_added_shift_usec = min; fourth_st->dist_max_sample_usec = max; circpad_state_t *fifth_st = &circ_client_machine.states[5]; fifth_st->next_state[CIRCPAD_EVENT_NONPADDING_RECV] = 6; fifth_st->iat_dist.type = CIRCPAD_DIST_PARETO; - fifth_st->iat_dist.param1 = min; - fifth_st->iat_dist.param2 = max; + /* param1 is sigma, param2 is xi */ + fifth_st->iat_dist.param1 = 1; + fifth_st->iat_dist.param2 = 5; fifth_st->dist_added_shift_usec = min; fifth_st->dist_max_sample_usec = max; } /** Simple test that the padding delays sampled from a uniform distribution * actually faill within the uniform distribution range. */ -/* TODO: Upgrade this test so that each state tests a different prob - * distribution */ static void test_circuitpadding_sample_distribution(void *arg) { @@ -2160,8 +2163,7 @@ test_circuitpadding_sample_distribution(void *arg) MOCK(circpad_machine_schedule_padding, circpad_machine_schedule_padding_mock); - /* Initialize a machine with multiple probability distributions that should - * return values between 0 and 5 */ + /* Initialize a machine with multiple probability distributions */ circpad_machines_init(); helper_circpad_circ_distribution_machine_setup(0, 10); |