aboutsummaryrefslogtreecommitdiff
path: root/src/test/log_test_helpers.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-08-31 12:51:22 -0400
committerNick Mathewson <nickm@torproject.org>2016-08-31 12:51:22 -0400
commitf74916a98f97c7e80e46400e921d54466285d1fb (patch)
treedc1859cd46e31bdc36289f6b7a0f2207e90d6d2e /src/test/log_test_helpers.h
parent1f7dc823c5077101e4b0760ded1d7259d57d7506 (diff)
downloadtor-f74916a98f97c7e80e46400e921d54466285d1fb.tar.gz
tor-f74916a98f97c7e80e46400e921d54466285d1fb.zip
setup_capture_of_logs: no longer suppress log messages
Previously setup_capture_of_logs would prevent log messages from going to the console entirely. That's a problem, since sometimes log messages are bugs! Now setup_capture_of_logs() acts sensibly. If you really do need to keep a message from going to the console entirely, there is setup_full_capture_of_logs(). But only use that if you're prepared to make sure that there are no extraneous messages generated at all.
Diffstat (limited to 'src/test/log_test_helpers.h')
-rw-r--r--src/test/log_test_helpers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/log_test_helpers.h b/src/test/log_test_helpers.h
index d767453a6e..2cb76b2767 100644
--- a/src/test/log_test_helpers.h
+++ b/src/test/log_test_helpers.h
@@ -22,6 +22,7 @@ void mock_saving_logv(int severity, log_domain_mask_t domain,
void mock_clean_saved_logs(void);
const smartlist_t *mock_saved_logs(void);
int setup_capture_of_logs(int new_level);
+int setup_full_capture_of_logs(int new_level);
void teardown_capture_of_logs(int prev);
int mock_saved_log_has_message(const char *msg);
@@ -33,6 +34,10 @@ int mock_saved_log_has_entry(void);
tt_assert_msg(mock_saved_log_has_message(str), \
"expected log to contain " # str);
+#define expect_log_msg_containing(str) \
+ tt_assert_msg(mock_saved_log_has_message_containing(str), \
+ "expected log to contain " # str);
+
#define expect_no_log_msg(str) \
tt_assert_msg(!mock_saved_log_has_message(str), \
"expected log to not contain " # str);