feat(workspace): workspace-aware mcpp test (-p / --workspace) + root-test fix (v0.0.79)#191
Merged
Merged
Conversation
…test fix mcpp test gains workspace awareness, at parity with build: - mcpp test -p <member> — test one member (discovery scoped to its dir) - mcpp build|test --workspace — act on all members (continue-on-failure + per-member summary; non-zero if any failed) - bare mcpp test at a virtual workspace root now fans out over all members instead of erroring 'duplicate test name main' (it globbed every member's tests/**/*.cpp together). Root cause was missing member scoping, fixed by scoping discovery (shared project::resolve_member_dir), not a 2nd globber. - bare mcpp build at a virtual workspace root builds all members (was: one). src/project.cppm resolve_member_dir (shared match rule), execute.cppm run_tests scopes glob to member, cli.cppm + cmd_build.cppm flags + fan-out orchestration. e2e 90_workspace_test.sh; docs/06-workspace.md (+zh). Version -> 0.0.79.
build.mcpp wrote its generated sources relative to the CHILD's cwd = mcpp's invocation dir, which is the project root only by coincidence. Running it via 'mcpp test -p <member>' (or any invocation from another dir) wrote the files to the wrong place -> 'declared generated source does not exist'. Add an optional cwd to platform::process::capture_exec (Linux: posix_spawn_file_actions_addchdir_np; else: 'cd <cwd> && ' prefix) and run/ compile build.mcpp with cwd = project root. Also unblocks the future typed import-mcpp module (GCC gcm.cache staging needs a controllable cwd). e2e 89 extended: build from a nested subdir, assert the generated source lands in the project root.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings
mcpp testto parity withmcpp buildfor workspaces, and fixes baremcpp testat a workspace root.mcpp test -p <member>— test a single workspace member (discovery scoped to its dir).mcpp build --workspace/mcpp test --workspace— act on all members in one command (continue-on-failure + per-member summary; non-zero exit if any member failed).mcpp testat a virtual workspace root used to errorduplicate test name 'main'— it globbed every member'stests/**/*.cpptogether. Root cause was missing member scoping; fixed by scoping discovery (sharedproject::resolve_member_dir), not a second globber. Baremcpp build/mcpp testat a virtual workspace now act on all members (was: one arbitrary member).This is the enabler for making mcpp-index's test harness shell-free and self-contained: CI becomes literally
mcpp test --workspace. See.agents/docs/2026-06-30-workspace-test-and-zero-shell-index-design.md.Architecture
-p/--workspaceare thin orchestration over the existing per-memberprepare_build/run_tests— no parallel build/test path. The sharedresolve_member_dircentralizes the member match rule sobuildandtestcan't drift (the class of bug being fixed).Files
src/project.cppm—resolve_member_dir(shared match rule).src/build/execute.cppm—run_testsscopes its glob to the resolved member.src/cli.cppm—-p/--workspaceon test,--workspaceon build.src/cli/cmd_build.cppm— fan-out orchestration (continue-on-failure + summary).tests/e2e/90_workspace_test.sh;docs/06-workspace.md(+zh). Version → 0.0.79.Verified locally
90_workspace_test(same-stemtests/main.cppin two members no longer collides;-p,--workspace, bare, failure-propagation),35_workspace,78_test_main_combinations(single-package test),02/04/89all green.Typed
import mcpp;build library is deferred to 0.0.80 (needs a cwd-capable spawn + Clang .pcm path; see design doc §6).🤖 Generated with Claude Code