Skip to content

feat(workspace): workspace-aware mcpp test (-p / --workspace) + root-test fix (v0.0.79)#191

Merged
Sunrisepeak merged 4 commits into
mainfrom
feat/workspace-test-and-import-mcpp
Jun 30, 2026
Merged

feat(workspace): workspace-aware mcpp test (-p / --workspace) + root-test fix (v0.0.79)#191
Sunrisepeak merged 4 commits into
mainfrom
feat/workspace-test-and-import-mcpp

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What

Brings mcpp test to parity with mcpp build for workspaces, and fixes bare mcpp test at 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).
  • Fix: bare mcpp test at a virtual workspace root used to error 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 second globber. Bare mcpp build/mcpp test at 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/--workspace are thin orchestration over the existing per-member prepare_build/run_tests — no parallel build/test path. The shared resolve_member_dir centralizes the member match rule so build and test can't drift (the class of bug being fixed).

Files

  • src/project.cppmresolve_member_dir (shared match rule).
  • src/build/execute.cppmrun_tests scopes its glob to the resolved member.
  • src/cli.cppm-p/--workspace on test, --workspace on 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-stem tests/main.cpp in two members no longer collides; -p, --workspace, bare, failure-propagation), 35_workspace, 78_test_main_combinations (single-package test), 02/04/89 all 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

…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.
@Sunrisepeak Sunrisepeak merged commit 6d383b3 into main Jun 30, 2026
5 checks passed
@Sunrisepeak Sunrisepeak deleted the feat/workspace-test-and-import-mcpp branch June 30, 2026 02:38
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.

1 participant