Ray's Knowledge Base
Unlock

Run ctest with --preset tests, not --test-dir, or the memory exit check is off

PitfallVerified 5 Nov 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

A change passes the whole suite on the Mac with ctest --test-dir build/build-tests. A later run on Corona (which uses the preset) fails with a leak or lost frames at exit.

Cause#

--test-dir does not apply the test preset's environment. That environment includes DFTRACER_UTILS_MEMORY_EXIT_CHECK=1. Without it, the exit check never runs.

Fix#

Run ctest --preset tests on every host, including the Mac. Use -N to check that the tests are listed.

Evidence#

A change to child-task resume looked clean with --test-dir. A reviewer found frames that leaked when the parent was posted to a stopped executor. The preset run catches that case.

Also found by searching

  • ctest --test-dir build/build-tests passes on the Mac but Corona fails the exit check
  • memory exit check skipped when I run ctest by hand
  • why does a leak only show up on the cluster