mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
tt_* macros can "goto done;" so define any freeable things before them.
This commit is contained in:
parent
ff1af5550a
commit
dcfed8c1c8
@ -4815,6 +4815,7 @@ test_config_include_limit(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_limit"));
|
char *dir = tor_strdup(get_fname("test_include_limit"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -4831,7 +4832,6 @@ test_config_include_limit(void *data)
|
|||||||
torrc_path);
|
torrc_path);
|
||||||
tt_int_op(write_str_to_file(torrc_path, torrc_contents, 0), OP_EQ, 0);
|
tt_int_op(write_str_to_file(torrc_path, torrc_contents, 0), OP_EQ, 0);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
||||||
OP_EQ, -1);
|
OP_EQ, -1);
|
||||||
|
|
||||||
@ -4845,6 +4845,7 @@ test_config_include_does_not_exist(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_does_not_exist"));
|
char *dir = tor_strdup(get_fname("test_include_does_not_exist"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -4861,7 +4862,6 @@ test_config_include_does_not_exist(void *data)
|
|||||||
tor_snprintf(torrc_contents, sizeof(torrc_contents), "%%include %s",
|
tor_snprintf(torrc_contents, sizeof(torrc_contents), "%%include %s",
|
||||||
missing_path);
|
missing_path);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
||||||
OP_EQ, -1);
|
OP_EQ, -1);
|
||||||
|
|
||||||
@ -4874,6 +4874,7 @@ static void
|
|||||||
test_config_include_error_in_included_file(void *data)
|
test_config_include_error_in_included_file(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
config_line_t *result = NULL;
|
||||||
|
|
||||||
char *dir = tor_strdup(get_fname("test_error_in_included_file"));
|
char *dir = tor_strdup(get_fname("test_error_in_included_file"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
@ -4893,7 +4894,6 @@ test_config_include_error_in_included_file(void *data)
|
|||||||
tor_snprintf(torrc_contents, sizeof(torrc_contents), "%%include %s",
|
tor_snprintf(torrc_contents, sizeof(torrc_contents), "%%include %s",
|
||||||
invalid_path);
|
invalid_path);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0, NULL),
|
||||||
OP_EQ, -1);
|
OP_EQ, -1);
|
||||||
|
|
||||||
@ -4906,6 +4906,7 @@ static void
|
|||||||
test_config_include_empty_file_folder(void *data)
|
test_config_include_empty_file_folder(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
config_line_t *result = NULL;
|
||||||
|
|
||||||
char *dir = tor_strdup(get_fname("test_include_empty_file_folder"));
|
char *dir = tor_strdup(get_fname("test_include_empty_file_folder"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
@ -4935,7 +4936,6 @@ test_config_include_empty_file_folder(void *data)
|
|||||||
"%%include %s\n",
|
"%%include %s\n",
|
||||||
folder_path, file_path);
|
folder_path, file_path);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
@ -4952,6 +4952,7 @@ test_config_include_recursion_before_after(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_recursion_before_after"));
|
char *dir = tor_strdup(get_fname("test_include_recursion_before_after"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -4987,7 +4988,6 @@ test_config_include_recursion_before_after(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
tt_int_op(config_get_lines_include(file_contents, &result, 0, &include_used),
|
tt_int_op(config_get_lines_include(file_contents, &result, 0, &include_used),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
@ -5015,6 +5015,7 @@ test_config_include_recursion_after_only(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_recursion_after_only"));
|
char *dir = tor_strdup(get_fname("test_include_recursion_after_only"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -5050,7 +5051,6 @@ test_config_include_recursion_after_only(void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
tt_int_op(config_get_lines_include(file_contents, &result, 0, &include_used),
|
tt_int_op(config_get_lines_include(file_contents, &result, 0, &include_used),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
@ -5078,6 +5078,7 @@ test_config_include_folder_order(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_folder_order"));
|
char *dir = tor_strdup(get_fname("test_include_folder_order"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -5134,7 +5135,6 @@ test_config_include_folder_order(void *data)
|
|||||||
"%%include %s\n",
|
"%%include %s\n",
|
||||||
torrcd);
|
torrcd);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
@ -5162,6 +5162,7 @@ test_config_include_path_syntax(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_path_syntax"));
|
char *dir = tor_strdup(get_fname("test_include_path_syntax"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -5178,7 +5179,6 @@ test_config_include_path_syntax(void *data)
|
|||||||
"%%include \"%s"PATH_SEPARATOR"\"\n",
|
"%%include \"%s"PATH_SEPARATOR"\"\n",
|
||||||
dir, dir, dir);
|
dir, dir, dir);
|
||||||
|
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
||||||
OP_EQ, 0);
|
OP_EQ, 0);
|
||||||
@ -5218,6 +5218,7 @@ test_config_include_has_include(void *data)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
|
config_line_t *result = NULL;
|
||||||
char *dir = tor_strdup(get_fname("test_include_has_include"));
|
char *dir = tor_strdup(get_fname("test_include_has_include"));
|
||||||
tt_ptr_op(dir, OP_NE, NULL);
|
tt_ptr_op(dir, OP_NE, NULL);
|
||||||
|
|
||||||
@ -5228,7 +5229,6 @@ test_config_include_has_include(void *data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char torrc_contents[1000] = "Test 1\n";
|
char torrc_contents[1000] = "Test 1\n";
|
||||||
config_line_t *result = NULL;
|
|
||||||
int include_used;
|
int include_used;
|
||||||
|
|
||||||
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
tt_int_op(config_get_lines_include(torrc_contents, &result, 0,&include_used),
|
||||||
|
Loading…
Reference in New Issue
Block a user