diff options
author | juga0 <juga@riseup.net> | 2018-06-09 10:34:17 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-01 18:47:20 -0400 |
commit | 842b18ab26ac12da7e63c38413d193905b8fbed5 (patch) | |
tree | 456c33e458821be1682860c03355c98fbd0af7bf /src/test/log_test_helpers.c | |
parent | bbb82a52491de244fbdf5d7b6f22ae26f8b4ea19 (diff) | |
download | tor-842b18ab26ac12da7e63c38413d193905b8fbed5.tar.gz tor-842b18ab26ac12da7e63c38413d193905b8fbed5.zip |
Add test log helpers for msgs not containing str
Diffstat (limited to 'src/test/log_test_helpers.c')
-rw-r--r-- | src/test/log_test_helpers.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/test/log_test_helpers.c b/src/test/log_test_helpers.c index c788a33c17..c5368b6cbc 100644 --- a/src/test/log_test_helpers.c +++ b/src/test/log_test_helpers.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2016, The Tor Project, Inc. */ +/* Copyright (c) 2015-2018, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define LOG_PRIVATE #include "torlog.h" @@ -158,6 +158,26 @@ mock_saved_log_has_message_containing(const char *msg) return 0; } +/** + * Return true iff there is not a message recorded by log capture + * that contains <b>msg</b> as a substring. + */ +int +mock_saved_log_has_message_not_containing(const char *msg) +{ + if (saved_logs) { + SMARTLIST_FOREACH( + saved_logs, mock_saved_log_entry_t *, m, + { + if (msg && m->generated_msg && strstr(m->generated_msg, msg)) + return 0; + } + ); + } + + return 1; +} + /** Return true iff the saved logs have any messages with <b>severity</b> */ int mock_saved_log_has_severity(int severity) |