Skip to content

Commit f6d3d70

Browse files
authored
feat: zero-shell self-contained workspace (real per-lib test projects) (#59)
* feat: zero-shell self-contained workspace — real per-lib test projects Each tests/examples/<lib>/ becomes a real mcpp TEST project: [dependencies] compat.<lib> + tests/*.cpp behavioral assertions (no src/). Driven entirely by mcpp, no shell: - cjson: build→serialize→parse, assert fields - eigen: header-only linear algebra (det/solve) - nlohmann.json: dump→parse round-trip + ordered_json - openblas: cfg(windows) cblas_dgemm [19 22;43 50] (no-op off-Windows) - build-mcpp: assert build.mcpp's generated source + define took effect CI (needs mcpp 0.0.79: workspace-aware test + build.mcpp cwd fix): - smoke-workspace runs 'mcpp test --workspace'; smoke-examples 'mcpp test -p <lib>' - deleted tests/run_workspace.sh + tests/run_example.sh; MCPP_VERSION -> 0.0.79 Kept (broader/display matrix, migrate later): smoke_compat_*.sh. eigen drops the eigen_blas dgemm assert — feature-built dep objects don't link into test binaries yet (mcpp follow-up). See design doc §9. (held until mcpp 0.0.79 is released — CI downloads the released binary) * feat: complete test+CI rearchitecture — entire library surface as a mcpp workspace Migrates every smoke_compat_*.sh into real per-library test projects and rebuilds CI around 'mcpp test --workspace'. The index's whole test surface is now the workspace; no shell drivers remain (except the documented imgui-module exception). New members (faithful migration of the smoke heredocs): - core: gtest + ftxui + lua + mbedtls + opengl/khrplatform (per-OS ldflags via cfg) - archive: libarchive + zlib/bzip2/lz4/xz/zstd (versions + round-trip) - imgui: headless in-memory ImGui frame - gui-stack: glfw + X11/XCB stack (xext/xrender/.../xau/xdmcp/xcb/x11), linux via cfg - imgui-window: imgui+glfw+GL3 backends build+link (window run opt-in), linux via cfg cjson/eigen/nlohmann drop the gcc pin so they run cross-platform (auto toolchain). CI: validate.yml collapses smoke-full-linux/smoke-portable/smoke-examples/ smoke-workspace into ONE 'workspace' matrix (linux/macos/windows) running 'mcpp test --workspace' — members self-gate by [target.cfg]. Deleted 5 smoke scripts. Kept smoke_imgui_module.sh: the public imgui module package has an empty namespace (builtin index), not yet mappable to a local path in a workspace member. Verified locally (mcpp 0.0.79): mcpp test --workspace → all 10 members pass. See .agents/docs/2026-06-30-complete-test-ci-rearchitecture.md. * ci: drop 'timeout' wrapper from workspace step (absent on macOS; job timeout-minutes bounds it)
1 parent dc3e89c commit f6d3d70

42 files changed

Lines changed: 621 additions & 1899 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/docs/2026-06-29-mcpp-native-workspace-ci-design.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,22 @@ windows-runtime-dll(0.0.73)那次"mcpp 补能力 → recipe/CI 变简单"完全
217217
**尚未收敛**(留待 §6 P2/P3):per-OS 成员差异仍可由 cfg 表承担而非驱动;环境隔离/缓存/产物断言仍在
218218
各 smoke 脚本;`--workspace` 单命令(G1)仍是 mcpp 侧待加能力——当前驱动按成员循环。旧 smoke 脚本
219219
**保留**,与 workspace 并行覆盖,等价验证充分后再逐个迁移/删除。
220+
221+
---
222+
223+
## 9. 零 shell 自包含(2026-06-30,mcpp 0.0.79)
224+
225+
承 §8,workspace 测试从「shell 驱动 build+run」升级为「`mcpp test --workspace` 真实断言」,
226+
依赖 mcpp 0.0.79 的 workspace-aware test(`mcpp test -p <member>` / `--workspace`)+ build.mcpp
227+
cwd 修复(见 mcpp `.agents/docs/2026-06-30-workspace-test-and-zero-shell-index-design.md`)。
228+
229+
- **成员=真实测试工程**:`tests/examples/<lib>/` 改为 `[dependencies] compat.<lib>` + `tests/*.cpp`
230+
行为断言(cjson 解析取字段、eigen header-only 线代、nlohmann round-trip+ordered、openblas
231+
cfg(windows) dgemm、build-mcpp 断言 build.mcpp 生成源+宏)。无 `src/`(纯测试工程,deps 头/库
232+
照样进测试二进制)。
233+
- **CI 去 shell**:`smoke-workspace``mcpp test --workspace`;`smoke-examples`
234+
`mcpp test -p <lib>`;删 `tests/run_workspace.sh` + `tests/run_example.sh`。MCPP_VERSION→0.0.79。
235+
- **仍保留**:`smoke_compat_{core,imgui,imgui_window,archive,portable}.sh`(imgui/glfw 需显示、
236+
libarchive/zlib 更广矩阵)——迁成 headless `mcpp test` 成员是后续增量,本期先转 5 个 headless 成员。
237+
- **发现**:feature 编出的依赖目标(eigen_blas 的 dgemm_)链不进 test 二进制(member 是 bin 时可以)
238+
→ eigen 暂测 header-only,feature-link-into-tests 待 mcpp 侧修。
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# mcpp-index: complete test + CI rearchitecture (zero shell)
2+
3+
Supersedes the heredoc smoke scripts and their bespoke CI jobs. The index's
4+
**entire** library-test surface becomes a mcpp `[workspace]` of real per-library
5+
test projects, run by `mcpp test --workspace` per platform. No `.sh` drivers.
6+
7+
## Why now / what unblocks it
8+
9+
The old `smoke_compat_portable.sh` carried a bash harness only because it had to
10+
synthesize per-OS toolchains + ldflags at runtime. **mcpp 0.0.74+ shipped
11+
`[target.'cfg(...)']`** (conditional build flags 0.0.74, conditional deps 0.0.75),
12+
and 0.0.79 added workspace-aware `mcpp test`. So per-OS config is now declarative
13+
in static `mcpp.toml`, and the whole matrix runs as one command — the shell
14+
harness has no remaining job.
15+
16+
## Member taxonomy (the complete test surface)
17+
18+
Each member is `tests/<name>/` = `[package]` + `[dependencies] compat.<lib>` +
19+
`tests/*.cpp` behavioral assertions (no `src/`). Migrated faithfully from the
20+
smoke scripts' heredoc projects.
21+
22+
| member | libraries (compat.*) | what it asserts | platforms |
23+
|---|---|---|---|
24+
| `cjson` | cjson | parse/serialize round-trip | all |
25+
| `eigen` | eigen | header-only linear algebra | all |
26+
| `nlohmann.json` | nlohmann.json (module) | dump/parse round-trip | all |
27+
| `core` | gtest, ftxui, lua, mbedtls, opengl, khrplatform | gtest TEST, lua eval=42, mbedtls SHA256("abc"), ftxui in-memory render, GL constants | all (per-OS ldflags via cfg) |
28+
| `archive` | libarchive, zlib, bzip2, lz4, xz, zstd | version probes + compress→decompress round-trip per codec | all |
29+
| `imgui` | imgui (compat source) | in-memory ImGui frame → valid draw data | all |
30+
| `imgui-module` | imgui (C++23 module) | `import imgui.core` + backend symbols + render | all (llvm pin) |
31+
| `gui-stack` | glfw + xext/xrender/xfixes/xcursor/xinerama/xrandr/xi/xau/xdmcp/xcb/x11 | symbol linkage + `glfwInit` (tolerant) + version constants | linux (cfg) |
32+
| `imgui-window` | imgui, glfw | **build+link only** (window run is opt-in, not headless CI) | linux (cfg) |
33+
| `openblas` | openblas | cfg(windows) cblas_dgemm `[19 22;43 50]` | windows (cfg) |
34+
| `build-mcpp` || build.mcpp generated source + define | all |
35+
36+
### Cross-platform via cfg (no bash)
37+
- **Toolchain**: cross-platform members **omit `[toolchain]`** → mcpp auto-selects
38+
the platform default (linux→gcc, macOS/Windows→llvm). `imgui-module` keeps an
39+
llvm pin (C++23 modules). `gui-stack`/`imgui-window` are gcc-on-linux.
40+
- **Per-OS link flags**: `[target.'cfg(linux)'.build] ldflags = ["-ldl","-lm"]`,
41+
`[target.'cfg(macos)'.build] ldflags = ["-lm"]` (was `write_build_ldflags()`).
42+
- **Platform-only members**: linux-only (`gui-stack`, `imgui-window`) gate their
43+
deps under `[target.'cfg(linux)'.dependencies]` and compile a no-op `main()`
44+
off-linux — the same pattern `openblas` uses for windows. So one
45+
`mcpp test --workspace` runs everywhere; each member self-selects.
46+
47+
## CI (validate.yml) — rebuilt around `mcpp test`
48+
49+
Replace `smoke-full-linux` / `smoke-portable` / `smoke-examples` / `smoke-workspace`
50+
with **one matrix job per OS**, each:
51+
```yaml
52+
- run: mcpp test --workspace # members self-gate by cfg
53+
```
54+
- **linux / macOS / windows** runners each run the whole workspace; platform-only
55+
members no-op where inapplicable.
56+
- **`detect`** still narrows PRs: a changed `pkgs/<lib>.lua` or `tests/<member>/**`
57+
→ `mcpp test -p <member>` for just that member; push/schedule → full `--workspace`.
58+
- **`smoke_compat_*.sh` deleted**; the registry/smoke download caches stay (keyed
59+
the same).
60+
- The display/GL **window run** is not part of headless CI; `imgui-window` builds +
61+
links (the recipe-build is the test). An opt-in job may later run it under xvfb.
62+
63+
## Migration provenance (faithful)
64+
Every assertion is lifted from the corresponding smoke heredoc:
65+
`core`←smoke_compat_core, `archive`←smoke_compat_archive (both sub-projects),
66+
`imgui`+`gui-stack`←smoke_compat_imgui (6 sub-projects split by concern),
67+
`imgui-window`←smoke_compat_imgui_window, `imgui-module`←smoke_imgui_module,
68+
and `smoke_compat_portable` dissolves into the cross-platform members above
69+
(its per-OS logic → cfg).
70+
71+
## Known follow-ups (recorded, not blocking)
72+
- Feature-built dependency objects not linking into test binaries (eigen_blas
73+
`dgemm_`) — eigen tests header-only until fixed in mcpp.
74+
- The actual GLFW/OpenGL **window** run needs a display; kept opt-in.
75+
- macOS/Windows `gui-stack` equivalents (Cocoa/Win32) are out of scope (the X11
76+
stack is linux-specific by nature).

0 commit comments

Comments
 (0)