diff options
author | Ola Bini <ola@olabini.se> | 2016-01-29 11:38:54 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-02-01 09:50:42 -0500 |
commit | fe92e9bb9647123381a8428ed438283fb1a749f4 (patch) | |
tree | f5b8292d542390ca774300911a919e30264d5cdc /src/test/log_test_helpers.c | |
parent | a5bed4dab2f8521f744d5137e4f439b073c7e5e9 (diff) | |
download | tor-fe92e9bb9647123381a8428ed438283fb1a749f4.tar.gz tor-fe92e9bb9647123381a8428ed438283fb1a749f4.zip |
Add a helper to search for strings in the log, and change option tests to use this helper instead of looking at specific indices in the log list
Diffstat (limited to 'src/test/log_test_helpers.c')
-rw-r--r-- | src/test/log_test_helpers.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/log_test_helpers.c b/src/test/log_test_helpers.c index 51b5f9b7b1..88d28e1cc0 100644 --- a/src/test/log_test_helpers.c +++ b/src/test/log_test_helpers.c @@ -83,6 +83,23 @@ mock_saved_logs(void) return saved_logs; } +int +mock_saved_log_has_message(const char *msg) +{ + int has_msg = 0; + if (saved_logs) { + SMARTLIST_FOREACH(saved_logs, mock_saved_log_entry_t *, m, + { + if (msg && m->generated_msg && + !strcmp(msg, m->generated_msg)) { + has_msg = 1; + } + }); + } + + return has_msg; +} + void mock_saving_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, |