Commit b7f70bc2 by Edward Thomson

tests: optionally show test execution tracing

Only show test trace execution when the CLAR_TRACE_TESTS environment
variable is set.  This reduces the noise during tracing.
parent 85efe896
...@@ -71,7 +71,7 @@ static struct method s_methods[] = { ...@@ -71,7 +71,7 @@ static struct method s_methods[] = {
static int s_trace_loaded = 0; static int s_trace_loaded = 0;
static int s_trace_level = GIT_TRACE_NONE; static int s_trace_level = GIT_TRACE_NONE;
static struct method *s_trace_method = NULL; static struct method *s_trace_method = NULL;
static int s_trace_tests = 0;
static int set_method(const char *name) static int set_method(const char *name)
{ {
...@@ -117,6 +117,7 @@ static void _load_trace_params(void) ...@@ -117,6 +117,7 @@ static void _load_trace_params(void)
{ {
char *sz_level; char *sz_level;
char *sz_method; char *sz_method;
char *sz_tests;
s_trace_loaded = 1; s_trace_loaded = 1;
...@@ -133,6 +134,10 @@ static void _load_trace_params(void) ...@@ -133,6 +134,10 @@ static void _load_trace_params(void)
sz_method = cl_getenv("CLAR_TRACE_METHOD"); sz_method = cl_getenv("CLAR_TRACE_METHOD");
if (set_method(sz_method) < 0) if (set_method(sz_method) < 0)
set_method(NULL); set_method(NULL);
sz_tests = cl_getenv("CLAR_TRACE_TESTS");
if (sz_tests != NULL)
s_trace_tests = 1;
} }
#define HR "================================================================" #define HR "================================================================"
...@@ -155,6 +160,9 @@ void _cl_trace_cb__event_handler( ...@@ -155,6 +160,9 @@ void _cl_trace_cb__event_handler(
{ {
GIT_UNUSED(payload); GIT_UNUSED(payload);
if (!s_trace_tests)
return;
switch (ev) { switch (ev) {
case CL_TRACE__SUITE_BEGIN: case CL_TRACE__SUITE_BEGIN:
git_trace(GIT_TRACE_TRACE, "\n\n%s\n%s: Begin Suite", HR, suite_name); git_trace(GIT_TRACE_TRACE, "\n\n%s\n%s: Begin Suite", HR, suite_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment