aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_conflux_pool.c4
-rw-r--r--src/test/test_dir.c5
-rw-r--r--src/test/test_dirvote.c25
-rw-r--r--src/test/test_microdesc.c40
-rw-r--r--src/test/test_sandbox.c8
-rw-r--r--src/test/test_status.c13
6 files changed, 22 insertions, 73 deletions
diff --git a/src/test/test_conflux_pool.c b/src/test/test_conflux_pool.c
index fc30677377..05dc7b14ff 100644
--- a/src/test/test_conflux_pool.c
+++ b/src/test/test_conflux_pool.c
@@ -396,6 +396,7 @@ test_setup(void)
static void
test_clear_circs(void)
{
+ conflux_notify_shutdown();
SMARTLIST_FOREACH(circ_pairs, circ_pair_t *, circ_pair, {
tor_free(circ_pair);
});
@@ -430,6 +431,9 @@ test_clear_circs(void)
tor_assert(smartlist_len(mock_cell_delivery) == 0);
(void)free_fake_origin_circuit;
+
+ /* Clear shutdown flag so we can resume testing again. */
+ conflux_clear_shutdown();
}
static void
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 248fd8ab5d..87aaef7fe6 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -4078,7 +4078,7 @@ gen_routerstatus_for_umbw(int idx, time_t now)
if (vrs) {
vrs->microdesc = tor_malloc_zero(sizeof(vote_microdesc_hash_t));
tor_asprintf(&vrs->microdesc->microdesc_hash_line,
- "m 25,26,27,28 "
+ "m 32,33 "
"sha256=xyzajkldsdsajdadlsdjaslsdksdjlsdjsdaskdaaa%d\n",
idx);
}
@@ -4102,9 +4102,8 @@ vote_tweaks_for_umbw(networkstatus_t *v, int voter, time_t now)
tt_assert(v->supported_methods);
SMARTLIST_FOREACH(v->supported_methods, char *, c, tor_free(c));
smartlist_clear(v->supported_methods);
- /* Method 17 is MIN_METHOD_TO_CLIP_UNMEASURED_BW_KB */
smartlist_split_string(v->supported_methods,
- "25 26 27 28",
+ "32 33",
NULL, 0, -1);
/* If we're using a non-default clip bandwidth, add it to net_params */
if (alternate_clip_bw > 0) {
diff --git a/src/test/test_dirvote.c b/src/test/test_dirvote.c
index 2b53955107..bb7e6fdf10 100644
--- a/src/test/test_dirvote.c
+++ b/src/test/test_dirvote.c
@@ -656,30 +656,6 @@ done:
ROUTER_FREE(pppp);
}
-static void
-test_dirvote_parse_param_buggy(void *arg)
-{
- (void)arg;
-
- /* Tests for behavior with bug emulation to migrate away from bug 19011. */
- tt_i64_op(extract_param_buggy("blah blah", "bwweightscale", 10000),
- OP_EQ, 10000);
- tt_i64_op(extract_param_buggy("bwweightscale=7", "bwweightscale", 10000),
- OP_EQ, 7);
- tt_i64_op(extract_param_buggy("bwweightscale=7 foo=9",
- "bwweightscale", 10000),
- OP_EQ, 10000);
- tt_i64_op(extract_param_buggy("foo=7 bwweightscale=777 bar=9",
- "bwweightscale", 10000),
- OP_EQ, 10000);
- tt_i64_op(extract_param_buggy("foo=7 bwweightscale=1234",
- "bwweightscale", 10000),
- OP_EQ, 1234);
-
- done:
- ;
-}
-
#define NODE(name, flags) \
{ \
#name, test_dirvote_##name, (flags), NULL, NULL \
@@ -692,5 +668,4 @@ struct testcase_t dirvote_tests[] = {
NODE(get_sybil_by_ip_version_ipv4, TT_FORK),
NODE(get_sybil_by_ip_version_ipv6, TT_FORK),
NODE(get_all_possible_sybil, TT_FORK),
- NODE(parse_param_buggy, 0),
END_OF_TESTCASES};
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index c564805ecf..315a38f257 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -366,37 +366,14 @@ static const char test_ri[] =
"iFJkKxxDx7ksxX0zdl7aPT4ORFEuRhCYS6el7YJmoyg=\n"
"-----END SIGNATURE-----\n";
-static const char test_md2_25[] =
+static const char test_md2_withfamily_33[] =
"onion-key\n"
"-----BEGIN RSA PUBLIC KEY-----\n"
"MIGJAoGBAMvEJ/JVNK7I38PPWhQMuCgkET/ki4WIas4tj5Kmqfb9kHqxMR+EunRD\n"
"83k4pel1yB7QdV+iTd/4SZOI8RpZP+BO1KnOTWfpztAU1lDGr19/PwdwcHaILpBD\n"
"nNzm6otk4/bKUQ0vqpOfJljtg0DfAm4uMAQ6BMFy6uEAF7+JupuPAgMBAAE=\n"
"-----END RSA PUBLIC KEY-----\n"
- "ntor-onion-key FChIfm77vrWB7JsxQ+jMbN6VSSp1P0DYbw/2aqey4iA=\n"
- "p accept 1-65535\n"
- "id ed25519 J5lkRqyL6qW+CpN3E4RIlgJZeLgwjtmOOrjZvVhuwLQ\n";
-
-static const char test_md2_withfamily_28[] =
- "onion-key\n"
- "-----BEGIN RSA PUBLIC KEY-----\n"
- "MIGJAoGBAMvEJ/JVNK7I38PPWhQMuCgkET/ki4WIas4tj5Kmqfb9kHqxMR+EunRD\n"
- "83k4pel1yB7QdV+iTd/4SZOI8RpZP+BO1KnOTWfpztAU1lDGr19/PwdwcHaILpBD\n"
- "nNzm6otk4/bKUQ0vqpOfJljtg0DfAm4uMAQ6BMFy6uEAF7+JupuPAgMBAAE=\n"
- "-----END RSA PUBLIC KEY-----\n"
- "ntor-onion-key FChIfm77vrWB7JsxQ+jMbN6VSSp1P0DYbw/2aqey4iA=\n"
- "family OtherNode !Strange\n"
- "p accept 1-65535\n"
- "id ed25519 J5lkRqyL6qW+CpN3E4RIlgJZeLgwjtmOOrjZvVhuwLQ\n";
-
-static const char test_md2_withfamily_29[] =
- "onion-key\n"
- "-----BEGIN RSA PUBLIC KEY-----\n"
- "MIGJAoGBAMvEJ/JVNK7I38PPWhQMuCgkET/ki4WIas4tj5Kmqfb9kHqxMR+EunRD\n"
- "83k4pel1yB7QdV+iTd/4SZOI8RpZP+BO1KnOTWfpztAU1lDGr19/PwdwcHaILpBD\n"
- "nNzm6otk4/bKUQ0vqpOfJljtg0DfAm4uMAQ6BMFy6uEAF7+JupuPAgMBAAE=\n"
- "-----END RSA PUBLIC KEY-----\n"
- "ntor-onion-key FChIfm77vrWB7JsxQ+jMbN6VSSp1P0DYbw/2aqey4iA=\n"
+ "ntor-onion-key FChIfm77vrWB7JsxQ+jMbN6VSSp1P0DYbw/2aqey4iA\n"
"family !Strange $D219590AC9513BCDEBBA9AB721007A4CC01BBAE3 othernode\n"
"p accept 1-65535\n"
"id ed25519 J5lkRqyL6qW+CpN3E4RIlgJZeLgwjtmOOrjZvVhuwLQ\n";
@@ -411,21 +388,12 @@ test_md_generate(void *arg)
ri = router_parse_entry_from_string(test_ri, NULL, 0, 0, NULL, NULL);
tt_assert(ri);
- md = dirvote_create_microdescriptor(ri, 25);
- tt_str_op(md->body, OP_EQ, test_md2_25);
- tt_assert(ed25519_pubkey_eq(md->ed25519_identity_pkey,
- &ri->cache_info.signing_key_cert->signing_key));
-
// Try family encoding.
microdesc_free(md);
ri->declared_family = smartlist_new();
smartlist_add_strdup(ri->declared_family, "OtherNode !Strange");
- md = dirvote_create_microdescriptor(ri, 28);
- tt_str_op(md->body, OP_EQ, test_md2_withfamily_28);
-
- microdesc_free(md);
- md = dirvote_create_microdescriptor(ri, 29);
- tt_str_op(md->body, OP_EQ, test_md2_withfamily_29);
+ md = dirvote_create_microdescriptor(ri, 33);
+ tt_str_op(md->body, OP_EQ, test_md2_withfamily_33);
done:
microdesc_free(md);
diff --git a/src/test/test_sandbox.c b/src/test/test_sandbox.c
index 64182ecc91..3104790723 100644
--- a/src/test/test_sandbox.c
+++ b/src/test/test_sandbox.c
@@ -364,22 +364,22 @@ test_sandbox_crypto_equix(void *arg)
struct testcase_t sandbox_tests[] = {
SANDBOX_TEST(is_active, TT_FORK),
-/* When Tor is built with fragile compiler-hardening the sandbox is unable to
- * filter requests to open files or directories (on systems where glibc uses
- * the "open" system call to provide this functionality), as doing so would
+/* When Tor is built with fragile compiler-hardening the sandbox is usually
+ * unable to filter requests to open files or directories, as doing so would
* interfere with the address sanitizer as it retrieves information about the
* running process via the filesystem. Skip these tests in that case as the
* corresponding functions are likely to have no effect and this will cause the
* tests to fail. */
#ifdef ENABLE_FRAGILE_HARDENING
SANDBOX_TEST_SKIPPED(open_filename),
+ SANDBOX_TEST_SKIPPED(openat_filename),
SANDBOX_TEST_SKIPPED(opendir_dirname),
#else
SANDBOX_TEST_IN_SANDBOX(open_filename),
+ SANDBOX_TEST_IN_SANDBOX(openat_filename),
SANDBOX_TEST_IN_SANDBOX(opendir_dirname),
#endif /* defined(ENABLE_FRAGILE_HARDENING) */
- SANDBOX_TEST_IN_SANDBOX(openat_filename),
SANDBOX_TEST_IN_SANDBOX(chmod_filename),
SANDBOX_TEST_IN_SANDBOX(chown_filename),
SANDBOX_TEST_IN_SANDBOX(rename_filename),
diff --git a/src/test/test_status.c b/src/test/test_status.c
index 1d371645ae..4ceb81f3a5 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -333,10 +333,12 @@ test_status_hb_not_in_consensus(void *arg)
status_hb_not_in_consensus_server_mode);
log_global_min_severity_ = LOG_DEBUG;
- onion_handshakes_requested[ONION_HANDSHAKE_TYPE_TAP] = 1;
onion_handshakes_assigned[ONION_HANDSHAKE_TYPE_TAP] = 1;
- onion_handshakes_requested[ONION_HANDSHAKE_TYPE_NTOR] = 1;
- onion_handshakes_assigned[ONION_HANDSHAKE_TYPE_NTOR] = 1;
+ onion_handshakes_requested[ONION_HANDSHAKE_TYPE_TAP] = 2;
+ onion_handshakes_assigned[ONION_HANDSHAKE_TYPE_NTOR] = 3;
+ onion_handshakes_requested[ONION_HANDSHAKE_TYPE_NTOR] = 4;
+ onion_handshakes_assigned[ONION_HANDSHAKE_TYPE_NTOR_V3] = 5;
+ onion_handshakes_requested[ONION_HANDSHAKE_TYPE_NTOR_V3] = 6;
expected = 0;
setup_capture_of_logs(LOG_INFO);
@@ -352,8 +354,8 @@ test_status_hb_not_in_consensus(void *arg)
"I've made 0 connections with IPv4 and 0 with IPv6.\n");
expect_log_msg("Average packaged cell fullness: 100.000%. "
"TLS write overhead: 0%\n");
- expect_log_msg("Circuit handshake stats since last time: 1/1 TAP, "
- "1/1 NTor.\n");
+ expect_log_msg("Circuit handshake stats since last time: 1/2 TAP, "
+ "3/4 NTor, 5/6 NTor (v3).\n");
expect_log_msg("Since startup we initiated 0 and received 0 v1 "
"connections; initiated 0 and received 0 v2 connections; "
"initiated 0 and received 0 v3 connections; "
@@ -363,6 +365,7 @@ test_status_hb_not_in_consensus(void *arg)
"with too many cells, [DoSCircuitCreationEnabled disabled], "
"[DoSConnectionEnabled disabled], "
"[DoSRefuseSingleHopClientRendezvous disabled], "
+ "[DoSStreamCreationEnabled disabled], "
"0 INTRODUCE2 rejected.\n");
tt_int_op(mock_saved_log_n_entries(), OP_EQ, 6);