TestBuilder::Path after AddTest moves a test's outputs, not the sources it compiles #54
Labels
No labels
bug
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Build#54
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
TestBuilder::Pathis documented as "Override the path the test's sources resolve against" (interfaces/Crafter.Build-Test.cppm:35). By thenAddTesthas resolved them: it sets the test's path to./and callsGetInterfacesAndImplementations(implementations/Crafter.Build-Test.cpp:380and:400), which makes each source absolute against the path at that call (implementations/Crafter.Build-Clang.cpp:479and:484).Path(implementations/Crafter.Build-Test.cpp:434) then setsconfig.pathalone, which decides where the test's build and bin directories go.So
cfg.AddTest("t").Path("sub")compilestests/t/main.cpp, notsub/tests/t/main.cpp, and puts its program undersub/bin/and its object undersub/build/…/objects-outside/, followed by the source's absolute path.The same with 6.4.1 (the stable Flatpak) and with
578a1da(6.4.2). Noproject.cppamong the Catcrafts checkouts on the development machine callsPathon a test.Line numbers refer to
578a1da(6.4.2).Reproduce
A project with
main.cpp,tests/t/main.cpp(int main() { return 0; }),sub/tests/t/main.cpp(int main() { return 1; }) and thisproject.cpp:crafter-build test, with578a1da(the project's directory written<project>):and the test's program and object:
Proposal
Have
Pathresolve the test's sources against the new path:AddTestwould keep them as they were named and resolve them again whenPathchanges. IfPathis meant to move only the outputs, its comment should say that.