summaryrefslogtreecommitdiff
path: root/src/test/test_rendcache.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_rendcache.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_rendcache.c')
-rw-r--r--src/test/test_rendcache.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 17d86bc39e..a5d3f351f8 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -647,7 +647,6 @@ test_rend_cache_init(void *data)
static void
test_rend_cache_decrement_allocation(void *data)
{
- int log_level = 0;
(void)data;
// Test when the cache has enough allocations
@@ -657,27 +656,24 @@ test_rend_cache_decrement_allocation(void *data)
// Test when there are not enough allocations
rend_cache_total_allocation = 1;
- log_level = setup_full_capture_of_logs(LOG_WARN);
+ setup_full_capture_of_logs(LOG_WARN);
rend_cache_decrement_allocation(2);
tt_int_op(rend_cache_total_allocation, OP_EQ, 0);
expect_single_log_msg_containing(
"Underflow in rend_cache_decrement_allocation");
- teardown_capture_of_logs(log_level);
- log_level = 0;
+ teardown_capture_of_logs();
// And again
rend_cache_decrement_allocation(2);
tt_int_op(rend_cache_total_allocation, OP_EQ, 0);
done:
- if (log_level)
- teardown_capture_of_logs(log_level);
+ teardown_capture_of_logs();
}
static void
test_rend_cache_increment_allocation(void *data)
{
- int log_level = 0;
(void)data;
// Test when the cache is not overflowing
@@ -687,21 +683,19 @@ test_rend_cache_increment_allocation(void *data)
// Test when there are too many allocations
rend_cache_total_allocation = SIZE_MAX-1;
- log_level = setup_full_capture_of_logs(LOG_WARN);
+ setup_full_capture_of_logs(LOG_WARN);
rend_cache_increment_allocation(2);
tt_u64_op(rend_cache_total_allocation, OP_EQ, SIZE_MAX);
expect_single_log_msg_containing(
"Overflow in rend_cache_increment_allocation");
- teardown_capture_of_logs(log_level);
- log_level = 0;
+ teardown_capture_of_logs();
// And again
rend_cache_increment_allocation(2);
tt_u64_op(rend_cache_total_allocation, OP_EQ, SIZE_MAX);
done:
- if (log_level)
- teardown_capture_of_logs(log_level);
+ teardown_capture_of_logs();
}
static void