summaryrefslogtreecommitdiff
path: root/src/test/test_dir.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-08 15:01:32 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-08 15:03:11 -0400
commitdeb294ff532d074a7d4094518c296fe69f819874 (patch)
tree3a49b6c30ab041807a025fa463ff57ca328165db /src/test/test_dir.c
parentb0a9e54705d16d08ae7aff272492832dbb35646d (diff)
downloadtor-deb294ff532d074a7d4094518c296fe69f819874.tar.gz
tor-deb294ff532d074a7d4094518c296fe69f819874.zip
Simplify log_test_helpers interface
Previously, you needed to store the previous log severity in a local variable, and it wasn't clear if you were allowed to call these functions more than once.
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r--src/test/test_dir.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 0afc0b7129..4a6c5a9b5a 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -3269,7 +3269,6 @@ static void
test_dir_fetch_type(void *arg)
{
(void)arg;
- int log_level = 0;
tt_int_op(dir_fetch_type(DIR_PURPOSE_FETCH_EXTRAINFO, ROUTER_PURPOSE_BRIDGE,
NULL), OP_EQ, EXTRAINFO_DIRINFO | BRIDGE_DIRINFO);
@@ -3298,13 +3297,12 @@ test_dir_fetch_type(void *arg)
/* This will give a warning, because this function isn't supposed to be
* used for HS descriptors. */
- log_level = setup_full_capture_of_logs(LOG_WARN);
+ setup_full_capture_of_logs(LOG_WARN);
tt_int_op(dir_fetch_type(DIR_PURPOSE_FETCH_RENDDESC_V2,
ROUTER_PURPOSE_GENERAL, NULL), OP_EQ, NO_DIRINFO);
expect_single_log_msg_containing("Unexpected purpose");
done:
- if (log_level)
- teardown_capture_of_logs(log_level);
+ teardown_capture_of_logs();
}
static void
@@ -3972,7 +3970,6 @@ static void
test_dir_conn_purpose_to_string(void *data)
{
(void)data;
- int log_level = 0;
#define EXPECT_CONN_PURPOSE(purpose, expected) \
tt_str_op(dir_conn_purpose_to_string(purpose), OP_EQ, expected);
@@ -3996,13 +3993,12 @@ test_dir_conn_purpose_to_string(void *data)
EXPECT_CONN_PURPOSE(DIR_PURPOSE_FETCH_MICRODESC, "microdescriptor fetch");
/* This will give a warning, because there is no purpose 1024. */
- log_level = setup_full_capture_of_logs(LOG_WARN);
+ setup_full_capture_of_logs(LOG_WARN);
EXPECT_CONN_PURPOSE(1024, "(unknown)");
expect_single_log_msg_containing("Called with unknown purpose 1024");
done:
- if (log_level)
- teardown_capture_of_logs(log_level);
+ teardown_capture_of_logs();
}
NS_DECL(int,