diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-01-16 15:54:31 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-01-16 15:54:31 -0500 |
commit | 3baf99e81bcded352b8e8a3416148e53a4801a11 (patch) | |
tree | b5869df802d469f6a43808ae867689d9f207b531 /src/test/testing_common.c | |
parent | 16430fdaf546cf8a2711a4c87380398bd4358d54 (diff) | |
parent | f684cd800577144a48e112951eaf4ddc602ad26a (diff) | |
download | tor-3baf99e81bcded352b8e8a3416148e53a4801a11.tar.gz tor-3baf99e81bcded352b8e8a3416148e53a4801a11.zip |
Merge branch 'ticket28668_035' into ticket28668_040
Diffstat (limited to 'src/test/testing_common.c')
-rw-r--r-- | src/test/testing_common.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/testing_common.c b/src/test/testing_common.c index 4e603b529a..8fc8ef7830 100644 --- a/src/test/testing_common.c +++ b/src/test/testing_common.c @@ -241,6 +241,15 @@ tinytest_postfork(void) init_pregenerated_keys(); } +static void +log_callback_failure(int severity, uint32_t domain, const char *msg) +{ + (void)msg; + if (severity == LOG_ERR || (domain & LD_BUG)) { + tinytest_set_test_failed_(); + } +} + /** Main entry point for unit test code: parse the command line, and run * some unit tests. */ int @@ -280,6 +289,7 @@ main(int c, const char **v) c = i_out; { + /* setup logs to stdout */ log_severity_list_t s; memset(&s, 0, sizeof(s)); set_log_severity_config(loglevel, LOG_ERR, &s); @@ -287,6 +297,14 @@ main(int c, const char **v) s.masks[LOG_WARN-LOG_ERR] |= LD_BUG; add_stream_log(&s, "", fileno(stdout)); } + { + /* Setup logs that cause failure. */ + log_severity_list_t s; + memset(&s, 0, sizeof(s)); + set_log_severity_config(LOG_ERR, LOG_ERR, &s); + s.masks[LOG_WARN-LOG_ERR] |= LD_BUG; + add_callback_log(&s, log_callback_failure); + } flush_log_messages_from_startup(); init_protocol_warning_severity_level(); |