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

Initial definition for TSK_TRACE_ERRORS #3095

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jeromekelleher
Copy link
Member

@jeromekelleher jeromekelleher commented Mar 6, 2025

This is a proposal to address the discussion in #3094.

Essentially, we add a function-like macro tsk_trace_error, and everywhere we normally do

ret = TSK_ERR_X;
goto out;

we instead do

ret = tsk_trace_error(TSK_ERR_X);
goto out;

We can then define tsk_trace_error to be a no-op for production code, and define a function which emits some error traces. For the changes I've made here, we get this on stderr:

tskit-trace-error: -701='Sequence length must be > 0. (TSK_ERR_BAD_SEQUENCE_LENGTH)' at line 11000 in ../tskit/tables.c

Implementation notes

  • tsk_trace_error must be a macro, otherwise we can't use FILE and LINE to get locations
  • This structure has no change on control flow, which is essential
  • It should be easy enough to sed the changes to implement this for the vast majority of the library.

I can push this through and document if folks like it.

Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.90%. Comparing base (af33ed1) to head (87859e6).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3095      +/-   ##
==========================================
+ Coverage   89.87%   92.90%   +3.03%     
==========================================
  Files          29       21       -8     
  Lines       32188    16509   -15679     
  Branches     5776     2791    -2985     
==========================================
- Hits        28928    15338   -13590     
+ Misses       1859      689    -1170     
+ Partials     1401      482     -919     
Flag Coverage Δ
c-tests ?
lwt-tests 80.78% <ø> (ø)
python-c-tests 89.05% <ø> (ø)
python-tests 98.98% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benjeffery
Copy link
Member

Seems like a solid idea to me, should be able to hit most of the changepoints with a regex!

@jeromekelleher
Copy link
Member Author

OK cool, I'll fill this out as I get a chance.

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.

2 participants