summaryrefslogtreecommitdiff
path: root/src/test/test_hs_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r--src/test/test_hs_service.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 05ced17ff7..ca6af43ba7 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -425,7 +425,7 @@ test_service_intro_point(void *arg)
/* Test functions that uses a service intropoints map with that previously
* created object (non legacy). */
{
- uint8_t garbage[DIGEST256_LEN] = {0};
+ ed25519_public_key_t garbage = { {0} };
hs_service_intro_point_t *query;
service = hs_service_new(get_options());
@@ -436,8 +436,7 @@ test_service_intro_point(void *arg)
service_intro_point_add(service->desc_current->intro_points.map, ip);
query = service_intro_point_find(service, &ip->auth_key_kp.pubkey);
tt_mem_op(query, OP_EQ, ip, sizeof(hs_service_intro_point_t));
- query = service_intro_point_find(service,
- (const ed25519_public_key_t *) garbage);
+ query = service_intro_point_find(service, &garbage);
tt_ptr_op(query, OP_EQ, NULL);
/* While at it, can I find the descriptor with the intro point? */
@@ -677,6 +676,8 @@ test_intro_established(void *arg)
circ = helper_create_origin_circuit(CIRCUIT_PURPOSE_S_ESTABLISH_INTRO,
flags);
+ tt_assert(circ);
+
/* Test a wrong purpose. */
TO_CIRCUIT(circ)->purpose = CIRCUIT_PURPOSE_S_INTRO;
setup_full_capture_of_logs(LOG_WARN);
@@ -724,7 +725,8 @@ test_intro_established(void *arg)
tt_int_op(TO_CIRCUIT(circ)->purpose, OP_EQ, CIRCUIT_PURPOSE_S_INTRO);
done:
- circuit_free(TO_CIRCUIT(circ));
+ if (circ)
+ circuit_free(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
}
@@ -793,6 +795,7 @@ test_introduce2(void *arg)
dummy_state = tor_malloc_zero(sizeof(or_state_t));
circ = helper_create_origin_circuit(CIRCUIT_PURPOSE_S_INTRO, flags);
+ tt_assert(circ);
/* Test a wrong purpose. */
TO_CIRCUIT(circ)->purpose = CIRCUIT_PURPOSE_S_ESTABLISH_INTRO;
@@ -844,7 +847,8 @@ test_introduce2(void *arg)
done:
or_state_free(dummy_state);
dummy_state = NULL;
- circuit_free(TO_CIRCUIT(circ));
+ if (circ)
+ circuit_free(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
}
@@ -1264,6 +1268,7 @@ test_upload_descriptors(void *arg)
ret = parse_rfc1123_time("Sat, 26 Oct 1985 13:00:00 UTC",
&mock_ns.valid_after);
+ tt_int_op(ret, OP_EQ, 0);
ret = parse_rfc1123_time("Sat, 26 Oct 1985 14:00:00 UTC",
&mock_ns.fresh_until);
tt_int_op(ret, OP_EQ, 0);
@@ -1339,6 +1344,7 @@ test_revision_counter_state(void *arg)
&desc_two->blinded_kp.pubkey,
&service_found);
tt_int_op(service_found, OP_EQ, 0);
+ tt_u64_op(cached_rev_counter, OP_EQ, 0);
/* Now let's try with the right pubkeys */
cached_rev_counter =check_state_line_for_service_rev_counter(state_line_one,