test: Hide some test-declaration macro definitions to COCCI.

(These ones cause parsing failures.)
This commit is contained in:
Nick Mathewson 2019-10-09 10:58:03 -04:00
parent 6696a5bbae
commit 4fad456148
11 changed files with 26 additions and 0 deletions

View File

@ -1662,8 +1662,10 @@ test_addr_rfc6598(void *arg)
;
}
#ifndef COCCI
#define ADDR_LEGACY(name) \
{ #name, test_addr_ ## name , 0, NULL, NULL }
#endif
struct testcase_t addr_tests[] = {
ADDR_LEGACY(basic),

View File

@ -1027,12 +1027,14 @@ test_confparse_find_option_name(void *arg)
config_mgr_free(mgr);
}
#ifndef COCCI
#define CONFPARSE_TEST(name, flags) \
{ #name, test_confparse_ ## name, flags, NULL, NULL }
#define BADVAL_TEST(name) \
{ "badval_" #name, test_confparse_assign_badval, 0, \
&passthrough_setup, (void*)&bv_ ## name }
#endif
struct testcase_t confparse_tests[] = {
CONFPARSE_TEST(init, 0),

View File

@ -881,12 +881,14 @@ test_failed_orconn_tracker(void *arg)
;
}
#ifndef COCCI
#define CONNECTION_TESTCASE(name, fork, setup) \
{ #name, test_conn_##name, fork, &setup, NULL }
/* where arg is an expression (constant, variable, compound expression) */
#define CONNECTION_TESTCASE_ARG(name, fork, setup, arg) \
{ #name "_" #arg, test_conn_##name, fork, &setup, (void *)arg }
#endif
struct testcase_t connection_tests[] = {
CONNECTION_TESTCASE(get_basic, TT_FORK, test_conn_get_basic_st),

View File

@ -119,6 +119,7 @@ test_controller_parse_cmd(void *arg)
control_cmd_args_free(result);
}
#ifndef COCCI
#define OK(inp, out) \
{ inp "\r\n", out, NULL }
#define ERR(inp, err) \
@ -128,6 +129,7 @@ test_controller_parse_cmd(void *arg)
{ &syntax, \
ARRAY_LENGTH(array), \
array }
#endif
static const parser_testcase_t one_to_three_tests[] = {
ERR("", "Need at least 1 argument(s)"),
@ -1818,9 +1820,11 @@ test_getinfo_md_all(void *arg)
return;
}
#ifndef COCCI
#define PARSER_TEST(type) \
{ "parse/" #type, test_controller_parse_cmd, 0, &passthrough_setup, \
(void*)&parse_ ## type ## _params }
#endif
struct testcase_t controller_tests[] = {
PARSER_TEST(one_to_three),

View File

@ -2971,6 +2971,7 @@ test_crypto_failure_modes(void *arg)
;
}
#ifndef COCCI
#define CRYPTO_LEGACY(name) \
{ #name, test_crypto_ ## name , 0, NULL, NULL }
@ -2981,6 +2982,7 @@ test_crypto_failure_modes(void *arg)
#define ED25519_TEST(name, fl) \
ED25519_TEST_ONE(name, (fl), "donna"), \
ED25519_TEST_ONE(name, (fl), "ref10")
#endif
struct testcase_t crypto_tests[] = {
CRYPTO_LEGACY(formats),

View File

@ -584,6 +584,7 @@ test_crypto_ed25519_fuzz_donna(void *arg)
;
}
#ifndef COCCI
#define CRYPTO_LEGACY(name) \
{ #name, test_crypto_ ## name , 0, NULL, NULL }
@ -594,6 +595,7 @@ test_crypto_ed25519_fuzz_donna(void *arg)
#define ED25519_TEST(name, fl) \
ED25519_TEST_ONE(name, (fl), "donna"), \
ED25519_TEST_ONE(name, (fl), "ref10")
#endif
struct testcase_t slow_crypto_tests[] = {
CRYPTO_LEGACY(s2k_rfc2440),

View File

@ -7210,6 +7210,7 @@ test_dir_format_versions_list(void *arg)
teardown_capture_of_logs();
}
#ifndef COCCI
#define DIR_LEGACY(name) \
{ #name, test_dir_ ## name , TT_FORK, NULL, NULL }
@ -7219,6 +7220,7 @@ test_dir_format_versions_list(void *arg)
/* where arg is a string constant */
#define DIR_ARG(name,flags,arg) \
{ #name "_" arg, test_dir_##name, (flags), &passthrough_setup, (void*) arg }
#endif
struct testcase_t dir_tests[] = {
DIR_LEGACY(nicknames),

View File

@ -3038,6 +3038,7 @@ static const struct testcase_setup_t upgrade_circuits = {
upgrade_circuits_setup, upgrade_circuits_cleanup
};
#ifndef COCCI
#define NO_PREFIX_TEST(name) \
{ #name, test_ ## name, 0, NULL, NULL }
@ -3060,6 +3061,7 @@ static const struct testcase_setup_t upgrade_circuits = {
&upgrade_circuits, (void*)(arg REASONABLY_FUTURE) }, \
{ #name "_reasonably_past", test_entry_guard_ ## name, TT_FORK, \
&upgrade_circuits, (void*)(arg REASONABLY_PAST) }
#endif
struct testcase_t entrynodes_tests[] = {
NO_PREFIX_TEST(node_preferred_orport),

View File

@ -1492,6 +1492,7 @@ AUTHENTICATE_FAIL(missing_ed_auth,
"authentication certificate";
})
#ifndef COCCI
#define TEST_RSA(name, flags) \
{ #name , test_link_handshake_ ## name, (flags), \
&passthrough_setup, (void*)"RSA" }
@ -1527,6 +1528,7 @@ AUTHENTICATE_FAIL(missing_ed_auth,
#define TEST_AUTHENTICATE_ED(name) \
{ "authenticate/" #name "_ed25519" , test_link_handshake_auth_ ## name, \
TT_FORK, &setup_authenticate, (void*)3 }
#endif
struct testcase_t link_handshake_tests[] = {
TEST_RSA(certs_ok, TT_FORK),

View File

@ -4163,8 +4163,10 @@ test_options_validate__accel(void *ignored)
tor_free(msg);
}
#ifndef COCCI
#define LOCAL_VALIDATE_TEST(name) \
{ "validate__" #name, test_options_validate__ ## name, TT_FORK, NULL, NULL }
#endif
struct testcase_t options_tests[] = {
{ "validate", test_options_validate, TT_FORK, NULL, NULL },

View File

@ -304,6 +304,7 @@ test_util_write_chunks_to_file(void *arg)
tor_free(temp_str);
}
#ifndef COCCI
#define _TFE(a, b, f) tt_int_op((a).f, OP_EQ, (b).f)
/** test the minimum set of struct tm fields needed for a unique epoch value
* this is also the set we use to test tor_timegm */
@ -316,6 +317,7 @@ test_util_write_chunks_to_file(void *arg)
_TFE(a, b, tm_min ); \
_TFE(a, b, tm_sec ); \
TT_STMT_END
#endif
static void
test_util_time(void *arg)
@ -6256,6 +6258,7 @@ test_util_map_anon_nofork(void *arg)
#endif /* defined(_WIN32) */
}
#ifndef COCCI
#define UTIL_LEGACY(name) \
{ #name, test_util_ ## name , 0, NULL, NULL }
@ -6280,6 +6283,7 @@ test_util_map_anon_nofork(void *arg)
{ "compress_dos/" #name, test_util_decompress_dos, 0, \
&compress_setup, \
(char*)(identifier) }
#endif
#ifdef _WIN32
#define UTIL_TEST_NO_WIN(n, f) { #n, NULL, TT_SKIP, NULL, NULL }