diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-11-27 12:36:17 +1100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-11-27 14:44:09 +1100 |
commit | b7f70bc25d62bf2bb9af2c050b3be9186aa289e3 (patch) | |
tree | 024abc33d3d28a5b423e5e2ef05572731e329717 | |
parent | 85efe896978ee19ee26102c17a47a1f2a1d30eed (diff) | |
download | libgit2-ethomson/trace.tar.gz |
tests: optionally show test execution tracingethomson/trace
Only show test trace execution when the CLAR_TRACE_TESTS environment
variable is set. This reduces the noise during tracing.
-rw-r--r-- | tests/clar_libgit2_trace.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/clar_libgit2_trace.c b/tests/clar_libgit2_trace.c index eb2fbbdf8..83c83b9bb 100644 --- a/tests/clar_libgit2_trace.c +++ b/tests/clar_libgit2_trace.c @@ -71,7 +71,7 @@ static struct method s_methods[] = { static int s_trace_loaded = 0; static int s_trace_level = GIT_TRACE_NONE; static struct method *s_trace_method = NULL; - +static int s_trace_tests = 0; static int set_method(const char *name) { @@ -117,6 +117,7 @@ static void _load_trace_params(void) { char *sz_level; char *sz_method; + char *sz_tests; s_trace_loaded = 1; @@ -133,6 +134,10 @@ static void _load_trace_params(void) sz_method = cl_getenv("CLAR_TRACE_METHOD"); if (set_method(sz_method) < 0) set_method(NULL); + + sz_tests = cl_getenv("CLAR_TRACE_TESTS"); + if (sz_tests != NULL) + s_trace_tests = 1; } #define HR "================================================================" @@ -155,6 +160,9 @@ void _cl_trace_cb__event_handler( { GIT_UNUSED(payload); + if (!s_trace_tests) + return; + switch (ev) { case CL_TRACE__SUITE_BEGIN: git_trace(GIT_TRACE_TRACE, "\n\n%s\n%s: Begin Suite", HR, suite_name); |