commit e28e41dd78ef48c5176c07b8068bb2b3afce2b85
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Jan 9 11:43:49 2020 -0500
Fix wide lines from NS() removal fallout.
---
src/test/test_dir_handle_get.c | 5 +-
src/test/test_dns.c | 21 ++-
src/test/test_rendcache.c | 18 +--
src/test/test_routerset.c | 354 +++++++++++++++++++++++++----------------
src/test/test_status.c | 156 +++++++++---------
5 files changed, 314 insertions(+), 240 deletions(-)
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index 86e6edd44..6293839b0 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -2253,8 +2253,8 @@ test_dir_handle_get_status_vote_next_bandwidth_not_found(void* data)
tor_free(header);
}
-static const char* dhg_tests_dirvote_get_pending_consensus(consensus_flavor_t flav);
-ATTR_UNUSED static int dhg_tests_dirvote_get_pending_consensus_called = 0;
+static const char* dhg_tests_dirvote_get_pending_consensus(
+ consensus_flavor_t flav);
const char*
dhg_tests_dirvote_get_pending_consensus(consensus_flavor_t flav)
@@ -2355,7 +2355,6 @@ test_dir_handle_get_status_vote_next_consensus_signatures_not_found(void* data)
}
static const char* dhg_tests_dirvote_get_pending_detached_signatures(void);
-ATTR_UNUSED static int dhg_tests_dirvote_get_pending_detached_signatures_called = 0;
const char*
dhg_tests_dirvote_get_pending_detached_signatures(void)
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index 443538326..ec17e9e91 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -97,7 +97,10 @@ static cached_resolve_t *cache_entry_mock = NULL;
static int n_fake_impl = 0;
-static int dns_resolve_dns_resolve_impl(edge_connection_t *exitconn, int is_resolve, or_circuit_t *oncirc, char **hostname_out, int *made_connection_pending_out, cached_resolve_t **resolve_out);
+static int dns_resolve_dns_resolve_impl(edge_connection_t *exitconn,
+ int is_resolve, or_circuit_t *oncirc,
+ char **hostname_out, int *made_connection_pending_out,
+ cached_resolve_t **resolve_out);
ATTR_UNUSED static int dns_resolve_dns_resolve_impl_called = 0;
/** This will be our configurable substitute for <b>dns_resolve_impl</b> in
@@ -625,7 +628,8 @@ static edge_connection_t *last_exitconn = NULL;
static cached_resolve_t *last_resolve = NULL;
static int
-dns_impl_cache_hit_cached_set_exitconn_info_from_resolve(edge_connection_t *exitconn,
+dns_impl_cache_hit_cached_set_exitconn_info_from_resolve(
+ edge_connection_t *exitconn,
const cached_resolve_t *resolve,
char **hostname_out)
{
@@ -771,17 +775,20 @@ test_dns_impl_cache_miss(void *arg)
struct testcase_t dns_tests[] = {
#ifdef HAVE_EVDNS_BASE_GET_NAMESERVER_ADDR
- { "configure_ns_fallback", test_dns_configure_ns_fallback, TT_FORK, NULL, NULL },
+ { "configure_ns_fallback", test_dns_configure_ns_fallback,
+ TT_FORK, NULL, NULL },
#endif
{ "clip_ttl", test_dns_clip_ttl, TT_FORK, NULL, NULL },
{ "resolve", test_dns_resolve, TT_FORK, NULL, NULL },
{ "impl_addr_is_ip", test_dns_impl_addr_is_ip, TT_FORK, NULL, NULL },
{ "impl_non_exit", test_dns_impl_non_exit, TT_FORK, NULL, NULL },
- { "impl_addr_is_invalid_dest", test_dns_impl_addr_is_invalid_dest, TT_FORK, NULL, NULL },
+ { "impl_addr_is_invalid_dest", test_dns_impl_addr_is_invalid_dest,
+ TT_FORK, NULL, NULL },
{ "impl_malformed_ptr", test_dns_impl_malformed_ptr, TT_FORK, NULL, NULL },
- { "impl_cache_hit_pending", test_dns_impl_cache_hit_pending, TT_FORK, NULL, NULL },
- { "impl_cache_hit_cached", test_dns_impl_cache_hit_cached, TT_FORK, NULL, NULL },
+ { "impl_cache_hit_pending", test_dns_impl_cache_hit_pending,
+ TT_FORK, NULL, NULL },
+ { "impl_cache_hit_cached", test_dns_impl_cache_hit_cached,
+ TT_FORK, NULL, NULL },
{ "impl_cache_miss", test_dns_impl_cache_miss, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
-
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index d0cb4378a..e396f9fd5 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -367,13 +367,12 @@ test_rend_cache_store_v2_desc_as_client_with_different_time(void *data)
rend_data_free(mock_rend_query);
}
-static const routerinfo_t * rcache_lookup_v2_desc_as_dir_router_get_my_routerinfo(void);
-ATTR_UNUSED static int rcache_lookup_v2_desc_as_dir_router_get_my_routerinfo_called = 0;
+static const routerinfo_t *rcache_lookup_v2_as_dir_get_my_routerinfo(void);
static routerinfo_t *mock_routerinfo;
static const routerinfo_t *
-rcache_lookup_v2_desc_as_dir_router_get_my_routerinfo(void)
+rcache_lookup_v2_as_dir_get_my_routerinfo(void)
{
if (!mock_routerinfo) {
mock_routerinfo = tor_malloc(sizeof(routerinfo_t));
@@ -394,7 +393,7 @@ test_rend_cache_lookup_v2_desc_as_dir(void *data)
(void)data;
MOCK(router_get_my_routerinfo,
- rcache_lookup_v2_desc_as_dir_router_get_my_routerinfo);
+ rcache_lookup_v2_as_dir_get_my_routerinfo);
rend_cache_init();
@@ -424,11 +423,10 @@ test_rend_cache_lookup_v2_desc_as_dir(void *data)
tor_free(service_id);
}
-static const routerinfo_t * rcache_store_v2_desc_as_dir_router_get_my_routerinfo(void);
-ATTR_UNUSED static int rcache_store_v2_desc_as_dir_router_get_my_routerinfo_called = 0;
+static const routerinfo_t *rcache_store_v2_as_dir_get_my_routerinfo(void);
static const routerinfo_t *
-rcache_store_v2_desc_as_dir_router_get_my_routerinfo(void)
+rcache_store_v2_as_dir_get_my_routerinfo(void)
{
return mock_routerinfo;
}
@@ -442,7 +440,7 @@ test_rend_cache_store_v2_desc_as_dir(void *data)
char *service_id = NULL;
MOCK(router_get_my_routerinfo,
- rcache_store_v2_desc_as_dir_router_get_my_routerinfo);
+ rcache_store_v2_as_dir_get_my_routerinfo);
rend_cache_init();
@@ -504,7 +502,7 @@ test_rend_cache_store_v2_desc_as_dir_with_different_time(void *data)
rend_encoded_v2_service_descriptor_t *desc_holder_older;
MOCK(router_get_my_routerinfo,
- rcache_store_v2_desc_as_dir_router_get_my_routerinfo);
+ rcache_store_v2_as_dir_get_my_routerinfo);
rend_cache_init();
@@ -568,7 +566,7 @@ test_rend_cache_store_v2_desc_as_dir_with_different_content(void *data)
rend_encoded_v2_service_descriptor_t *desc_holder_two = NULL;
MOCK(router_get_my_routerinfo,
- rcache_store_v2_desc_as_dir_router_get_my_routerinfo);
+ rcache_store_v2_as_dir_get_my_routerinfo);
rend_cache_init();
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index a64f7c1d1..892ac6e21 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -90,9 +90,9 @@ test_rset_get_countryname(void *arg)
*/
static int rset_refresh_geoip_not_loaded_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_refresh_geoip_not_loaded_geoip_is_loaded_called = 0;
+static int rset_refresh_geoip_not_loaded_geoip_is_loaded_called = 0;
static int rset_refresh_geoip_not_loaded_geoip_get_n_countries(void);
-ATTR_UNUSED static int rset_refresh_geoip_not_loaded_geoip_get_n_countries_called = 0;
+static int rset_refresh_geoip_not_loaded_geoip_get_n_countries_called = 0;
static void
test_rset_refresh_geoip_not_loaded(void *arg)
@@ -110,7 +110,8 @@ test_rset_refresh_geoip_not_loaded(void *arg)
tt_ptr_op(set->countries, OP_EQ, NULL);
tt_int_op(set->n_countries, OP_EQ, 0);
tt_int_op(rset_refresh_geoip_not_loaded_geoip_is_loaded_called, OP_EQ, 1);
- tt_int_op(rset_refresh_geoip_not_loaded_geoip_get_n_countries_called, OP_EQ, 0);
+ tt_int_op(rset_refresh_geoip_not_loaded_geoip_get_n_countries_called,
+ OP_EQ, 0);
done:
UNMOCK(geoip_is_loaded);
@@ -140,11 +141,12 @@ rset_refresh_geoip_not_loaded_geoip_get_n_countries(void)
*/
static int rset_refresh_no_countries_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_refresh_no_countries_geoip_is_loaded_called = 0;
+static int rset_refresh_no_countries_geoip_is_loaded_called = 0;
static int rset_refresh_no_countries_geoip_get_n_countries(void);
-ATTR_UNUSED static int rset_refresh_no_countries_geoip_get_n_countries_called = 0;
-static country_t rset_refresh_no_countries_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_refresh_no_countries_geoip_get_country_called = 0;
+static int rset_refresh_no_countries_geoip_get_n_countries_called = 0;
+static country_t rset_refresh_no_countries_geoip_get_country(
+ const char *country);
+static int rset_refresh_no_countries_geoip_get_country_called = 0;
static void
test_rset_refresh_no_countries(void *arg)
@@ -206,11 +208,12 @@ rset_refresh_no_countries_geoip_get_country(const char *countrycode)
*/
static int rset_refresh_one_valid_country_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_refresh_one_valid_country_geoip_is_loaded_called = 0;
+static int rset_refresh_one_valid_country_geoip_is_loaded_called = 0;
static int rset_refresh_one_valid_country_geoip_get_n_countries(void);
-ATTR_UNUSED static int rset_refresh_one_valid_country_geoip_get_n_countries_called = 0;
-static country_t rset_refresh_one_valid_country_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_refresh_one_valid_country_geoip_get_country_called = 0;
+static int rset_refresh_one_valid_country_geoip_get_n_countries_called = 0;
+static country_t rset_refresh_one_valid_country_geoip_get_country(
+ const char *country);
+static int rset_refresh_one_valid_country_geoip_get_country_called = 0;
static void
test_rset_refresh_one_valid_country(void *arg)
@@ -231,7 +234,8 @@ test_rset_refresh_one_valid_country(void *arg)
tt_ptr_op(set->countries, OP_NE, NULL);
tt_int_op(set->n_countries, OP_EQ, 2);
tt_int_op(rset_refresh_one_valid_country_geoip_is_loaded_called, OP_EQ, 1);
- tt_int_op(rset_refresh_one_valid_country_geoip_get_n_countries_called, OP_EQ, 1);
+ tt_int_op(rset_refresh_one_valid_country_geoip_get_n_countries_called,
+ OP_EQ, 1);
tt_int_op(rset_refresh_one_valid_country_geoip_get_country_called, OP_EQ, 1);
tt_int_op((unsigned int)(*set->countries), OP_NE, 0);
@@ -273,12 +277,14 @@ rset_refresh_one_valid_country_geoip_get_country(const char *countrycode)
* country code..
*/
-static int rset_refresh_one_invalid_country_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_refresh_one_invalid_country_geoip_is_loaded_called = 0;
+static int rset_refresh_one_invalid_country_geoip_is_loaded(
+ sa_family_t family);
+static int rset_refresh_one_invalid_country_geoip_is_loaded_called = 0;
static int rset_refresh_one_invalid_country_geoip_get_n_countries(void);
-ATTR_UNUSED static int rset_refresh_one_invalid_country_geoip_get_n_countries_called = 0;
-static country_t rset_refresh_one_invalid_country_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_refresh_one_invalid_country_geoip_get_country_called = 0;
+static int rset_refresh_one_invalid_country_geoip_get_n_countries_called = 0;
+static country_t rset_refresh_one_invalid_country_geoip_get_country(
+ const char *country);
+static int rset_refresh_one_invalid_country_geoip_get_country_called = 0;
static void
test_rset_refresh_one_invalid_country(void *arg)
@@ -299,8 +305,10 @@ test_rset_refresh_one_invalid_country(void *arg)
tt_ptr_op(set->countries, OP_NE, NULL);
tt_int_op(set->n_countries, OP_EQ, 2);
tt_int_op(rset_refresh_one_invalid_country_geoip_is_loaded_called, OP_EQ, 1);
- tt_int_op(rset_refresh_one_invalid_country_geoip_get_n_countries_called, OP_EQ, 1);
- tt_int_op(rset_refresh_one_invalid_country_geoip_get_country_called, OP_EQ, 1);
+ tt_int_op(rset_refresh_one_invalid_country_geoip_get_n_countries_called,
+ OP_EQ, 1);
+ tt_int_op(rset_refresh_one_invalid_country_geoip_get_country_called,
+ OP_EQ, 1);
tt_int_op((unsigned int)(*set->countries), OP_EQ, 0);
done:
@@ -427,8 +435,9 @@ test_rset_parse_get_countryname(void *arg)
* Structural test for routerset_parse, when given a valid wildcard policy.
*/
-static addr_policy_t * rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string(const char *s, int assume_action, int *malformed_list);
-ATTR_UNUSED static int rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string_called = 0;
+static addr_policy_t * rset_parse_policy_wildcard_parse_item_from_string(
+ const char *s, int assume_action, int *malformed_list);
+static int rset_parse_policy_wildcard_parse_item_from_string_called = 0;
static addr_policy_t *rset_parse_policy_wildcard_mock_addr_policy;
@@ -441,29 +450,31 @@ test_rset_parse_policy_wildcard(void *arg)
(void)arg;
MOCK(router_parse_addr_policy_item_from_string,
- rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string);
- rset_parse_policy_wildcard_mock_addr_policy = tor_malloc_zero(sizeof(addr_policy_t));
+ rset_parse_policy_wildcard_parse_item_from_string);
+ rset_parse_policy_wildcard_mock_addr_policy =
+ tor_malloc_zero(sizeof(addr_policy_t));
set = routerset_new();
s = "*";
r = routerset_parse(set, s, "");
tt_int_op(r, OP_EQ, 0);
tt_int_op(smartlist_len(set->policies), OP_NE, 0);
- tt_int_op(rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string_called, OP_EQ, 1);
+ tt_int_op(rset_parse_policy_wildcard_parse_item_from_string_called,
+ OP_EQ, 1);
done:
routerset_free(set);
}
addr_policy_t *
-rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string(const char *s,
+rset_parse_policy_wildcard_parse_item_from_string(const char *s,
int assume_action,
int *malformed_list)
{
(void)s;
(void)assume_action;
(void)malformed_list;
- rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string_called++;
+ rset_parse_policy_wildcard_parse_item_from_string_called++;
return rset_parse_policy_wildcard_mock_addr_policy;
}
@@ -473,8 +484,9 @@ rset_parse_policy_wildcard_router_parse_addr_policy_item_from_string(const char
* literal policy.
*/
-static addr_policy_t * rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string(const char *s, int assume_action, int *bogus);
-ATTR_UNUSED static int rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string_called = 0;
+static addr_policy_t * rset_parse_policy_ipv4_parse_item_from_string(
+ const char *s, int assume_action, int *bogus);
+static int rset_parse_policy_ipv4_parse_item_from_string_called = 0;
static addr_policy_t *rset_parse_policy_ipv4_mock_addr_policy;
@@ -487,27 +499,29 @@ test_rset_parse_policy_ipv4(void *arg)
(void)arg;
MOCK(router_parse_addr_policy_item_from_string,
- rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string);
- rset_parse_policy_ipv4_mock_addr_policy = tor_malloc_zero(sizeof(addr_policy_t));
+ rset_parse_policy_ipv4_parse_item_from_string);
+ rset_parse_policy_ipv4_mock_addr_policy =
+ tor_malloc_zero(sizeof(addr_policy_t));
set = routerset_new();
s = "127.0.0.1";
r = routerset_parse(set, s, "");
tt_int_op(r, OP_EQ, 0);
tt_int_op(smartlist_len(set->policies), OP_NE, 0);
- tt_int_op(rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string_called, OP_EQ, 1);
+ tt_int_op(rset_parse_policy_ipv4_parse_item_from_string_called, OP_EQ, 1);
done:
routerset_free(set);
}
addr_policy_t *
-rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string(const char *s, int assume_action,
- int *bogus)
+rset_parse_policy_ipv4_parse_item_from_string(
+ const char *s, int assume_action,
+ int *bogus)
{
(void)s;
(void)assume_action;
- rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string_called++;
+ rset_parse_policy_ipv4_parse_item_from_string_called++;
*bogus = 0;
return rset_parse_policy_ipv4_mock_addr_policy;
@@ -518,8 +532,9 @@ rset_parse_policy_ipv4_router_parse_addr_policy_item_from_string(const char *s,
* literal policy.
*/
-static addr_policy_t * rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string(const char *s, int assume_action, int *bad);
-ATTR_UNUSED static int rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string_called = 0;
+static addr_policy_t * rset_parse_policy_ipv6_parse_item_from_string(
+ const char *s, int assume_action, int *bad);
+static int rset_parse_policy_ipv6_parse_item_from_string_called = 0;
static addr_policy_t *rset_parse_policy_ipv6_mock_addr_policy;
@@ -532,27 +547,28 @@ test_rset_parse_policy_ipv6(void *arg)
(void)arg;
MOCK(router_parse_addr_policy_item_from_string,
- rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string);
- rset_parse_policy_ipv6_mock_addr_policy = tor_malloc_zero(sizeof(addr_policy_t));
+ rset_parse_policy_ipv6_parse_item_from_string);
+ rset_parse_policy_ipv6_mock_addr_policy =
+ tor_malloc_zero(sizeof(addr_policy_t));
set = routerset_new();
s = "::1";
r = routerset_parse(set, s, "");
tt_int_op(r, OP_EQ, 0);
tt_int_op(smartlist_len(set->policies), OP_NE, 0);
- tt_int_op(rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string_called, OP_EQ, 1);
+ tt_int_op(rset_parse_policy_ipv6_parse_item_from_string_called, OP_EQ, 1);
done:
routerset_free(set);
}
addr_policy_t *
-rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string(const char *s,
+rset_parse_policy_ipv6_parse_item_from_string(const char *s,
int assume_action, int *bad)
{
(void)s;
(void)assume_action;
- rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string_called++;
+ rset_parse_policy_ipv6_parse_item_from_string_called++;
*bad = 0;
return rset_parse_policy_ipv6_mock_addr_policy;
@@ -563,7 +579,7 @@ rset_parse_policy_ipv6_router_parse_addr_policy_item_from_string(const char *s,
*/
static smartlist_t * rset_union_source_bad_smartlist_new(void);
-ATTR_UNUSED static int rset_union_source_bad_smartlist_new_called = 0;
+static int rset_union_source_bad_smartlist_new_called = 0;
static void
test_rset_union_source_bad(void *arg)
@@ -901,8 +917,10 @@ test_rset_contains_null_digest(void *arg)
* and the address is rejected by policy.
*/
-static addr_policy_result_t rset_contains_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy);
-ATTR_UNUSED static int rset_contains_addr_compare_tor_addr_to_addr_policy_called = 0;
+static addr_policy_result_t rset_contains_addr_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
+ const smartlist_t *policy);
+static int rset_contains_addr_cmp_addr_to_policy_called = 0;
static tor_addr_t MOCK_TOR_ADDR;
#define MOCK_TOR_ADDR_PTR (&MOCK_TOR_ADDR)
@@ -916,12 +934,12 @@ test_rset_contains_addr(void *arg)
(void)arg;
MOCK(compare_tor_addr_to_addr_policy,
- rset_contains_addr_compare_tor_addr_to_addr_policy);
+ rset_contains_addr_cmp_addr_to_policy);
contains = routerset_contains(set, addr, 0, NULL, NULL, 0);
routerset_free(set);
- tt_int_op(rset_contains_addr_compare_tor_addr_to_addr_policy_called, OP_EQ, 1);
+ tt_int_op(rset_contains_addr_cmp_addr_to_policy_called, OP_EQ, 1);
tt_int_op(contains, OP_EQ, 3);
done:
@@ -929,12 +947,12 @@ test_rset_contains_addr(void *arg)
}
addr_policy_result_t
-rset_contains_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port,
+rset_contains_addr_cmp_addr_to_policy(const tor_addr_t *addr, uint16_t port,
const smartlist_t *policy)
{
(void)port;
(void)policy;
- rset_contains_addr_compare_tor_addr_to_addr_policy_called++;
+ rset_contains_addr_cmp_addr_to_policy_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
return ADDR_POLICY_REJECTED;
@@ -947,8 +965,10 @@ rset_contains_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint1
* and the address is not rejected by policy.
*/
-static addr_policy_result_t rset_contains_no_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy);
-ATTR_UNUSED static int rset_contains_no_addr_compare_tor_addr_to_addr_policy_called = 0;
+static addr_policy_result_t rset_contains_no_addr_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
+ const smartlist_t *policy);
+static int rset_contains_no_addr_cmp_addr_to_policy_called = 0;
static void
test_rset_contains_no_addr(void *arg)
@@ -959,12 +979,12 @@ test_rset_contains_no_addr(void *arg)
(void)arg;
MOCK(compare_tor_addr_to_addr_policy,
- rset_contains_no_addr_compare_tor_addr_to_addr_policy);
+ rset_contains_no_addr_cmp_addr_to_policy);
contains = routerset_contains(set, addr, 0, NULL, NULL, 0);
routerset_free(set);
- tt_int_op(rset_contains_no_addr_compare_tor_addr_to_addr_policy_called, OP_EQ, 1);
+ tt_int_op(rset_contains_no_addr_cmp_addr_to_policy_called, OP_EQ, 1);
tt_int_op(contains, OP_EQ, 0);
done:
@@ -972,12 +992,12 @@ test_rset_contains_no_addr(void *arg)
}
addr_policy_result_t
-rset_contains_no_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port,
+rset_contains_no_addr_cmp_addr_to_policy(const tor_addr_t *addr, uint16_t port,
const smartlist_t *policy)
{
(void)port;
(void)policy;
- rset_contains_no_addr_compare_tor_addr_to_addr_policy_called++;
+ rset_contains_no_addr_cmp_addr_to_policy_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
return ADDR_POLICY_ACCEPTED;
@@ -991,8 +1011,10 @@ rset_contains_no_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, ui
* and the address is NULL.
*/
-static addr_policy_result_t rset_contains_null_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy);
-ATTR_UNUSED static int rset_contains_null_addr_compare_tor_addr_to_addr_policy_called = 0;
+static addr_policy_result_t rset_contains_null_addr_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
+ const smartlist_t *policy);
+static int rset_contains_null_addr_cmp_addr_to_policy_called = 0;
static void
test_rset_contains_null_addr(void *arg)
@@ -1002,7 +1024,7 @@ test_rset_contains_null_addr(void *arg)
(void)arg;
MOCK(compare_tor_addr_to_addr_policy,
- rset_contains_null_addr_compare_tor_addr_to_addr_policy);
+ rset_contains_null_addr_cmp_addr_to_policy);
contains = routerset_contains(set, NULL, 0, NULL, NULL, 0);
routerset_free(set);
@@ -1014,12 +1036,13 @@ test_rset_contains_null_addr(void *arg)
}
addr_policy_result_t
-rset_contains_null_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port,
+rset_contains_null_addr_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
const smartlist_t *policy)
{
(void)port;
(void)policy;
- rset_contains_null_addr_compare_tor_addr_to_addr_policy_called++;
+ rset_contains_null_addr_cmp_addr_to_policy_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
return ADDR_POLICY_ACCEPTED;
@@ -1033,22 +1056,25 @@ rset_contains_null_addr_compare_tor_addr_to_addr_policy(const tor_addr_t *addr,
* for the address.
*/
-static addr_policy_result_t rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy);
-ATTR_UNUSED static int rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy_called = 0;
-static int rset_contains_countries_no_geoip_geoip_get_country_by_addr(const tor_addr_t *addr);
-ATTR_UNUSED static int rset_contains_countries_no_geoip_geoip_get_country_by_addr_called = 0;
+static addr_policy_result_t rset_countries_no_geoip_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
+ const smartlist_t *policy);
+static int rset_countries_no_geoip_cmp_addr_to_policy_called = 0;
+static int rset_countries_no_geoip_geoip_get_country_by_addr(
+ const tor_addr_t *addr);
+static int rset_countries_no_geoip_geoip_get_country_by_addr_called = 0;
static void
-test_rset_contains_countries_no_geoip(void *arg)
+test_rset_countries_no_geoip(void *arg)
{
routerset_t *set = routerset_new();
int contains = 1;
(void)arg;
MOCK(compare_tor_addr_to_addr_policy,
- rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy);
+ rset_countries_no_geoip_cmp_addr_to_policy);
MOCK(geoip_get_country_by_addr,
- rset_contains_countries_no_geoip_geoip_get_country_by_addr);
+ rset_countries_no_geoip_geoip_get_country_by_addr);
set->countries = bitarray_init_zero(1);
bitarray_set(set->countries, 1);
@@ -1056,20 +1082,23 @@ test_rset_contains_countries_no_geoip(void *arg)
routerset_free(set);
tt_int_op(contains, OP_EQ, 0);
- tt_int_op(rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy_called, OP_EQ, 1);
- tt_int_op(rset_contains_countries_no_geoip_geoip_get_country_by_addr_called, OP_EQ, 1);
+ tt_int_op(rset_countries_no_geoip_cmp_addr_to_policy_called,
+ OP_EQ, 1);
+ tt_int_op(rset_countries_no_geoip_geoip_get_country_by_addr_called,
+ OP_EQ, 1);
done:
;
}
addr_policy_result_t
-rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port,
+rset_countries_no_geoip_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
const smartlist_t *policy)
{
(void)port;
(void)policy;
- rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy_called++;
+ rset_countries_no_geoip_cmp_addr_to_policy_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
done:
@@ -1077,9 +1106,9 @@ rset_contains_countries_no_geoip_compare_tor_addr_to_addr_policy(const tor_addr_
}
int
-rset_contains_countries_no_geoip_geoip_get_country_by_addr(const tor_addr_t *addr)
+rset_countries_no_geoip_geoip_get_country_by_addr(const tor_addr_t *addr)
{
- rset_contains_countries_no_geoip_geoip_get_country_by_addr_called++;
+ rset_countries_no_geoip_geoip_get_country_by_addr_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
done:
@@ -1091,22 +1120,25 @@ rset_contains_countries_no_geoip_geoip_get_country_by_addr(const tor_addr_t *add
* for the address.
*/
-static addr_policy_result_t rset_contains_countries_geoip_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port, const smartlist_t *policy);
-ATTR_UNUSED static int rset_contains_countries_geoip_compare_tor_addr_to_addr_policy_called = 0;
-static int rset_contains_countries_geoip_geoip_get_country_by_addr(const tor_addr_t *addr);
-ATTR_UNUSED static int rset_contains_countries_geoip_geoip_get_country_by_addr_called = 0;
+static addr_policy_result_t rset_countries_geoip_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
+ const smartlist_t *policy);
+static int rset_countries_geoip_cmp_addr_to_policy_called = 0;
+static int rset_countries_geoip_geoip_get_country_by_addr(
+ const tor_addr_t *addr);
+static int rset_countries_geoip_geoip_get_country_by_addr_called = 0;
static void
-test_rset_contains_countries_geoip(void *arg)
+test_rset_countries_geoip(void *arg)
{
routerset_t *set = routerset_new();
int contains = 1;
(void)arg;
MOCK(compare_tor_addr_to_addr_policy,
- rset_contains_countries_geoip_compare_tor_addr_to_addr_policy);
+ rset_countries_geoip_cmp_addr_to_policy);
MOCK(geoip_get_country_by_addr,
- rset_contains_countries_geoip_geoip_get_country_by_addr);
+ rset_countries_geoip_geoip_get_country_by_addr);
set->n_countries = 2;
set->countries = bitarray_init_zero(1);
@@ -1115,20 +1147,24 @@ test_rset_contains_countries_geoip(void *arg)
routerset_free(set);
tt_int_op(contains, OP_EQ, 2);
- tt_int_op(rset_contains_countries_geoip_compare_tor_addr_to_addr_policy_called, OP_EQ, 1);
- tt_int_op(rset_contains_countries_geoip_geoip_get_country_by_addr_called, OP_EQ, 1);
+ tt_int_op(
+ rset_countries_geoip_cmp_addr_to_policy_called,
+ OP_EQ, 1);
+ tt_int_op(rset_countries_geoip_geoip_get_country_by_addr_called,
+ OP_EQ, 1);
done:
;
}
addr_policy_result_t
-rset_contains_countries_geoip_compare_tor_addr_to_addr_policy(const tor_addr_t *addr, uint16_t port,
+rset_countries_geoip_cmp_addr_to_policy(
+ const tor_addr_t *addr, uint16_t port,
const smartlist_t *policy)
{
(void)port;
(void)policy;
- rset_contains_countries_geoip_compare_tor_addr_to_addr_policy_called++;
+ rset_countries_geoip_cmp_addr_to_policy_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
done:
@@ -1136,9 +1172,9 @@ rset_contains_countries_geoip_compare_tor_addr_to_addr_policy(const tor_addr_t *
}
int
-rset_contains_countries_geoip_geoip_get_country_by_addr(const tor_addr_t *addr)
+rset_countries_geoip_geoip_get_country_by_addr(const tor_addr_t *addr)
{
- rset_contains_countries_geoip_geoip_get_country_by_addr_called++;
+ rset_countries_geoip_geoip_get_country_by_addr_called++;
tt_ptr_op(addr, OP_EQ, MOCK_TOR_ADDR_PTR);
done:
@@ -1172,8 +1208,9 @@ test_rset_add_unknown_ccs_only_flag(void *arg)
*/
/* The mock is only used to stop the test from asserting erroneously. */
-static country_t rset_add_unknown_ccs_creates_set_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_add_unknown_ccs_creates_set_geoip_get_country_called = 0;
+static country_t rset_add_unknown_ccs_creates_set_geoip_get_country(
+ const char *country);
+static int rset_add_unknown_ccs_creates_set_geoip_get_country_called = 0;
static void
test_rset_add_unknown_ccs_creates_set(void *arg)
@@ -1210,10 +1247,12 @@ rset_add_unknown_ccs_creates_set_geoip_get_country(const char *country)
* country code is added to the list.
*/
-static country_t rset_add_unknown_ccs_add_unknown_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_add_unknown_ccs_add_unknown_geoip_get_country_called = 0;
-static int rset_add_unknown_ccs_add_unknown_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_add_unknown_ccs_add_unknown_geoip_is_loaded_called = 0;
+static country_t rset_add_unknown_ccs_add_unknown_geoip_get_country(
+ const char *country);
+static int rset_add_unknown_ccs_add_unknown_geoip_get_country_called = 0;
+static int rset_add_unknown_ccs_add_unknown_geoip_is_loaded(
+ sa_family_t family);
+static int rset_add_unknown_ccs_add_unknown_geoip_is_loaded_called = 0;
static void
test_rset_add_unknown_ccs_add_unknown(void *arg)
@@ -1274,10 +1313,11 @@ rset_add_unknown_ccs_add_unknown_geoip_is_loaded(sa_family_t family)
* country code is added to the list.
*/
-static country_t rset_add_unknown_ccs_add_a1_geoip_get_country(const char *country);
-ATTR_UNUSED static int rset_add_unknown_ccs_add_a1_geoip_get_country_called = 0;
+static country_t rset_add_unknown_ccs_add_a1_geoip_get_country(
+ const char *country);
+static int rset_add_unknown_ccs_add_a1_geoip_get_country_called = 0;
static int rset_add_unknown_ccs_add_a1_geoip_is_loaded(sa_family_t family);
-ATTR_UNUSED static int rset_add_unknown_ccs_add_a1_geoip_is_loaded_called = 0;
+static int rset_add_unknown_ccs_add_a1_geoip_is_loaded_called = 0;
static void
test_rset_add_unknown_ccs_add_a1(void *arg)
@@ -1427,7 +1467,8 @@ test_rset_contains_none(void *arg)
int r;
(void)arg;
- memset(&rset_contains_none_mock_node, 0, sizeof(rset_contains_none_mock_node));
+ memset(&rset_contains_none_mock_node, 0,
+ sizeof(rset_contains_none_mock_node));
rset_contains_none_mock_node.ri = NULL;
rset_contains_none_mock_node.rs = NULL;
@@ -1533,8 +1574,9 @@ test_rset_get_all_no_routerset(void *arg)
* is empty.
*/
-static const node_t * rset_get_all_l_no_nodes_node_get_by_nickname(const char *nickname, unsigned flags);
-ATTR_UNUSED static int rset_get_all_l_no_nodes_node_get_by_nickname_called = 0;
+static const node_t * rset_get_all_l_no_nodes_node_get_by_nickname(
+ const char *nickname, unsigned flags);
+static int rset_get_all_l_no_nodes_node_get_by_nickname_called = 0;
static const char *rset_get_all_l_no_nodes_mock_nickname;
static void
@@ -1565,7 +1607,8 @@ test_rset_get_all_l_no_nodes(void *arg)
}
const node_t *
-rset_get_all_l_no_nodes_node_get_by_nickname(const char *nickname, unsigned flags)
+rset_get_all_l_no_nodes_node_get_by_nickname(const char *nickname,
+ unsigned flags)
{
rset_get_all_l_no_nodes_node_get_by_nickname_called++;
tt_str_op(nickname, OP_EQ, rset_get_all_l_no_nodes_mock_nickname);
@@ -1580,8 +1623,9 @@ rset_get_all_l_no_nodes_node_get_by_nickname(const char *nickname, unsigned flag
* is set but the nodes are not running.
*/
-static const node_t * rset_get_all_l_not_running_node_get_by_nickname(const char *nickname, unsigned flags);
-ATTR_UNUSED static int rset_get_all_l_not_running_node_get_by_nickname_called = 0;
+static const node_t * rset_get_all_l_not_running_node_get_by_nickname(
+ const char *nickname, unsigned flags);
+static int rset_get_all_l_not_running_node_get_by_nickname_called = 0;
static const char *rset_get_all_l_not_running_mock_nickname;
static node_t rset_get_all_l_not_running_mock_node;
@@ -1614,7 +1658,8 @@ test_rset_get_all_l_not_running(void *arg)
}
const node_t *
-rset_get_all_l_not_running_node_get_by_nickname(const char *nickname, unsigned flags)
+rset_get_all_l_not_running_node_get_by_nickname(const char *nickname,
+ unsigned flags)
{
rset_get_all_l_not_running_node_get_by_nickname_called++;
tt_str_op(nickname, OP_EQ, rset_get_all_l_not_running_mock_nickname);
@@ -1628,8 +1673,9 @@ rset_get_all_l_not_running_node_get_by_nickname(const char *nickname, unsigned f
* Structural test for routerset_get_all_nodes.
*/
-static const node_t * rset_get_all_list_node_get_by_nickname(const char *nickname, unsigned flags);
-ATTR_UNUSED static int rset_get_all_list_node_get_by_nickname_called = 0;
+static const node_t * rset_get_all_list_node_get_by_nickname(
+ const char *nickname, unsigned flags);
+static int rset_get_all_list_node_get_by_nickname_called = 0;
static char *rset_get_all_list_mock_nickname;
static node_t rset_get_all_list_mock_node;
@@ -1679,7 +1725,7 @@ rset_get_all_list_node_get_by_nickname(const char *nickname, unsigned flags)
*/
static const smartlist_t * rset_get_all_n_no_nodes_nodelist_get_list(void);
-ATTR_UNUSED static int rset_get_all_n_no_nodes_nodelist_get_list_called = 0;
+static int rset_get_all_n_no_nodes_nodelist_get_list_called = 0;
static smartlist_t *rset_get_all_n_no_nodes_mock_smartlist;
static void
@@ -1723,7 +1769,7 @@ rset_get_all_n_no_nodes_nodelist_get_list(void)
*/
static const smartlist_t * rset_get_all_n_not_running_nodelist_get_list(void);
-ATTR_UNUSED static int rset_get_all_n_not_running_nodelist_get_list_called = 0;
+static int rset_get_all_n_not_running_nodelist_get_list_called = 0;
static smartlist_t *rset_get_all_n_not_running_mock_smartlist;
static node_t rset_get_all_n_not_running_mock_node;
@@ -1742,7 +1788,8 @@ test_rset_get_all_n_not_running(void *arg)
smartlist_add_strdup(set->country_names, "{xx}");
rset_get_all_n_not_running_mock_smartlist = smartlist_new();
rset_get_all_n_not_running_mock_node.is_running = 0;
- smartlist_add(rset_get_all_n_not_running_mock_smartlist, (void *)&rset_get_all_n_not_running_mock_node);
+ smartlist_add(rset_get_all_n_not_running_mock_smartlist,
+ (void *)&rset_get_all_n_not_running_mock_node);
routerset_get_all_nodes(out, set, NULL, 1);
r = smartlist_len(out);
@@ -1981,7 +2028,7 @@ test_rset_equal_equal(void *arg)
*/
static void rset_free_null_routerset_smartlist_free_(smartlist_t *sl);
-ATTR_UNUSED static int rset_free_null_routerset_smartlist_free__called = 0;
+static int rset_free_null_routerset_smartlist_free__called = 0;
static void
test_rset_free_null_routerset(void *arg)
@@ -2011,11 +2058,12 @@ rset_free_null_routerset_smartlist_free_(smartlist_t *s)
*/
static void rset_free_smartlist_free_(smartlist_t *sl);
-ATTR_UNUSED static int rset_free_smartlist_free__called = 0;
+static int rset_free_smartlist_free__called = 0;
static void rset_free_strmap_free_(strmap_t *map, void (*free_val)(void*));
-ATTR_UNUSED static int rset_free_strmap_free__called = 0;
-static void rset_free_digestmap_free_(digestmap_t *map, void (*free_val)(void*));
-ATTR_UNUSED static int rset_free_digestmap_free__called = 0;
+static int rset_free_strmap_free__called = 0;
+static void rset_free_digestmap_free_(digestmap_t *map,
+ void (*free_val)(void*));
+static int rset_free_digestmap_free__called = 0;
static void
test_rset_free(void *arg)
@@ -2067,56 +2115,84 @@ struct testcase_t routerset_tests[] = {
{ "is_list", test_rset_is_list, TT_FORK, NULL, NULL },
{ "needs_geoip", test_rset_needs_geoip, TT_FORK, NULL, NULL },
{ "is_empty", test_rset_is_empty, TT_FORK, NULL, NULL },
- { "contains_null_set_or_list", test_rset_contains_null_set_or_list, TT_FORK, NULL, NULL },
+ { "contains_null_set_or_list", test_rset_contains_null_set_or_list,
+ TT_FORK, NULL, NULL },
{ "contains_nickname", test_rset_contains_nickname, TT_FORK, NULL, NULL },
- { "contains_null_nickname", test_rset_contains_null_nickname, TT_FORK, NULL, NULL },
- { "contains_no_nickname", test_rset_contains_no_nickname, TT_FORK, NULL, NULL },
+ { "contains_null_nickname", test_rset_contains_null_nickname,
+ TT_FORK, NULL, NULL },
+ { "contains_no_nickname", test_rset_contains_no_nickname,
+ TT_FORK, NULL, NULL },
{ "contains_digest", test_rset_contains_digest, TT_FORK, NULL, NULL },
{ "contains_no_digest", test_rset_contains_no_digest, TT_FORK, NULL, NULL },
- { "contains_null_digest", test_rset_contains_null_digest, TT_FORK, NULL, NULL },
+ { "contains_null_digest", test_rset_contains_null_digest,
+ TT_FORK, NULL, NULL },
{ "contains_addr", test_rset_contains_addr, TT_FORK, NULL, NULL },
{ "contains_no_addr", test_rset_contains_no_addr, TT_FORK, NULL, NULL },
{ "contains_null_addr", test_rset_contains_null_addr, TT_FORK, NULL, NULL },
- { "contains_countries_no_geoip", test_rset_contains_countries_no_geoip, TT_FORK, NULL, NULL },
- { "contains_countries_geoip", test_rset_contains_countries_geoip, TT_FORK, NULL, NULL },
- { "add_unknown_ccs_only_flag", test_rset_add_unknown_ccs_only_flag, TT_FORK, NULL, NULL },
- { "add_unknown_ccs_creates_set", test_rset_add_unknown_ccs_creates_set, TT_FORK, NULL, NULL },
- { "add_unknown_ccs_add_unknown", test_rset_add_unknown_ccs_add_unknown, TT_FORK, NULL, NULL },
- { "add_unknown_ccs_add_a1", test_rset_add_unknown_ccs_add_a1, TT_FORK, NULL, NULL },
- { "contains_extendinfo", test_rset_contains_extendinfo, TT_FORK, NULL, NULL },
+ { "contains_countries_no_geoip", test_rset_countries_no_geoip,
+ TT_FORK, NULL, NULL },
+ { "contains_countries_geoip", test_rset_countries_geoip,
+ TT_FORK, NULL, NULL },
+ { "add_unknown_ccs_only_flag", test_rset_add_unknown_ccs_only_flag,
+ TT_FORK, NULL, NULL },
+ { "add_unknown_ccs_creates_set", test_rset_add_unknown_ccs_creates_set,
+ TT_FORK, NULL, NULL },
+ { "add_unknown_ccs_add_unknown", test_rset_add_unknown_ccs_add_unknown,
+ TT_FORK, NULL, NULL },
+ { "add_unknown_ccs_add_a1", test_rset_add_unknown_ccs_add_a1,
+ TT_FORK, NULL, NULL },
+ { "contains_extendinfo", test_rset_contains_extendinfo,
+ TT_FORK, NULL, NULL },
{ "contains_router", test_rset_contains_router, TT_FORK, NULL, NULL },
- { "contains_routerstatus", test_rset_contains_routerstatus, TT_FORK, NULL, NULL },
+ { "contains_routerstatus", test_rset_contains_routerstatus,
+ TT_FORK, NULL, NULL },
{ "contains_none", test_rset_contains_none, TT_FORK, NULL, NULL },
- { "contains_routerinfo", test_rset_contains_routerinfo, TT_FORK, NULL, NULL },
+ { "contains_routerinfo", test_rset_contains_routerinfo,
+ TT_FORK, NULL, NULL },
{ "contains_rs", test_rset_contains_rs, TT_FORK, NULL, NULL },
- { "get_all_no_routerset", test_rset_get_all_no_routerset, TT_FORK, NULL, NULL },
+ { "get_all_no_routerset", test_rset_get_all_no_routerset,
+ TT_FORK, NULL, NULL },
{ "get_all_l_no_nodes", test_rset_get_all_l_no_nodes, TT_FORK, NULL, NULL },
- { "get_all_l_not_running", test_rset_get_all_l_not_running, TT_FORK, NULL, NULL },
+ { "get_all_l_not_running", test_rset_get_all_l_not_running,
+ TT_FORK, NULL, NULL },
{ "get_all_list", test_rset_get_all_list, TT_FORK, NULL, NULL },
{ "get_all_n_no_nodes", test_rset_get_all_n_no_nodes, TT_FORK, NULL, NULL },
- { "get_all_n_not_running", test_rset_get_all_n_not_running, TT_FORK, NULL, NULL },
- { "refresh_geoip_not_loaded", test_rset_refresh_geoip_not_loaded, TT_FORK, NULL, NULL },
- { "refresh_no_countries", test_rset_refresh_no_countries, TT_FORK, NULL, NULL },
- { "refresh_one_valid_country", test_rset_refresh_one_valid_country, TT_FORK, NULL, NULL },
- { "refresh_one_invalid_country", test_rset_refresh_one_invalid_country, TT_FORK, NULL, NULL },
+ { "get_all_n_not_running", test_rset_get_all_n_not_running,
+ TT_FORK, NULL, NULL },
+ { "refresh_geoip_not_loaded", test_rset_refresh_geoip_not_loaded,
+ TT_FORK, NULL, NULL },
+ { "refresh_no_countries", test_rset_refresh_no_countries,
+ TT_FORK, NULL, NULL },
+ { "refresh_one_valid_country", test_rset_refresh_one_valid_country,
+ TT_FORK, NULL, NULL },
+ { "refresh_one_invalid_country", test_rset_refresh_one_invalid_country,
+ TT_FORK, NULL, NULL },
{ "union_source_bad", test_rset_union_source_bad, TT_FORK, NULL, NULL },
{ "union_one", test_rset_union_one, TT_FORK, NULL, NULL },
{ "parse_malformed", test_rset_parse_malformed, TT_FORK, NULL, NULL },
- { "parse_valid_hexdigest", test_rset_parse_valid_hexdigest, TT_FORK, NULL, NULL },
- { "parse_valid_nickname", test_rset_parse_valid_nickname, TT_FORK, NULL, NULL },
- { "parse_get_countryname", test_rset_parse_get_countryname, TT_FORK, NULL, NULL },
- { "parse_policy_wildcard", test_rset_parse_policy_wildcard, TT_FORK, NULL, NULL },
+ { "parse_valid_hexdigest", test_rset_parse_valid_hexdigest,
+ TT_FORK, NULL, NULL },
+ { "parse_valid_nickname", test_rset_parse_valid_nickname,
+ TT_FORK, NULL, NULL },
+ { "parse_get_countryname", test_rset_parse_get_countryname,
+ TT_FORK, NULL, NULL },
+ { "parse_policy_wildcard", test_rset_parse_policy_wildcard,
+ TT_FORK, NULL, NULL },
{ "parse_policy_ipv4", test_rset_parse_policy_ipv4, TT_FORK, NULL, NULL },
{ "parse_policy_ipv6", test_rset_parse_policy_ipv6, TT_FORK, NULL, NULL },
{ "subtract_nodes", test_rset_subtract_nodes, TT_FORK, NULL, NULL },
- { "subtract_nodes_null_routerset", test_rset_subtract_nodes_null_routerset, TT_FORK, NULL, NULL },
+ { "subtract_nodes_null_routerset", test_rset_subtract_nodes_null_routerset,
+ TT_FORK, NULL, NULL },
{ "to_string", test_rset_to_string, TT_FORK, NULL, NULL },
{ "equal_empty_empty", test_rset_equal_empty_empty, TT_FORK, NULL, NULL },
- { "equal_empty_not_empty", test_rset_equal_empty_not_empty, TT_FORK, NULL, NULL },
- { "equal_differing_lengths", test_rset_equal_differing_lengths, TT_FORK, NULL, NULL },
+ { "equal_empty_not_empty", test_rset_equal_empty_not_empty,
+ TT_FORK, NULL, NULL },
+ { "equal_differing_lengths", test_rset_equal_differing_lengths,
+ TT_FORK, NULL, NULL },
{ "equal_unequal", test_rset_equal_unequal, TT_FORK, NULL, NULL },
{ "equal_equal", test_rset_equal_equal, TT_FORK, NULL, NULL },
- { "free_null_routerset", test_rset_free_null_routerset, TT_FORK, NULL, NULL },
+ { "free_null_routerset", test_rset_free_null_routerset,
+ TT_FORK, NULL, NULL },
{ "free", test_rset_free, TT_FORK, NULL, NULL },
END_OF_TESTCASES
};
diff --git a/src/test/test_status.c b/src/test/test_status.c
index ffce848db..82afe0fd2 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -41,7 +41,6 @@
static smartlist_t * mock_global_circuitlist = NULL;
static smartlist_t * status_count_circuits_circuit_get_global_list(void);
-ATTR_UNUSED static int status_count_circuits_circuit_get_global_list_called = 0;
static void
test_status_count_circuits(void *arg)
@@ -240,13 +239,9 @@ test_status_bytes_to_usage(void *arg)
*/
static double status_hb_fails_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_fails_tls_get_write_overhead_ratio_called = 0;
static int status_hb_fails_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_fails_we_are_hibernating_called = 0;
static int status_hb_fails_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_fails_public_server_mode_called = 0;
static const routerinfo_t * status_hb_fails_router_get_my_routerinfo(void);
-ATTR_UNUSED static int status_hb_fails_router_get_my_routerinfo_called = 0;
static void
test_status_hb_fails(void *arg)
@@ -307,19 +302,17 @@ status_hb_fails_router_get_my_routerinfo(void)
*/
static double status_hb_not_in_consensus_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_not_in_consensus_tls_get_write_overhead_ratio_called = 0;
static int status_hb_not_in_consensus_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_not_in_consensus_we_are_hibernating_called = 0;
-static int status_hb_not_in_consensus_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_not_in_consensus_public_server_mode_called = 0;
-static const routerinfo_t * status_hb_not_in_consensus_router_get_my_routerinfo(void);
-ATTR_UNUSED static int status_hb_not_in_consensus_router_get_my_routerinfo_called = 0;
-static const node_t * status_hb_not_in_consensus_node_get_by_id(const char *identity_digest);
-ATTR_UNUSED static int status_hb_not_in_consensus_node_get_by_id_called = 0;
-static void status_hb_not_in_consensus_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap);
-ATTR_UNUSED static int status_hb_not_in_consensus_logv_called = 0;
+static int status_hb_not_in_consensus_public_server_mode(
+ const or_options_t *options);
+static const routerinfo_t *status_hb_not_in_consensus_get_my_routerinfo(void);
+static const node_t * status_hb_not_in_consensus_node_get_by_id(
+ const char *identity_digest);
+static void status_hb_not_in_consensus_logv(
+ int severity, log_domain_mask_t domain, const char *funcname,
+ const char *suffix, const char *format, va_list ap);
+static int status_hb_not_in_consensus_logv_called = 0;
static int status_hb_not_in_consensus_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_not_in_consensus_server_mode_called = 0;
static routerinfo_t *mock_routerinfo;
@@ -336,7 +329,7 @@ test_status_hb_not_in_consensus(void *arg)
MOCK(public_server_mode,
status_hb_not_in_consensus_public_server_mode);
MOCK(router_get_my_routerinfo,
- status_hb_not_in_consensus_router_get_my_routerinfo);
+ status_hb_not_in_consensus_get_my_routerinfo);
MOCK(node_get_by_id,
status_hb_not_in_consensus_node_get_by_id);
MOCK(logv,
@@ -388,7 +381,7 @@ status_hb_not_in_consensus_public_server_mode(const or_options_t *options)
}
static const routerinfo_t *
-status_hb_not_in_consensus_router_get_my_routerinfo(void)
+status_hb_not_in_consensus_get_my_routerinfo(void)
{
mock_routerinfo = tor_malloc(sizeof(routerinfo_t));
@@ -487,21 +480,16 @@ status_hb_not_in_consensus_server_mode(const or_options_t *options)
*/
static double status_hb_simple_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_simple_tls_get_write_overhead_ratio_called = 0;
static int status_hb_simple_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_simple_we_are_hibernating_called = 0;
static int status_hb_simple_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_simple_public_server_mode_called = 0;
static long status_hb_simple_get_uptime(void);
-ATTR_UNUSED static int status_hb_simple_get_uptime_called = 0;
static uint64_t status_hb_simple_get_bytes_read(void);
-ATTR_UNUSED static int status_hb_simple_get_bytes_read_called = 0;
static uint64_t status_hb_simple_get_bytes_written(void);
-ATTR_UNUSED static int status_hb_simple_get_bytes_written_called = 0;
-static void status_hb_simple_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap);
+static void status_hb_simple_logv(int severity, log_domain_mask_t domain,
+ const char *funcname, const char *suffix,
+ const char *format, va_list ap);
ATTR_UNUSED static int status_hb_simple_logv_called = 0;
static int status_hb_simple_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_simple_server_mode_called = 0;
static int status_hb_simple_n_msgs = 0;
@@ -586,7 +574,8 @@ status_hb_simple_get_bytes_written(void)
}
static void
-status_hb_simple_logv(int severity, log_domain_mask_t domain, const char *funcname,
+status_hb_simple_logv(int severity, log_domain_mask_t domain,
+ const char *funcname,
const char *suffix, const char *format, va_list ap)
{
if (severity == LOG_INFO)
@@ -623,28 +612,25 @@ status_hb_simple_server_mode(const or_options_t *options)
* and accounting information when configured.
*/
-static double status_hb_calls_log_accounting_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_tls_get_write_overhead_ratio_called = 0;
+static double status_hb_calls_log_accounting_tls_get_write_overhead_ratio(
+ void);
static int status_hb_calls_log_accounting_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_we_are_hibernating_called = 0;
-static int status_hb_calls_log_accounting_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_calls_log_accounting_public_server_mode_called = 0;
+static int status_hb_calls_log_accounting_public_server_mode(
+ const or_options_t *options);
static long status_hb_calls_log_accounting_get_uptime(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_get_uptime_called = 0;
static uint64_t status_hb_calls_log_accounting_get_bytes_read(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_get_bytes_read_called = 0;
static uint64_t status_hb_calls_log_accounting_get_bytes_written(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_get_bytes_written_called = 0;
-static void status_hb_calls_log_accounting_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap);
-ATTR_UNUSED static int status_hb_calls_log_accounting_logv_called = 0;
-static int status_hb_calls_log_accounting_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_calls_log_accounting_server_mode_called = 0;
+static void status_hb_calls_log_accounting_logv(
+ int severity, log_domain_mask_t domain,
+ const char *funcname, const char *suffix,
+ const char *format, va_list ap);
+static int status_hb_calls_log_accounting_logv_called = 0;
+static int status_hb_calls_log_accounting_server_mode(
+ const or_options_t *options);
static or_state_t * status_hb_calls_log_accounting_get_or_state(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_get_or_state_called = 0;
-static int status_hb_calls_log_accounting_accounting_is_enabled(const or_options_t *options);
-ATTR_UNUSED static int status_hb_calls_log_accounting_accounting_is_enabled_called = 0;
+static int status_hb_calls_log_accounting_accounting_is_enabled(
+ const or_options_t *options);
static time_t status_hb_calls_log_accounting_accounting_get_end_time(void);
-ATTR_UNUSED static int status_hb_calls_log_accounting_accounting_get_end_time_called = 0;
static or_state_t * status_hb_calls_log_accounting_mock_state = NULL;
static or_options_t * status_hb_calls_log_accounting_mock_options = NULL;
@@ -800,7 +786,8 @@ status_hb_calls_log_accounting_server_mode(const or_options_t *options)
}
static int
-status_hb_calls_log_accounting_accounting_is_enabled(const or_options_t *options)
+status_hb_calls_log_accounting_accounting_is_enabled(
+ const or_options_t *options)
{
(void)options;
@@ -816,9 +803,12 @@ status_hb_calls_log_accounting_accounting_get_end_time(void)
static or_state_t *
status_hb_calls_log_accounting_get_or_state(void)
{
- status_hb_calls_log_accounting_mock_state = tor_malloc_zero(sizeof(or_state_t));
- status_hb_calls_log_accounting_mock_state->AccountingBytesReadInInterval = 0;
- status_hb_calls_log_accounting_mock_state->AccountingBytesWrittenInInterval = 0;
+ status_hb_calls_log_accounting_mock_state =
+ tor_malloc_zero(sizeof(or_state_t));
+ status_hb_calls_log_accounting_mock_state
+ ->AccountingBytesReadInInterval = 0;
+ status_hb_calls_log_accounting_mock_state
+ ->AccountingBytesWrittenInInterval = 0;
return status_hb_calls_log_accounting_mock_state;
}
@@ -828,24 +818,23 @@ status_hb_calls_log_accounting_get_or_state(void)
* fullness information.
*/
-static double status_hb_packaged_cell_fullness_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_tls_get_write_overhead_ratio_called = 0;
+static double status_hb_packaged_cell_fullness_tls_get_write_overhead_ratio(
+ void);
static int status_hb_packaged_cell_fullness_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_we_are_hibernating_called = 0;
-static int status_hb_packaged_cell_fullness_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_public_server_mode_called = 0;
+static int status_hb_packaged_cell_fullness_public_server_mode(
+ const or_options_t *options);
static long status_hb_packaged_cell_fullness_get_uptime(void);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_get_uptime_called = 0;
static uint64_t status_hb_packaged_cell_fullness_get_bytes_read(void);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_get_bytes_read_called = 0;
static uint64_t status_hb_packaged_cell_fullness_get_bytes_written(void);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_get_bytes_written_called = 0;
-static void status_hb_packaged_cell_fullness_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_logv_called = 0;
-static int status_hb_packaged_cell_fullness_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_server_mode_called = 0;
-static int status_hb_packaged_cell_fullness_accounting_is_enabled(const or_options_t *options);
-ATTR_UNUSED static int status_hb_packaged_cell_fullness_accounting_is_enabled_called = 0;
+static void status_hb_packaged_cell_fullness_logv(
+ int severity, log_domain_mask_t domain,
+ const char *funcname, const char *suffix,
+ const char *format, va_list ap);
+static int status_hb_packaged_cell_fullness_logv_called = 0;
+static int status_hb_packaged_cell_fullness_server_mode(
+ const or_options_t *options);
+static int status_hb_packaged_cell_fullness_accounting_is_enabled(
+ const or_options_t *options);
static void
test_status_hb_packaged_cell_fullness(void *arg)
@@ -908,7 +897,8 @@ status_hb_packaged_cell_fullness_we_are_hibernating(void)
}
static int
-status_hb_packaged_cell_fullness_public_server_mode(const or_options_t *options)
+status_hb_packaged_cell_fullness_public_server_mode(
+ const or_options_t *options)
{
(void)options;
@@ -934,7 +924,8 @@ status_hb_packaged_cell_fullness_get_bytes_written(void)
}
static void
-status_hb_packaged_cell_fullness_logv(int severity, log_domain_mask_t domain, const char *funcname,
+status_hb_packaged_cell_fullness_logv(int severity,
+ log_domain_mask_t domain, const char *funcname,
const char *suffix, const char *format, va_list ap)
{
switch (status_hb_packaged_cell_fullness_logv_called)
@@ -982,7 +973,8 @@ status_hb_packaged_cell_fullness_server_mode(const or_options_t *options)
}
static int
-status_hb_packaged_cell_fullness_accounting_is_enabled(const or_options_t *options)
+status_hb_packaged_cell_fullness_accounting_is_enabled(
+ const or_options_t *options)
{
(void)options;
@@ -995,23 +987,21 @@ status_hb_packaged_cell_fullness_accounting_is_enabled(const or_options_t *optio
*/
static double status_hb_tls_write_overhead_tls_get_write_overhead_ratio(void);
-ATTR_UNUSED static int status_hb_tls_write_overhead_tls_get_write_overhead_ratio_called = 0;
static int status_hb_tls_write_overhead_we_are_hibernating(void);
-ATTR_UNUSED static int status_hb_tls_write_overhead_we_are_hibernating_called = 0;
-static int status_hb_tls_write_overhead_public_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_tls_write_overhead_public_server_mode_called = 0;
+static int status_hb_tls_write_overhead_public_server_mode(
+ const or_options_t *options);
static long status_hb_tls_write_overhead_get_uptime(void);
-ATTR_UNUSED static int status_hb_tls_write_overhead_get_uptime_called = 0;
static uint64_t status_hb_tls_write_overhead_get_bytes_read(void);
-ATTR_UNUSED static int status_hb_tls_write_overhead_get_bytes_read_called = 0;
static uint64_t status_hb_tls_write_overhead_get_bytes_written(void);
-ATTR_UNUSED static int status_hb_tls_write_overhead_get_bytes_written_called = 0;
-static void status_hb_tls_write_overhead_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap);
-ATTR_UNUSED static int status_hb_tls_write_overhead_logv_called = 0;
-static int status_hb_tls_write_overhead_server_mode(const or_options_t *options);
-ATTR_UNUSED static int status_hb_tls_write_overhead_server_mode_called = 0;
-static int status_hb_tls_write_overhead_accounting_is_enabled(const or_options_t *options);
-ATTR_UNUSED static int status_hb_tls_write_overhead_accounting_is_enabled_called = 0;
+static void status_hb_tls_write_overhead_logv(
+ int severity, log_domain_mask_t domain,
+ const char *funcname, const char *suffix,
+ const char *format, va_list ap);
+static int status_hb_tls_write_overhead_logv_called = 0;
+static int status_hb_tls_write_overhead_server_mode(
+ const or_options_t *options);
+static int status_hb_tls_write_overhead_accounting_is_enabled(
+ const or_options_t *options);
static void
test_status_hb_tls_write_overhead(void *arg)
@@ -1158,9 +1148,13 @@ struct testcase_t status_tests[] = {
{ "bytes_to_usage", test_status_bytes_to_usage, TT_FORK, NULL, NULL },
{ "hb_fails", test_status_hb_fails, TT_FORK, NULL, NULL },
{ "hb_simple", test_status_hb_simple, TT_FORK, NULL, NULL },
- { "hb_not_in_consensus", test_status_hb_not_in_consensus, TT_FORK, NULL, NULL },
- { "hb_calls_log_accounting", test_status_hb_calls_log_accounting, TT_FORK, NULL, NULL },
- { "hb_packaged_cell_fullness", test_status_hb_packaged_cell_fullness, TT_FORK, NULL, NULL },
- { "hb_tls_write_overhead", test_status_hb_tls_write_overhead, TT_FORK, NULL, NULL },
+ { "hb_not_in_consensus", test_status_hb_not_in_consensus,
+ TT_FORK, NULL, NULL },
+ { "hb_calls_log_accounting", test_status_hb_calls_log_accounting,
+ TT_FORK, NULL, NULL },
+ { "hb_packaged_cell_fullness", test_status_hb_packaged_cell_fullness,
+ TT_FORK, NULL, NULL },
+ { "hb_tls_write_overhead", test_status_hb_tls_write_overhead,
+ TT_FORK, NULL, NULL },
END_OF_TESTCASES
};