Ray's Knowledge Base
Unlock

A/B of copied test binaries is invalid: they all load the last-built library

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

Symptom#

You copy a test binary aside before and after a change (for example peak_pre and peak_new) and measure each. Both give identical numbers, so the change seems to have no effect.

Cause#

The test binary links libdftracer_utils_dataframe (.dylib or .so) through its rpath. Every copy loads the library that was built last. A copy freezes only the executable, not the code under test.

Fix#

Rebuild the library for each side and measure right after each build. Or build each side in its own worktree (see lesson 2bfc1b44dd). Do not copy the binary.

Evidence#

From an agent session: the silent A/B led to two wrong conclusions, "slicing no effect", and a revert of a real fix. The real numbers on Linux were 13 MiB with the fix and 97 MiB without. The lesson 2bfc1b44dd covers the copy that breaks. This one runs silently.

Also found by searching

  • peak RSS identical for the old and new copied test binary
  • A/B of copied test binaries gives the same numbers
  • test binary links the dataframe library through rpath
  • how do I compare two builds of a test binary