mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Ensure that make check-spaces
is happy.
The `test-operator-cleanup` patch, and related coccinelle patches, don't do any checks for line length. This patch fixes the line length issues caused by the previous commits.
This commit is contained in:
parent
011d94fb11
commit
77b92c2214
@ -571,15 +571,21 @@ test_rend_fns(void *arg)
|
|||||||
intro->intro_key = crypto_pk_dup_key(pk2);
|
intro->intro_key = crypto_pk_dup_key(pk2);
|
||||||
smartlist_add(generated->intro_nodes, intro);
|
smartlist_add(generated->intro_nodes, intro);
|
||||||
}
|
}
|
||||||
tt_int_op(rend_encode_v2_descriptors(descs, generated, now, 0, REND_NO_AUTH, NULL, NULL),
|
int rv = rend_encode_v2_descriptors(descs, generated, now, 0,
|
||||||
OP_GT, 0);
|
REND_NO_AUTH, NULL, NULL);
|
||||||
tt_int_op(rend_compute_v2_desc_id(computed_desc_id, service_id_base32, NULL, now, 0),
|
tt_int_op(rv, OP_GT, 0);
|
||||||
OP_EQ, 0);
|
rv = rend_compute_v2_desc_id(computed_desc_id, service_id_base32, NULL,
|
||||||
|
now, 0);
|
||||||
|
tt_int_op(rv, OP_EQ, 0);
|
||||||
tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
|
tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
|
||||||
smartlist_get(descs, 0))->desc_id, OP_EQ,
|
smartlist_get(descs, 0))->desc_id, OP_EQ,
|
||||||
computed_desc_id, DIGEST_LEN);
|
computed_desc_id, DIGEST_LEN);
|
||||||
tt_int_op(rend_parse_v2_service_descriptor(&parsed, parsed_desc_id, &intro_points_encrypted, &intro_points_size, &encoded_size, &next_desc, ((rend_encoded_v2_service_descriptor_t *)smartlist_get(descs, 0))->desc_str, 1),
|
rv = rend_parse_v2_service_descriptor(&parsed, parsed_desc_id,
|
||||||
OP_EQ, 0);
|
&intro_points_encrypted, &intro_points_size, &encoded_size,
|
||||||
|
&next_desc,
|
||||||
|
((rend_encoded_v2_service_descriptor_t *)smartlist_get(descs, 0))
|
||||||
|
->desc_str, 1);
|
||||||
|
tt_int_op(rv, OP_EQ, 0);
|
||||||
tt_assert(parsed);
|
tt_assert(parsed);
|
||||||
tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
|
tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
|
||||||
smartlist_get(descs, 0))->desc_id,OP_EQ, parsed_desc_id, DIGEST_LEN);
|
smartlist_get(descs, 0))->desc_id,OP_EQ, parsed_desc_id, DIGEST_LEN);
|
||||||
|
@ -603,7 +603,8 @@ test_channel_dumpstats(void *arg)
|
|||||||
chan_test_cell_handler,
|
chan_test_cell_handler,
|
||||||
chan_test_var_cell_handler);
|
chan_test_var_cell_handler);
|
||||||
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
||||||
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ, chan_test_var_cell_handler);
|
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ,
|
||||||
|
chan_test_var_cell_handler);
|
||||||
cell = tor_malloc_zero(sizeof(cell_t));
|
cell = tor_malloc_zero(sizeof(cell_t));
|
||||||
make_fake_cell(cell);
|
make_fake_cell(cell);
|
||||||
old_count = test_chan_fixed_cells_recved;
|
old_count = test_chan_fixed_cells_recved;
|
||||||
@ -804,7 +805,8 @@ test_channel_incoming(void *arg)
|
|||||||
chan_test_var_cell_handler);
|
chan_test_var_cell_handler);
|
||||||
/* Test cell handler getters */
|
/* Test cell handler getters */
|
||||||
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
||||||
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ, chan_test_var_cell_handler);
|
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ,
|
||||||
|
chan_test_var_cell_handler);
|
||||||
|
|
||||||
/* Try to register it */
|
/* Try to register it */
|
||||||
channel_register(ch);
|
channel_register(ch);
|
||||||
@ -915,7 +917,8 @@ test_channel_lifecycle(void *arg)
|
|||||||
tt_assert(ch2->registered);
|
tt_assert(ch2->registered);
|
||||||
|
|
||||||
/* Check counters */
|
/* Check counters */
|
||||||
tt_int_op(test_doesnt_want_writes_count, OP_EQ, init_doesnt_want_writes_count);
|
tt_int_op(test_doesnt_want_writes_count, OP_EQ,
|
||||||
|
init_doesnt_want_writes_count);
|
||||||
tt_int_op(test_releases_count, OP_EQ, init_releases_count);
|
tt_int_op(test_releases_count, OP_EQ, init_releases_count);
|
||||||
|
|
||||||
/* Move ch1 to MAINT */
|
/* Move ch1 to MAINT */
|
||||||
@ -1495,7 +1498,8 @@ test_channel_queue_incoming(void *arg)
|
|||||||
chan_test_cell_handler,
|
chan_test_cell_handler,
|
||||||
chan_test_var_cell_handler);
|
chan_test_var_cell_handler);
|
||||||
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
tt_ptr_op(channel_get_cell_handler(ch), OP_EQ, chan_test_cell_handler);
|
||||||
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ, chan_test_var_cell_handler);
|
tt_ptr_op(channel_get_var_cell_handler(ch), OP_EQ,
|
||||||
|
chan_test_var_cell_handler);
|
||||||
|
|
||||||
/* Assert cells were received */
|
/* Assert cells were received */
|
||||||
tt_int_op(test_chan_fixed_cells_recved, OP_EQ, old_fixed_count + 1);
|
tt_int_op(test_chan_fixed_cells_recved, OP_EQ, old_fixed_count + 1);
|
||||||
@ -1578,7 +1582,8 @@ test_channel_queue_size(void *arg)
|
|||||||
|
|
||||||
/* Now check chan_test_num_cells_writeable() again */
|
/* Now check chan_test_num_cells_writeable() again */
|
||||||
n = channel_num_cells_writeable(ch);
|
n = channel_num_cells_writeable(ch);
|
||||||
tt_int_op(n, OP_EQ, 0); /* Should return 0 since we're in CHANNEL_STATE_MAINT */
|
/* Should return 0 since we're in CHANNEL_STATE_MAINT */
|
||||||
|
tt_int_op(n, OP_EQ, 0);
|
||||||
|
|
||||||
/* Update queue size estimates */
|
/* Update queue size estimates */
|
||||||
channel_update_xmit_queue_size(ch);
|
channel_update_xmit_queue_size(ch);
|
||||||
|
@ -165,7 +165,8 @@ test_needs_exit_circuits_ret_false_for_predicted_ports_and_path(void *arg)
|
|||||||
int needs_capacity = 0;
|
int needs_capacity = 0;
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
tt_int_op(0, OP_EQ, needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
tt_int_op(0, OP_EQ,
|
||||||
|
needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
UNMOCK(circuit_all_predicted_ports_handled);
|
UNMOCK(circuit_all_predicted_ports_handled);
|
||||||
@ -183,7 +184,8 @@ test_needs_exit_circuits_ret_false_for_non_exit_consensus_path(void *arg)
|
|||||||
MOCK(router_have_consensus_path, mock_router_have_unknown_consensus_path);
|
MOCK(router_have_consensus_path, mock_router_have_unknown_consensus_path);
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
tt_int_op(0, OP_EQ, needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
tt_int_op(0, OP_EQ,
|
||||||
|
needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
UNMOCK(circuit_all_predicted_ports_handled);
|
UNMOCK(circuit_all_predicted_ports_handled);
|
||||||
@ -202,7 +204,8 @@ test_needs_exit_circuits_ret_true_for_predicted_ports_and_path(void *arg)
|
|||||||
MOCK(router_have_consensus_path, mock_router_have_exit_consensus_path);
|
MOCK(router_have_consensus_path, mock_router_have_exit_consensus_path);
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
tt_int_op(1, OP_EQ, needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
tt_int_op(1, OP_EQ,
|
||||||
|
needs_exit_circuits(now, &needs_uptime, &needs_capacity));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
UNMOCK(circuit_all_predicted_ports_handled);
|
UNMOCK(circuit_all_predicted_ports_handled);
|
||||||
|
@ -540,22 +540,31 @@ test_conn_get_rsrc(void *arg)
|
|||||||
TEST_CONN_RSRC_2,
|
TEST_CONN_RSRC_2,
|
||||||
!TEST_CONN_STATE));
|
!TEST_CONN_STATE));
|
||||||
|
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(conn->base_.purpose, conn->requested_resource),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
conn->base_.purpose, conn->requested_resource),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(!conn->base_.purpose, ""),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
!conn->base_.purpose, ""),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
tt_int_op(connection_dir_count_by_purpose_resource_and_state(conn->base_.purpose, conn->requested_resource, conn->base_.state),
|
tt_int_op(connection_dir_count_by_purpose_resource_and_state(
|
||||||
|
conn->base_.purpose, conn->requested_resource,
|
||||||
|
conn->base_.state),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_resource_and_state(TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC, TEST_CONN_STATE),
|
tt_int_op(connection_dir_count_by_purpose_resource_and_state(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC, TEST_CONN_STATE),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_resource_and_state(!conn->base_.purpose, "", !conn->base_.state),
|
tt_int_op(connection_dir_count_by_purpose_resource_and_state(
|
||||||
|
!conn->base_.purpose, "", !conn->base_.state),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_resource_and_state(!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2, !TEST_CONN_STATE),
|
tt_int_op(connection_dir_count_by_purpose_resource_and_state(
|
||||||
|
!TEST_CONN_RSRC_PURPOSE, TEST_CONN_RSRC_2, !TEST_CONN_STATE),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@ -585,9 +594,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* one connection, not downloading */
|
/* one connection, not downloading */
|
||||||
@ -595,9 +606,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* one connection, downloading but not linked (not possible on a client,
|
/* one connection, downloading but not linked (not possible on a client,
|
||||||
@ -606,9 +619,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* one connection, downloading and linked, but not yet attached */
|
/* one connection, downloading and linked, but not yet attached */
|
||||||
@ -617,9 +632,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* one connection, downloading and linked and attached */
|
/* one connection, downloading and linked and attached */
|
||||||
@ -627,9 +644,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* one connection, linked and attached but not downloading */
|
/* one connection, linked and attached but not downloading */
|
||||||
@ -637,9 +656,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* two connections, both not downloading */
|
/* two connections, both not downloading */
|
||||||
@ -647,9 +668,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 2);
|
OP_EQ, 2);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* two connections, one downloading */
|
/* two connections, one downloading */
|
||||||
@ -657,9 +680,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 2);
|
OP_EQ, 2);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
conn->base_.state = TEST_CONN_STATE;
|
conn->base_.state = TEST_CONN_STATE;
|
||||||
|
|
||||||
@ -669,9 +694,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 0);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* more connections, one downloading */
|
/* more connections, one downloading */
|
||||||
@ -679,9 +706,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* more connections, two downloading (should never happen, but needs
|
/* more connections, two downloading (should never happen, but needs
|
||||||
@ -693,9 +722,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
conn->base_.state = TEST_CONN_STATE;
|
conn->base_.state = TEST_CONN_STATE;
|
||||||
|
|
||||||
@ -703,9 +734,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* a connection for the other flavor (could happen if a client is set to
|
/* a connection for the other flavor (could happen if a client is set to
|
||||||
@ -715,9 +748,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
0);
|
0);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
/* a connection for the other flavor (could happen if a client is set to
|
/* a connection for the other flavor (could happen if a client is set to
|
||||||
@ -730,9 +765,11 @@ test_conn_download_status(void *arg)
|
|||||||
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
tt_int_op(networkstatus_consensus_is_already_downloading(res), OP_EQ, 1);
|
||||||
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
tt_int_op(networkstatus_consensus_is_already_downloading(other_res), OP_EQ,
|
||||||
1);
|
1);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, res),
|
||||||
OP_EQ, 3);
|
OP_EQ, 3);
|
||||||
tt_int_op(connection_dir_count_by_purpose_and_resource(TEST_CONN_RSRC_PURPOSE, other_res),
|
tt_int_op(connection_dir_count_by_purpose_and_resource(
|
||||||
|
TEST_CONN_RSRC_PURPOSE, other_res),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -294,7 +294,8 @@ test_dir_formats(void *arg)
|
|||||||
strlcat(buf2, "master-key-ed25519 ", sizeof(buf2));
|
strlcat(buf2, "master-key-ed25519 ", sizeof(buf2));
|
||||||
{
|
{
|
||||||
char k[ED25519_BASE64_LEN+1];
|
char k[ED25519_BASE64_LEN+1];
|
||||||
tt_int_op(ed25519_public_to_base64(k, &r2->cache_info.signing_key_cert->signing_key),
|
tt_int_op(ed25519_public_to_base64(k,
|
||||||
|
&r2->cache_info.signing_key_cert->signing_key),
|
||||||
OP_GE, 0);
|
OP_GE, 0);
|
||||||
strlcat(buf2, k, sizeof(buf2));
|
strlcat(buf2, k, sizeof(buf2));
|
||||||
strlcat(buf2, "\n", sizeof(buf2));
|
strlcat(buf2, "\n", sizeof(buf2));
|
||||||
@ -3713,8 +3714,9 @@ test_dir_purpose_needs_anonymity_returns_true_for_bridges(void *arg)
|
|||||||
tt_int_op(1, OP_EQ, purpose_needs_anonymity(0, ROUTER_PURPOSE_BRIDGE, NULL));
|
tt_int_op(1, OP_EQ, purpose_needs_anonymity(0, ROUTER_PURPOSE_BRIDGE, NULL));
|
||||||
tt_int_op(1, OP_EQ, purpose_needs_anonymity(0, ROUTER_PURPOSE_BRIDGE,
|
tt_int_op(1, OP_EQ, purpose_needs_anonymity(0, ROUTER_PURPOSE_BRIDGE,
|
||||||
"foobar"));
|
"foobar"));
|
||||||
tt_int_op(1, OP_EQ, purpose_needs_anonymity(DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2,
|
tt_int_op(1, OP_EQ,
|
||||||
ROUTER_PURPOSE_BRIDGE, NULL));
|
purpose_needs_anonymity(DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2,
|
||||||
|
ROUTER_PURPOSE_BRIDGE, NULL));
|
||||||
done: ;
|
done: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3750,7 +3752,8 @@ test_dir_purpose_needs_anonymity_ret_false_for_non_sensitive_conn(void *arg)
|
|||||||
|
|
||||||
tt_int_op(0, OP_EQ, purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_DIR,
|
tt_int_op(0, OP_EQ, purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_DIR,
|
||||||
ROUTER_PURPOSE_GENERAL, NULL));
|
ROUTER_PURPOSE_GENERAL, NULL));
|
||||||
tt_int_op(0, OP_EQ, purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_VOTE, 0, NULL));
|
tt_int_op(0, OP_EQ,
|
||||||
|
purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_VOTE, 0, NULL));
|
||||||
tt_int_op(0, OP_EQ,
|
tt_int_op(0, OP_EQ,
|
||||||
purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_SIGNATURES, 0, NULL));
|
purpose_needs_anonymity(DIR_PURPOSE_UPLOAD_SIGNATURES, 0, NULL));
|
||||||
tt_int_op(0, OP_EQ,
|
tt_int_op(0, OP_EQ,
|
||||||
@ -4319,11 +4322,14 @@ test_dir_download_status_increment(void *arg)
|
|||||||
dls_failure.next_attempt_at = current_time + delay0;
|
dls_failure.next_attempt_at = current_time + delay0;
|
||||||
|
|
||||||
/* check that a reset schedule becomes ready at the right time */
|
/* check that a reset schedule becomes ready at the right time */
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0 - 1, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay0 - 1, 1),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay0, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay0 + 1, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay0 + 1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
/* Check that a failure increment works */
|
/* Check that a failure increment works */
|
||||||
@ -4336,15 +4342,19 @@ test_dir_download_status_increment(void *arg)
|
|||||||
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
||||||
|
|
||||||
/* check that an incremented schedule becomes ready at the right time */
|
/* check that an incremented schedule becomes ready at the right time */
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 - 1, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay1 - 1, 1),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 + 1, 1),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay1 + 1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
/* check that a schedule isn't ready if it's had too many failures */
|
/* check that a schedule isn't ready if it's had too many failures */
|
||||||
tt_int_op(download_status_is_ready(&dls_failure, current_time + delay1 + 10, 0),
|
tt_int_op(download_status_is_ready(&dls_failure,
|
||||||
|
current_time + delay1 + 10, 0),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* Check that failure increments do happen on 503 for clients, and
|
/* Check that failure increments do happen on 503 for clients, and
|
||||||
@ -4440,11 +4450,14 @@ test_dir_download_status_increment(void *arg)
|
|||||||
dls_attempt.next_attempt_at = current_time + delay0;
|
dls_attempt.next_attempt_at = current_time + delay0;
|
||||||
|
|
||||||
/* check that a reset schedule becomes ready at the right time */
|
/* check that a reset schedule becomes ready at the right time */
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0 - 1, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay0 - 1, 1),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay0, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay0 + 1, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay0 + 1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
/* Check that an attempt increment works */
|
/* Check that an attempt increment works */
|
||||||
@ -4457,15 +4470,19 @@ test_dir_download_status_increment(void *arg)
|
|||||||
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
||||||
|
|
||||||
/* check that an incremented schedule becomes ready at the right time */
|
/* check that an incremented schedule becomes ready at the right time */
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 - 1, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay1 - 1, 1),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 + 1, 1),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay1 + 1, 1),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
|
|
||||||
/* check that a schedule isn't ready if it's had too many attempts */
|
/* check that a schedule isn't ready if it's had too many attempts */
|
||||||
tt_int_op(download_status_is_ready(&dls_attempt, current_time + delay1 + 10, 0),
|
tt_int_op(download_status_is_ready(&dls_attempt,
|
||||||
|
current_time + delay1 + 10, 0),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
|
|
||||||
/* Check what happens when we reach then run off the end of the schedule */
|
/* Check what happens when we reach then run off the end of the schedule */
|
||||||
@ -5103,7 +5120,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_2) + strlen(test_desc_3));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_2) + strlen(test_desc_3));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5154,7 +5172,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_4) + strlen(test_desc_1));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_4) + strlen(test_desc_1));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5170,7 +5189,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_1) + strlen(test_desc_2));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_1) + strlen(test_desc_2));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5221,7 +5241,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_3) + strlen(test_desc_4));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_3) + strlen(test_desc_4));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5237,7 +5258,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_3) + strlen(test_desc_4));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_3) + strlen(test_desc_4));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5288,7 +5310,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_1) + strlen(test_desc_2));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_1) + strlen(test_desc_2));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5304,7 +5327,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_1) + strlen(test_desc_2));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_1) + strlen(test_desc_2));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5355,7 +5379,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_3) + strlen(test_desc_4));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_3) + strlen(test_desc_4));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5371,7 +5396,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_3) + strlen(test_desc_4));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_3) + strlen(test_desc_4));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5387,7 +5413,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_4) + strlen(test_desc_1));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_4) + strlen(test_desc_1));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5438,7 +5465,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_2) + strlen(test_desc_3));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_2) + strlen(test_desc_3));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5454,7 +5482,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_2) + strlen(test_desc_3));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_2) + strlen(test_desc_3));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5470,7 +5499,8 @@ test_dir_dump_unparseable_descriptors(void *data)
|
|||||||
/*
|
/*
|
||||||
* Assert things about the FIFO state
|
* Assert things about the FIFO state
|
||||||
*/
|
*/
|
||||||
tt_u64_op(len_descs_dumped, OP_EQ, strlen(test_desc_2) + strlen(test_desc_4));
|
tt_u64_op(len_descs_dumped, OP_EQ,
|
||||||
|
strlen(test_desc_2) + strlen(test_desc_4));
|
||||||
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
tt_assert(descs_dumped != NULL && smartlist_len(descs_dumped) == 2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -543,7 +543,7 @@ test_hs_rend_data(void *arg)
|
|||||||
tt_assert(service_dup->hsdirs_fp);
|
tt_assert(service_dup->hsdirs_fp);
|
||||||
tt_int_op(smartlist_len(service_dup->hsdirs_fp), OP_EQ, 0);
|
tt_int_op(smartlist_len(service_dup->hsdirs_fp), OP_EQ, 0);
|
||||||
for (rep = 0; rep < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS; rep++) {
|
for (rep = 0; rep < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS; rep++) {
|
||||||
tt_int_op(tor_digest_is_zero(service_dup_v2->descriptor_id[rep]), OP_EQ, 1);
|
tt_assert(tor_digest_is_zero(service_dup_v2->descriptor_id[rep]));
|
||||||
}
|
}
|
||||||
/* The rest should be zeroed because this is a service request. */
|
/* The rest should be zeroed because this is a service request. */
|
||||||
tt_int_op(tor_digest_is_zero(service_dup_v2->descriptor_cookie), OP_EQ, 1);
|
tt_int_op(tor_digest_is_zero(service_dup_v2->descriptor_cookie), OP_EQ, 1);
|
||||||
|
@ -233,7 +233,8 @@ test_link_specifier(void *arg)
|
|||||||
for (unsigned int i = 0; i < sizeof(ipv6); i++) {
|
for (unsigned int i = 0; i < sizeof(ipv6); i++) {
|
||||||
ipv6[i] = link_specifier_get_un_ipv6_addr(ls, i);
|
ipv6[i] = link_specifier_get_un_ipv6_addr(ls, i);
|
||||||
}
|
}
|
||||||
tt_mem_op(tor_addr_to_in6_addr8(&spec.u.ap.addr), OP_EQ, ipv6, sizeof(ipv6));
|
tt_mem_op(tor_addr_to_in6_addr8(&spec.u.ap.addr), OP_EQ, ipv6,
|
||||||
|
sizeof(ipv6));
|
||||||
tt_int_op(link_specifier_get_un_ipv6_port(ls), OP_EQ, spec.u.ap.port);
|
tt_int_op(link_specifier_get_un_ipv6_port(ls), OP_EQ, spec.u.ap.port);
|
||||||
|
|
||||||
link_specifier_free(ls);
|
link_specifier_free(ls);
|
||||||
|
@ -115,7 +115,8 @@ test_keypin_parse_file(void *arg)
|
|||||||
|
|
||||||
ent = smartlist_get(mock_addent_got, 12);
|
ent = smartlist_get(mock_addent_got, 12);
|
||||||
tt_mem_op(ent->rsa_id, OP_EQ, "ds speak truth, and ", 20);
|
tt_mem_op(ent->rsa_id, OP_EQ, "ds speak truth, and ", 20);
|
||||||
tt_mem_op(ent->ed25519_key, OP_EQ, "it was tru\xa5 that all the master\n", 32);
|
tt_mem_op(ent->ed25519_key, OP_EQ,
|
||||||
|
"it was tru\xa5 that all the master\n", 32);
|
||||||
|
|
||||||
/* File truncated before NL */
|
/* File truncated before NL */
|
||||||
const char data3[] =
|
const char data3[] =
|
||||||
|
@ -2033,9 +2033,11 @@ test_policies_fascist_firewall_choose_address(void *arg)
|
|||||||
== &ipv6_or_ap);
|
== &ipv6_or_ap);
|
||||||
|
|
||||||
/* null both OR addresses */
|
/* null both OR addresses */
|
||||||
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 0, FIREWALL_OR_CONNECTION, 0, 1),
|
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 0,
|
||||||
|
FIREWALL_OR_CONNECTION, 0, 1),
|
||||||
OP_EQ, NULL);
|
OP_EQ, NULL);
|
||||||
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 1, FIREWALL_OR_CONNECTION, 0, 0),
|
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 1,
|
||||||
|
FIREWALL_OR_CONNECTION, 0, 0),
|
||||||
OP_EQ, NULL);
|
OP_EQ, NULL);
|
||||||
|
|
||||||
/* null preferred Dir addresses */
|
/* null preferred Dir addresses */
|
||||||
@ -2047,9 +2049,11 @@ test_policies_fascist_firewall_choose_address(void *arg)
|
|||||||
== &ipv6_dir_ap);
|
== &ipv6_dir_ap);
|
||||||
|
|
||||||
/* null both Dir addresses */
|
/* null both Dir addresses */
|
||||||
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 0, FIREWALL_DIR_CONNECTION, 0, 1),
|
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 0,
|
||||||
|
FIREWALL_DIR_CONNECTION, 0, 1),
|
||||||
OP_EQ, NULL);
|
OP_EQ, NULL);
|
||||||
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 1, FIREWALL_DIR_CONNECTION, 0, 0),
|
tt_ptr_op(fascist_firewall_choose_address(&n_ipv4_ap, &n_ipv6_ap, 1,
|
||||||
|
FIREWALL_DIR_CONNECTION, 0, 0),
|
||||||
OP_EQ, NULL);
|
OP_EQ, NULL);
|
||||||
|
|
||||||
/* Prefer IPv4 but want IPv6 (contradictory) */
|
/* Prefer IPv4 but want IPv6 (contradictory) */
|
||||||
|
@ -211,7 +211,8 @@ test_routerkeys_ed_key_create(void *arg)
|
|||||||
kp2 = ed_key_new(kp1, INIT_ED_KEY_NEEDCERT, now, 3600, 4, &cert);
|
kp2 = ed_key_new(kp1, INIT_ED_KEY_NEEDCERT, now, 3600, 4, &cert);
|
||||||
tt_assert(kp2);
|
tt_assert(kp2);
|
||||||
tt_assert(cert);
|
tt_assert(cert);
|
||||||
tt_mem_op(&cert->signed_key, OP_EQ, &kp2->pubkey, sizeof(ed25519_public_key_t));
|
tt_mem_op(&cert->signed_key, OP_EQ, &kp2->pubkey,
|
||||||
|
sizeof(ed25519_public_key_t));
|
||||||
tt_assert(! cert->signing_key_included);
|
tt_assert(! cert->signing_key_included);
|
||||||
|
|
||||||
tt_int_op(cert->valid_until, OP_GE, now);
|
tt_int_op(cert->valid_until, OP_GE, now);
|
||||||
@ -227,8 +228,10 @@ test_routerkeys_ed_key_create(void *arg)
|
|||||||
tt_assert(kp2);
|
tt_assert(kp2);
|
||||||
tt_assert(cert);
|
tt_assert(cert);
|
||||||
tt_assert(cert->signing_key_included);
|
tt_assert(cert->signing_key_included);
|
||||||
tt_mem_op(&cert->signed_key, OP_EQ, &kp2->pubkey, sizeof(ed25519_public_key_t));
|
tt_mem_op(&cert->signed_key, OP_EQ, &kp2->pubkey,
|
||||||
tt_mem_op(&cert->signing_key, OP_EQ, &kp1->pubkey,sizeof(ed25519_public_key_t));
|
sizeof(ed25519_public_key_t));
|
||||||
|
tt_mem_op(&cert->signing_key, OP_EQ, &kp1->pubkey,
|
||||||
|
sizeof(ed25519_public_key_t));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ed25519_keypair_free(kp1);
|
ed25519_keypair_free(kp1);
|
||||||
|
@ -61,7 +61,8 @@ test_socks_4_unsupported_commands(void *ptr)
|
|||||||
|
|
||||||
/* SOCKS 4 Send BIND [02] to IP address 2.2.2.2:4369 */
|
/* SOCKS 4 Send BIND [02] to IP address 2.2.2.2:4369 */
|
||||||
ADD_DATA(buf, "\x04\x02\x11\x11\x02\x02\x02\x02\x00");
|
ADD_DATA(buf, "\x04\x02\x11\x11\x02\x02\x02\x02\x00");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, -1);
|
OP_EQ, -1);
|
||||||
tt_int_op(4,OP_EQ, socks->socks_version);
|
tt_int_op(4,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
||||||
@ -80,7 +81,8 @@ test_socks_4_supported_commands(void *ptr)
|
|||||||
|
|
||||||
/* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4370 */
|
/* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4370 */
|
||||||
ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x03\x00");
|
ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x03\x00");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(4,OP_EQ, socks->socks_version);
|
tt_int_op(4,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
||||||
@ -95,7 +97,8 @@ test_socks_4_supported_commands(void *ptr)
|
|||||||
|
|
||||||
/* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4369 with userid*/
|
/* SOCKS 4 Send CONNECT [01] to IP address 2.2.2.2:4369 with userid*/
|
||||||
ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x04me\x00");
|
ADD_DATA(buf, "\x04\x01\x11\x12\x02\x02\x02\x04me\x00");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(4,OP_EQ, socks->socks_version);
|
tt_int_op(4,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
||||||
@ -112,7 +115,8 @@ test_socks_4_supported_commands(void *ptr)
|
|||||||
|
|
||||||
/* SOCKS 4a Send RESOLVE [F0] request for torproject.org */
|
/* SOCKS 4a Send RESOLVE [F0] request for torproject.org */
|
||||||
ADD_DATA(buf, "\x04\xF0\x01\x01\x00\x00\x00\x02me\x00torproject.org\x00");
|
ADD_DATA(buf, "\x04\xF0\x01\x01\x00\x00\x00\x02me\x00torproject.org\x00");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(4,OP_EQ, socks->socks_version);
|
tt_int_op(4,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
tt_int_op(0,OP_EQ, socks->replylen); /* XXX: shouldn't tor reply? */
|
||||||
@ -218,7 +222,8 @@ test_socks_5_supported_commands(void *ptr)
|
|||||||
/* SOCKS 5 Send RESOLVE [F0] request for torproject.org:4369 */
|
/* SOCKS 5 Send RESOLVE [F0] request for torproject.org:4369 */
|
||||||
ADD_DATA(buf, "\x05\x01\x00");
|
ADD_DATA(buf, "\x05\x01\x00");
|
||||||
ADD_DATA(buf, "\x05\xF0\x00\x03\x0Etorproject.org\x01\x02");
|
ADD_DATA(buf, "\x05\xF0\x00\x03\x0Etorproject.org\x01\x02");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(5,OP_EQ, socks->socks_version);
|
tt_int_op(5,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(2,OP_EQ, socks->replylen);
|
tt_int_op(2,OP_EQ, socks->replylen);
|
||||||
@ -266,7 +271,8 @@ test_socks_5_supported_commands(void *ptr)
|
|||||||
/* SOCKS 5 Send RESOLVE_PTR [F1] for IP address 2.2.2.5 */
|
/* SOCKS 5 Send RESOLVE_PTR [F1] for IP address 2.2.2.5 */
|
||||||
ADD_DATA(buf, "\x05\x01\x00");
|
ADD_DATA(buf, "\x05\x01\x00");
|
||||||
ADD_DATA(buf, "\x05\xF1\x00\x01\x02\x02\x02\x05\x01\x03");
|
ADD_DATA(buf, "\x05\xF1\x00\x01\x02\x02\x02\x05\x01\x03");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(5,OP_EQ, socks->socks_version);
|
tt_int_op(5,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(2,OP_EQ, socks->replylen);
|
tt_int_op(2,OP_EQ, socks->replylen);
|
||||||
@ -378,7 +384,8 @@ test_socks_5_authenticate_with_data(void *ptr)
|
|||||||
/* SOCKS 5 Send username/password */
|
/* SOCKS 5 Send username/password */
|
||||||
/* SOCKS 5 Send CONNECT [01] to IP address 2.2.2.2:4369 */
|
/* SOCKS 5 Send CONNECT [01] to IP address 2.2.2.2:4369 */
|
||||||
ADD_DATA(buf, "\x01\x02me\x03you\x05\x01\x00\x01\x02\x02\x02\x02\x11\x11");
|
ADD_DATA(buf, "\x01\x02me\x03you\x05\x01\x00\x01\x02\x02\x02\x02\x11\x11");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, 1);
|
OP_EQ, 1);
|
||||||
tt_int_op(5,OP_EQ, socks->socks_version);
|
tt_int_op(5,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(2,OP_EQ, socks->replylen);
|
tt_int_op(2,OP_EQ, socks->replylen);
|
||||||
@ -405,7 +412,8 @@ test_socks_5_auth_before_negotiation(void *ptr)
|
|||||||
|
|
||||||
/* SOCKS 5 Send username/password */
|
/* SOCKS 5 Send username/password */
|
||||||
ADD_DATA(buf, "\x01\x02me\x02me");
|
ADD_DATA(buf, "\x01\x02me\x02me");
|
||||||
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks, get_options()->SafeSocks),
|
tt_int_op(fetch_from_buf_socks(buf, socks, get_options()->TestSocks,
|
||||||
|
get_options()->SafeSocks),
|
||||||
OP_EQ, -1);
|
OP_EQ, -1);
|
||||||
tt_int_op(0,OP_EQ, socks->socks_version);
|
tt_int_op(0,OP_EQ, socks->socks_version);
|
||||||
tt_int_op(0,OP_EQ, socks->replylen);
|
tt_int_op(0,OP_EQ, socks->replylen);
|
||||||
|
Loading…
Reference in New Issue
Block a user