From deb294ff532d074a7d4094518c296fe69f819874 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 8 Sep 2016 15:01:32 -0400 Subject: 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. --- src/test/test_rendcache.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/test/test_rendcache.c') 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 -- cgit v1.2.3-54-g00ecf