Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve trace support in tests #5309

Merged
merged 3 commits into from
Nov 28, 2019
Merged

Improve trace support in tests #5309

merged 3 commits into from
Nov 28, 2019

Conversation

ethomson
Copy link
Member

I make regular use of our tracing infrastructure when I'm debugging a problem, frequently adding git_trace statements to the code so that I can get debugging output while I'm working on a problem.

(git_trace has benefits over simple printf debugging, since language bindings can plug in to the trace framework and send trace output to a log location, debugger output, etc.)

We've never built tracing into the library by default. This was because we were super conservative about it in ye olde days to avoid any perf issues. However, we've also been super conservative about the way tracing works (it's basically a simple test and any tracing is skipped if the trace level is below a certain point). And we've been even more conservative about checking in git_trace logging into the library.

So there's no harm in enabling tracing support by default.

Similarly, we should emit better trace information in clar. Now GIT_TRACE_LEVEL is obeyed, the tracelevel is shown when the trace is printed, and by default the noisy test tracing is disabled (can be re-enabled with GIT_TRACE_TESTS environment variable.)

Tracing is meant to be extremely low-impact when not enabled.  We
currently ship no tracing calls in libgit2, but if / when we do, the
tracing infrastructure is created to skip tracing as quickly as
possible.  It should compile to a simple test when tracing is off.

Thus, there's on reason to not enable it by default.
Only show test trace execution when the CLAR_TRACE_TESTS environment
variable is set.  This reduces the noise during tracing.
Copy link
Member

@pks-t pks-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks Ed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants