Skip to content

Include tsan_annotations.h so the TSAN guard in timing_test works - #85

Merged
graphicsMan merged 1 commit into
mainfrom
fix/timing-test-tsan-guard
Sep 2, 2026
Merged

graphicsMan merged 1 commit into
mainfrom
fix/timing-test-tsan-guard

Conversation

@graphicsMan

@graphicsMan graphicsMan commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #88.

tests/timing_test.cpp wraps its entire body in #if !DISPENSO_HAS_TSAN, with a
comment explaining that timing assertions are too sensitive to instrumentation
to be meaningful under ThreadSanitizer.

DISPENSO_HAS_TSAN is defined in dispenso/tsan_annotations.h, which the test
never includes. The macro is therefore always undefined, !0 is always true,
and the guard has never excluded anything — the timing tests have been running
under TSAN since the file was added.

Adding the include restores the intended behaviour. Nothing changes outside
TSAN builds.

This is invisible in the normal build because the CMake configuration does not
warn on undefined macros in #if. Building with -Wundef surfaces it.

timing_test.cpp wraps its whole body in #if !DISPENSO_HAS_TSAN, but that
macro is defined in dispenso/tsan_annotations.h, which the file never
includes. The macro has therefore always been undefined, !0 always true,
and the guard has never excluded anything -- the timing tests have been
compiled in under TSAN since the file was added.

Adding the include restores the intended behaviour. Nothing changes
outside TSAN builds.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 2, 2026
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.8%. Comparing base (d74898a) to head (10676e0).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main     #85     +/-   ##
=======================================
+ Coverage   92.6%   92.8%   +0.1%     
=======================================
  Files         64      64             
  Lines       4990    4990             
  Branches     678     680      +2     
=======================================
+ Hits        4625    4632      +7     
+ Misses       365     358      -7     

see 4 files with indirect coverage changes

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

@graphicsMan
graphicsMan merged commit d1c6ebe into main Sep 2, 2026
26 checks passed
@graphicsMan
graphicsMan deleted the fix/timing-test-tsan-guard branch September 2, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

timing_test.cpp TSAN guard is inert — DISPENSO_HAS_TSAN is never defined

1 participant