Skip to content

build(tests): pass test sources relatively so object names stay short (#2887) - #3753

Merged
zackees merged 1 commit into
masterfrom
fix/2887-relative-test-sources
Jul 28, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2887-relative-test-sources

Conversation

@zackees

@zackees zackees commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Closes #2887.

Root cause — not what the issue guessed

The build system derives each object file's name from the source path it is handed. tests/meson.build passed absolute paths:

test_source_abs = path_norm_root + '/tests/' + test_file

so the entire absolute path got flattened into the object name:

C__Users_niteris_dev_fastled_.claude_worktrees_<branch>_tests_misc_foo.cpp.obj

In a normal checkout that's merely ugly. Under .claude/worktrees/<branch>/ the encoded name grows with the worktree path — it's the worktree path, twice: once as the real directory, once flattened inside the filename. That's what pushed object paths past Windows MAX_PATH.

test_file is already relative to tests/, so the absolute prefix was pure overhead. Passing it directly collapses the object name to misc_foo.cpp.obj. The same applies to the three test_shared_objs sources.

Measured, in a real worktree

Reproduced in a worktree with a 91-character root path:

before after
longest object path 289 chars 237 chars
objects with absolute-mangled names 403 0

237 is under MAX_PATH (260), so the build no longer depends on the host having long-path support enabled.

That also explains the reporting gap: this machine has LongPathsEnabled=1 and core.longpaths=true, and I confirmed a 289-char object path building fine here. The bug is real, it just needs a host without long-path support — which is the default on Windows.

Why not the suggested fixes

The issue proposed shortening the worktree path, moving worktrees outside the repo, or requiring long-path setup. None is needed, and each has a cost:

  • moving worktrees defeats the isolation the clud-pr workflow relies on
  • requiring LongPathsEnabled pushes per-developer machine setup onto every contributor, and silently doesn't help the ones who skip it

This changes nothing about path layout and requires no machine setup — the encoded name simply stops carrying a path it never needed.

Validation

  • 357/357 on clean builds in both the main checkout and a worktree
  • bash lint green
  • Verified 0 of 403 objects still use absolute-mangled names after the change

Repro worktrees were removed afterwards; no leftovers.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved test build path handling by using relative source paths.
    • Reduced generated object-file path lengths, helping avoid Windows path-length limitations.
  • Tests
    • Updated shared and per-test build configuration without changing test execution behavior.

Closes #2887.

The build system derives each object file's name from the source path it is
handed. tests/meson.build passed absolute paths:

    test_source_abs = path_norm_root + '/tests/' + test_file

so the entire absolute path got flattened into the object name:

    C__Users_niteris_dev_fastled_.claude_worktrees_<branch>_tests_misc_foo.cpp.obj

In a normal checkout that is merely ugly. Under .claude/worktrees/<branch>/
the encoded name grows with the worktree path and pushes the full object
path past Windows MAX_PATH, which is what broke `bash test --cpp` inside
worktrees.

`test_file` is already relative to tests/, so the absolute prefix was pure
overhead. Passing it directly collapses the object name to misc_foo.cpp.obj.
The same fix applies to the three test_shared_objs sources.

Measured in a worktree whose root path is 91 characters:

  longest object path   289 -> 237 chars
  absolute-mangled objs 403 -> 0

237 is under MAX_PATH, so the build no longer depends on the host having
long-path support enabled -- which is why this reproduced for the reporter
but not on a machine with LongPathsEnabled=1.

The issue suggested shortening the worktree path, moving worktrees outside
the repo, or requiring long-path setup. None is needed: nothing about the
path layout changes, and no per-developer machine setup is required.

Validated: 357/357 on clean builds in both the main checkout and a worktree;
lint green.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: da8dc791-8922-43e7-a457-8d1f57fc54e9

📥 Commits

Reviewing files that changed from the base of the PR and between e74e8d7 and 13c7014.

📒 Files selected for processing (1)
  • tests/meson.build

📝 Walkthrough

Walkthrough

Meson test builds now provide relative source paths for shared test objects and per-test DLL sources. Comments document how these paths affect generated object names and Windows path-length behavior; test runner wiring and PCH usage remain unchanged.

Changes

Meson test source path normalization

Layer / File(s) Summary
Shared object paths
tests/meson.build
Shared test compilation units use relative paths in the static library source list.
Per-test DLL source paths
tests/meson.build
Per-test DLL targets pass test_file directly and expand comments about generated object paths and Windows path-length behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: using relative test source paths to keep Meson object names short.
Linked Issues check ✅ Passed The PR matches #2887 by replacing absolute Meson test source paths with relative ones for regular and shared test sources.
Out of Scope Changes check ✅ Passed The changes stay within tests/meson.build and only adjust path handling plus explanatory comments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2887-relative-test-sources

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees merged commit 0c6356c into master Jul 28, 2026
4 of 5 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 28, 2026
@zackees
zackees deleted the fix/2887-relative-test-sources branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

build(meson): bash test --cpp fails inside .claude/worktrees/ worktrees (Windows path / object-name encoding)

1 participant