aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_guardfraction.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_guardfraction.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_guardfraction.c')
-rw-r--r--src/test/test_guardfraction.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c
index 3cc83f91c4..8173e44d47 100644
--- a/src/test/test_guardfraction.c
+++ b/src/test/test_guardfraction.c
@@ -281,7 +281,6 @@ test_parse_guardfraction_consensus(void *arg)
const char *guardfraction_str_bad2 = "GuardFraction=166"; /* no percentage */
routerstatus_t rs_bad2;
- int log_level = 0;
(void) arg;
/* GuardFraction use is currently disabled by default. So we need to
@@ -306,7 +305,7 @@ test_parse_guardfraction_consensus(void *arg)
memset(&rs_no_guard, 0, sizeof(routerstatus_t));
tt_assert(!rs_no_guard.is_possible_guard);
- log_level = setup_full_capture_of_logs(LOG_WARN);
+ setup_full_capture_of_logs(LOG_WARN);
retval = routerstatus_parse_guardfraction(guardfraction_str_good,
NULL, NULL,
&rs_no_guard);
@@ -314,8 +313,7 @@ test_parse_guardfraction_consensus(void *arg)
tt_assert(!rs_no_guard.has_guardfraction);
expect_single_log_msg_containing("Got GuardFraction for non-guard . "
"This is not supposed to happen.");
- teardown_capture_of_logs(log_level);
- log_level = 0;
+ teardown_capture_of_logs();
}
{ /* Bad GuardFraction. Function should fail and not apply. */
@@ -341,8 +339,7 @@ test_parse_guardfraction_consensus(void *arg)
}
done:
- if (log_level)
- teardown_capture_of_logs(log_level);
+ teardown_capture_of_logs();
}
/** Make sure that we use GuardFraction information when we should,