Skip to content

Commit 45bfae9

Browse files
test: a protocol program runs as a process per file of its cases; mcpp's unit tests are one program
- `[test] split`: "file" (default) lists a protocol program's cases and runs each file's as a process of its own, scheduled as programs are; "case" and "none" give a process per case or one. - The marker a runner reads is taken at the version it speaks wherever it occurs: a test of the runner carries other versions as data. - mcpp's tests/unit is one program (`[test] programs = "directory"`), with three case objects renamed that shared a name across files; tests use mtest 0.5.1, whose marker survives --gc-sections. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 8db3d12 commit 45bfae9

19 files changed

Lines changed: 123 additions & 21 deletions

‎.github/workflows/ci-aarch64-fresh-install.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ jobs:
342342
mkdir -p "$evidence/$(dirname "$relative")"
343343
cp "$binary" "$evidence/$relative"
344344
readelf -aW "$binary" > "$evidence/$relative.readelf.txt"
345-
done < <(find target/aarch64-linux-gnu -type f -path '*/bin/unit/test_elf_runtime' -print0)
345+
done < <(find target/aarch64-linux-gnu -type f -path '*/bin/unit' -print0)
346346
while IFS= read -r -d '' plan; do
347347
relative="${plan#target/}"
348348
mkdir -p "$evidence/$(dirname "$relative")"

‎CHANGELOG.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
another system is built, not run, until a runner -- a runner package's tool
5252
-- or an execution host states how it runs (G11).
5353
- The row `i686-none-elf` (G12).
54+
- A test program that speaks the test protocol runs as one process per file of
55+
its cases (`[test] split = "file" | "case" | "none"`), and a test keeps what
56+
it reaches: units are compiled with one section per function and per object
57+
and tests link with `--gc-sections` (`[test] link = "objects"` keeps every
58+
object whole). mcpp's own unit tests are one program per directory: 166
59+
programs of 32 MB became one of 37 MB, run as 166 processes.
5460
- clang pairs with the MinGW-w64 payload for `x86_64-windows-gnu`: the payload
5561
is clang's sysroot and libstdc++ its C++ library, `import std` included.
5662
- `mcpp new --template platform` and `mcpp check platform`.
@@ -72,8 +78,8 @@
7278
- A git dependency names at most one of rev, tag and branch.
7379
- `mcpp pack` with several programs packs the one named after the package and
7480
names the others, and refuses when none is so named.
75-
- mcpp's own unit tests are mtest cases (mtest 0.5.0, mcpplibs.os 0.4.1); a
76-
skeleton's tests use mtest 0.5.0.
81+
- mcpp's own unit tests are mtest cases (mtest 0.5.1, mcpplibs.os 0.4.1); a
82+
skeleton's tests use mtest 0.5.1.
7783

7884
### Fixed
7985

‎docs/05-dependencies.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ not deprecated:
6767

6868
```toml
6969
[dev-dependencies]
70-
mcpplibs.mtest = "0.5.0"
71-
"mcpplibs.mtest.gtest" = "0.5.0"
70+
mcpplibs.mtest = "0.5.1"
71+
"mcpplibs.mtest.gtest" = "0.5.1"
7272
```
7373

7474
```toml

‎docs/08-testing.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ directory stays a program of its own. A program of many files is linked once
6565
where a program per file is linked once per file, which is what a suite of many
6666
small files spends its build time on.
6767

68+
A program that speaks the test protocol runs as **one process per file of its
69+
cases** (2026.11.9.1+): mcpp lists the cases, and each file's run selects its
70+
own (P4) and is scheduled across the workers as a program is, named
71+
`<program>/<file>` -- the isolation and the parallelism of a program per file,
72+
with one link. `[test] split = "case"` gives each case its own process, and
73+
`"none"` runs the program once.
74+
75+
A test program keeps what it reaches (2026.11.9.1+): units are compiled with one
76+
section per function and per object, and a test links with `--gc-sections`
77+
(`-dead_strip` on Mach-O), so a test of one module does not carry its package's
78+
every function (mcpp's own unit tests: 32 MB each to 14 MB). Static
79+
constructors are the collection's roots. `[test] link = "objects"` keeps every
80+
object whole.
81+
6882
A suite compiled from several sources of its own is also a package: a workspace
6983
member whose `[build] sources` carries the suite and whose one test program
7084
drives it, selected with `mcpp test -p <member>`.

‎docs/zh/05-dependencies.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ mcpp 把它读作这些点所拼写的选择器,警告该拼法已弃用(自
6262

6363
```toml
6464
[dev-dependencies]
65-
mcpplibs.mtest = "0.5.0"
66-
"mcpplibs.mtest.gtest" = "0.5.0"
65+
mcpplibs.mtest = "0.5.1"
66+
"mcpplibs.mtest.gtest" = "0.5.1"
6767
```
6868

6969
```toml

‎docs/zh/08-testing.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ discover = ["checks/**/*.cpp", "!checks/fixtures/**"]
5757
目录中的文件仍各自是一个程序。多文件的程序只链接一次,而每文件一个程序时每个文件链接
5858
一次,后者正是由许多小文件组成的套件在构建上花费的时间。
5959

60+
使用测试协议的程序**按其用例所在文件各起一个进程**运行(2026.11.9.1+):mcpp 先列出用例,
61+
每个文件的那次运行只选取自己的用例(P4),像一个程序一样在各工作线程间调度,名为
62+
`<程序>/<文件>`——兼得每文件一个程序的隔离与并行,而只链接一次。`[test] split = "case"`
63+
使每个用例一个进程,`"none"` 只运行一次。
64+
65+
测试程序只保留它用到的部分(2026.11.9.1+):各单元以每函数、每数据对象一个节编译,
66+
测试以 `--gc-sections` 链接(Mach-O 为 `-dead_strip`),测某一模块的测试不再带上整个包
67+
的全部函数(mcpp 自身的单元测试:每个由 32 MB 降至 14 MB)。静态构造是回收的根。
68+
`[test] link = "objects"` 保留每个目标文件的全部内容。
69+
6070
由自身多个源文件编译而成的测试套件也可以是一个包:一个工作区成员,它的
6171
`[build] sources` 承载整套套件,其唯一的测试程序驱动套件,用
6272
`mcpp test -p <member>` 选中。

‎mcpp.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ ldflags = ["--coverage"]
5959

6060
[test]
6161
windows_code_page = "utf-8"
62+
programs = "directory"
6263

6364
# Each entry equals its row's Default (SPEC-009 §12): the LLVM line moved to
6465
# 23.1.3 — the first release carrying the macOS 27 arm64e.x1 linker fix
@@ -164,7 +165,7 @@ members = [
164165

165166
# `mcpp build` ignores [dev-dependencies]; only `mcpp test` resolves them.
166167
[dev-dependencies]
167-
mcpplibs.mtest = "0.5.0"
168+
mcpplibs.mtest = "0.5.1"
168169

169170
# Everything else uses M5.0 conventions:
170171
# - target = mcpp (kind=bin inferred from src/main.cpp)

‎modules/buildmcpp/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ mcpp.source-kind = { path = "../source-kind" }
4141
mcpp.toolchain-model = { path = "../toolchain-model" }
4242

4343
[dev-dependencies]
44-
mcpplibs.mtest = "0.5.0"
44+
mcpplibs.mtest = "0.5.1"

‎modules/graph/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ description = "Algorithms over index-addressed directed graphs: topological orde
1717
license = "Apache-2.0"
1818

1919
[dev-dependencies]
20-
mcpplibs.mtest = "0.5.0"
20+
mcpplibs.mtest = "0.5.1"

‎modules/manifest/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ mcpplibs.os = "0.4.1"
3030
# state its contract in isolation; the root `tests/unit/` states the facts two
3131
# layers must agree on.
3232
[dev-dependencies]
33-
mcpplibs.mtest = "0.5.0"
33+
mcpplibs.mtest = "0.5.1"

0 commit comments

Comments
 (0)