Skip to content

Reject test programs that would overwrite executables - #1036

Draft
jepharaujo wants to merge 1 commit into
mcpp-community:mainfrom
jepharaujo:fix/test-directory-output-collision
Draft

jepharaujo wants to merge 1 commit into
mcpp-community:mainfrom
jepharaujo:fix/test-directory-output-collision

Conversation

@jepharaujo

Copy link
Copy Markdown

Summary

Rejects discovered test programs that would overwrite a package executable. The error identifies the test, the target and the shared path before the planner writes build output. The testing guide and specification document the guard.

Fixes #1028.

Criteria

  • The released CLI overwrote a built executable when a discovered test program shared its output path. On macOS, the CLI built from this branch rejected root and workspace collisions, preserved the original executable and ran a separately named test.
  • The unit executable from the repository test graph passed all 14 cases in TestTargets/* on macOS. The two new cases exercise Darwin and Windows executable naming and the difference between nested test paths and workspace linker placement.
  • The native build passed with LLVM 23.1.3 and the CI profile. Disk space limited the top-level mcpp test command while it was building unrelated suites, so the targeted run used the unit executable produced by its Ninja graph. The full suite and native Linux and Windows runs are left to CI.

Intersections

New rule or feature Invariant it crosses Test at the crossing
Reject discovered tests that share a program output path Build and test share the product directory and use platform-specific executable suffixes TestTargets/ATestDirectoryCannotReplaceThePackagesExecutable and the root CLI regression
Reuse the paths used by the workspace linker Member program placement and nested test directories can place similar names at different paths TestTargets/MemberTestPathsKeepTheirDirectories and the workspace CLI regression

Compatibility

Projects with distinct test and program paths continue to work as before. A colliding directory-mode test now fails during planning, preserves existing build output and identifies what can be renamed. No migration is required.

Checks before merging

  • Documentation style, structure and version-pin scripts pass.
  • python3 .github/tools/check_workflow_assertions.py passes.
  • git log origin/main..HEAD -i --grep='Co-Authored-By' prints nothing.
  • Give the squash merge an explicit subject and body.

OpenAI Codex assisted with implementation and validation.

This branch has not been deployed

No deployments
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.

A test-directory program named as the package's own bin target is written over that program ([test] programs = "directory")

1 participant