diff options
author | dana koch <dsk@google.com> | 2014-04-15 22:20:34 +1000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-15 15:00:34 -0400 |
commit | 3ce3984772b673b82a87aded1bc8a1a0f1969e19 (patch) | |
tree | ae9e005f34ae81ff04c006ef179575de5b277bb8 /src/common/log.c | |
parent | 2704441e7ff1242d168bc14dda946fc41844f2c5 (diff) | |
download | tor-3ce3984772b673b82a87aded1bc8a1a0f1969e19.tar.gz tor-3ce3984772b673b82a87aded1bc8a1a0f1969e19.zip |
Uplift status.c unit test coverage with new test cases and macros.
A new set of unit test cases are provided, as well as introducing
an alternative paradigm and macros to support it. Primarily, each test
case is given its own namespace, in order to isolate tests from each
other. We do this by in the usual fashion, by appending module and
submodule names to our symbols. New macros assist by reducing friction
for this and other tasks, like overriding a function in the global
namespace with one in the current namespace, or declaring integer
variables to assist tracking how many times a mock has been called.
A set of tests for a small-scale module has been included in this
commit, in order to highlight how the paradigm can be used. This
suite gives 100% coverage to status.c in test execution.
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/common/log.c b/src/common/log.c index a837cf86a7..592dc2c5d4 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -147,9 +147,6 @@ static INLINE char *format_msg(char *buf, size_t buf_len, const char *suffix, const char *format, va_list ap, size_t *msg_len_out) CHECK_PRINTF(7,0); -static void logv(int severity, log_domain_mask_t domain, const char *funcname, - const char *suffix, const char *format, va_list ap) - CHECK_PRINTF(5,0); /** Name of the application: used to generate the message we write at the * start of each new log. */ @@ -336,9 +333,9 @@ format_msg(char *buf, size_t buf_len, * <b>severity</b>. If provided, <b>funcname</b> is prepended to the * message. The actual message is derived as from tor_snprintf(format,ap). */ -static void -logv(int severity, log_domain_mask_t domain, const char *funcname, - const char *suffix, const char *format, va_list ap) +MOCK_IMPL(STATIC void, +logv,(int severity, log_domain_mask_t domain, const char *funcname, + const char *suffix, const char *format, va_list ap)) { char buf[10024]; size_t msg_len = 0; |