Skip to content

Commit 064fb7f

Browse files
0.5.0: a run is a graph with its critical path; Markdown reports; what each case used; run fixtures and components (#7)
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent 9c1a431 commit 064fb7f

39 files changed

Lines changed: 2702 additions & 160 deletions

‎CHANGELOG.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## [0.5.0] - 2026-11-09
4+
5+
A run is a graph of work, and mtest reports it: what ran, what each part waited for, what it used.
6+
7+
- **The run's graph and its critical path** (P12.3). The engine records each process's worker and
8+
selection, each case's start, each run fixture's serving and, from a host, each program's build;
9+
they form a directed acyclic graph whose edges are a build before its program, a worker's previous
10+
process, the previous holder of a resource and a fixture's serving. `mtest analyze path` is the
11+
graph's longest weighted path, with what each step waited for (it was the longest program);
12+
`mtest graph --run last --format mermaid|gantt|dot|json` draws it, the critical path marked.
13+
- **Markdown reports.** `mtest report --format md` writes the sections asked for (`--sections` or
14+
`[report]`): the summary, kinds, failures, slowest cases, metrics beside their bounds, the use of
15+
the machine, flaky cases, trends, the critical path, the graph and the schedule, the last three in
16+
mermaid; over a scope (`program:<glob>`, `kind:<kind>`); of one run, `--runs`, or every run of a
17+
`--group` together. `mtest run --md FILE` writes one at the end of a run, and `mtest ci annotate`
18+
writes it to the job's summary.
19+
- **CI as a whole.** `mtest ci report` reports every collected run of a group (the jobs of a CI run,
20+
`GITHUB_RUN_ID` by default) as one document; `mtest ci timeline --repo R --run-id N` draws a
21+
workflow run's jobs as a schedule with its critical path.
22+
- **Use of the machine** (P10, P6.6). `[monitor] level` (`basic` by default), `--monitor` and
23+
`monitor{...}` on a case: each case's processor time; at `detailed` its largest resident set, its
24+
growth and its I/O; at `trace` the load and the resident set sampled over it; the program's own use
25+
in a `usage` event. Each is a metric with its precision. A program that reports none is measured
26+
from a process of the engine's (`mtest measure`, Linux and macOS). Uses mcpplibs.os 0.4.1.
27+
- **Scheduling by measurement.** `[run] split = "auto"`: while workers would idle, a program's cases
28+
are divided among several processes of it by their measured times. `[run] memory = "auto"`:
29+
programs run together while their measured largest resident sets fit the machine. `[programs.*]
30+
split = false` keeps a program in one process.
31+
- **Components and run fixtures** (P11, P7.3). `run_fixture` serves one object for the whole run,
32+
started before the first case that `uses` it and ended after the last, its endpoint given as
33+
`MTEST_FIXTURE_<NAME>` (`fixture_endpoint`); `Component` names the pools of resources it brings, a
34+
resource with a capacity. `[fixtures.<name>] command` serves one by a command, and `[cases."<glob>"]
35+
uses` states the users of a program that states none.
36+
- **The store is specified** (P12): its files and fields, which a host's runner writes as mtest does.
37+
338
## [0.4.1] - 2026-11-08
439

540
- A body that returns a value does not compile. A case ends at its end, at `return;`, at `skip()`

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int main() {
3838
3939
```toml
4040
[dev-dependencies]
41-
mcpplibs.mtest = "0.4.1"
41+
mcpplibs.mtest = "0.5.0"
4242
```
4343

4444
A failure names its place and both sides (`expected 2, actual 3`). Under a runner the same program
@@ -70,6 +70,7 @@ mtest run --set smoke # the sets of mtest.toml: smoke, regression,
7070
mtest explain # where the last failure was, why, and the command that repeats it
7171
mtest plan --since origin/main # what a change affects, and why each case is in
7272
mtest analyze hot # the slowest cases; also durations, path, failures, flaky, bench
73+
mtest report --format md # the run as Markdown: failures, metrics, use of the machine, the critical path in mermaid
7374
mtest serve # the same commands for an agent (MCP) or an IDE (JSON-RPC)
7475
```
7576

‎README.zh-CN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main() {
3737
3838
```toml
3939
[dev-dependencies]
40-
mcpplibs.mtest = "0.4.1"
40+
mcpplibs.mtest = "0.5.0"
4141
```
4242

4343
失败时给出位置与两侧的值(`expected 2, actual 3`)。在运行器之下,同一程序按协议报告;单独运行时每个用例输出一行。
@@ -65,6 +65,7 @@ mtest run --set smoke # mtest.toml 中的集合:smoke、regressio
6565
mtest explain # 上一次失败的位置、原因,以及复现它的命令
6666
mtest plan --since origin/main # 一次改动影响哪些用例,以及每个用例入选的原因
6767
mtest analyze hot # 最慢的用例;另有 durations、path、failures、flaky、bench
68+
mtest report --format md # 以 Markdown 报告一次运行:失败、指标、资源使用、以 mermaid 绘出的关键路径
6869
mtest serve # 同样的命令,供 Agent(MCP)或 IDE(JSON-RPC)使用
6970
```
7071

‎adapters/gtest/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[package]
1414
namespace = "mcpplibs.mtest"
1515
name = "gtest"
16-
version = "0.4.1"
16+
version = "0.5.0"
1717
description = "GoogleTest speaking the mtest protocol: a test main that lists, selects and reports GoogleTest's cases"
1818
license = "Apache-2.0"
1919

‎adapters/gtest/src/protocol.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ int mcpplibs_mtest_gtest_main(int argc, char** argv) {
127127
{"protocol", 1},
128128
{"level", 1},
129129
{"framework", "googletest"},
130-
{"version", "0.4.1"},
130+
{"version", "0.5.0"},
131131
{"isolation", {"process", "case"}},
132132
{"guide", "https://github.com/mcpp-community/mtest/blob/main/adapters/gtest/docs/"
133133
"writing-tests.md"}});

‎capi/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55
namespace = "mcpplibs.mtest"
66
name = "capi"
7-
version = "0.4.1"
7+
version = "0.5.0"
88
description = "mtest's C ABI: the protocol's events for any language with a C FFI"
99
license = "Apache-2.0"
1010

‎capi/src/mtest.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void mtest_init(const char* framework, int level) {
115115
{"protocol", 1},
116116
{"level", std::clamp(level, 1, 3)},
117117
{"framework", text(framework)},
118-
{"version", "0.4.1"},
118+
{"version", "0.5.0"},
119119
{"isolation", {"process", "case"}}});
120120
}
121121

‎conformance/mcpp.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[package]
99
namespace = "mcpplibs.mtest"
1010
name = "conformance"
11-
version = "0.4.1"
11+
version = "0.5.0"
1212
description = "The conformance suite of the mtest protocol, for every implementation of its program side"
1313
license = "Apache-2.0"
1414

@@ -27,5 +27,5 @@ main = "src/fixture.cpp"
2727

2828
[dependencies]
2929
mcpplibs.mtest = { path = "../lib" }
30-
mcpplibs.os = "0.4.0"
30+
mcpplibs.os = "0.4.1"
3131
nlohmann.json = "3.12.0"

‎docs/commands.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ nothing; a built program's own listing is the authority (`manifest/src/manifest.
3636

3737
| Command | Does |
3838
|---|---|
39-
| `run` | runs the selection; `--jobs N`, `--seed N`, `--fail-fast`, `--retries N`, `--isolate` (a process per case), `--timeout 5m`, `--env K=V`, `--run-under CMD`; `--junit`, `--html`, `--report-json FILE`; `--coverage` measures the coverage map |
39+
| `run` | runs the selection; `--jobs N`, `--seed N`, `--fail-fast`, `--retries N`, `--isolate` (a process per case), `--timeout 5m`, `--env K=V`, `--run-under CMD`, `--monitor LEVEL` (P10), `--group G` (runs reported together); `--junit`, `--html`, `--report-json FILE`, `--md FILE`; `--coverage` measures the coverage map. A program's cases are divided among workers that would otherwise idle (`[run] split`), and programs run together within the machine's memory (`[run] memory`) |
4040
| `rerun` | the cases that failed in the last run |
4141
| `smoke` | the `smoke` set |
4242
| `golden` | a run with `MTEST_GOLDEN=update`: golden files are written, not compared |
@@ -53,12 +53,12 @@ status is its one result. Cases tagged `flaky`, and quarantined ones, are retrie
5353
| Command | Answers |
5454
|---|---|
5555
| `explain [--case REF]` | where a case failed, why (both sides), its output, its recent history, whether it is new, and the command that repeats it |
56-
| `report [--format text\|json\|junit\|html]` | a stored run |
56+
| `report [--format text\|json\|junit\|html\|md]` | a stored run; `md`: a Markdown report of the sections `--sections` (or `[report]`) names -- summary, kinds, failures, slowest, metrics, resources, flaky, trend, path, graph, gantt -- over `--scope` (`run`, `program:<glob>`, `kind:<kind>`), of one run, `--runs a,b`, or every run of `--group G` together |
5757
| `diff [--before ID] [--after ID]` | newly failing, fixed, slower, faster |
5858
| `history --case REF` | one case across the stored runs |
5959
| `query` | stored case results by `--status`, `--kind`, `--program`, `--case`, `--tag`, `--days`, `--runs` |
60-
| `analyze METRIC` | `hot`, `durations`, `path` (the critical path), `failures` (grouped by message), `flaky`, `bench`, `trend` (each case's metrics over the last `--runs N` runs beside their bounds, `--case GLOB`), `cost` |
61-
| `graph [--format json\|dot\|mermaid]` | sources → programs → cases → resources and artifacts |
60+
| `analyze METRIC` | `hot`, `durations`, `path` (the critical path: the longest weighted path of the run's graph, spec P12.3, with what each step waited for), `failures` (grouped by message), `flaky`, `bench`, `trend` (each case's metrics over the last `--runs N` runs beside their bounds, `--case GLOB`), `cost` |
61+
| `graph [--format json\|dot\|mermaid\|gantt]` | sources → programs → cases → resources and artifacts; with `--run ID`, the run's graph of work -- builds, processes, run fixtures and what each waited for (worker, resource, build, fixture) -- the critical path marked, or its schedule as a gantt |
6262
| `gate [--set S]` | a set's gate on a run: no failure, the budget kept, bench verdicts that pass |
6363

6464
A run is named by its identifier, `last`, or `last-N`.
@@ -71,4 +71,7 @@ A run is named by its identifier, `last`, or `last-N`.
7171
| `store gc\|verify\|import --from DIR` | the store's retention, its consistency, another store taken in (a CI artifact), with its coverage map when that is newer |
7272
| `coverage show\|import --from FILE` | the coverage map affected selection reads, or another taken in |
7373
| `ci status OWNER/REPO#N...` | the checks of pull requests, failing ones with their links (by the GitHub CLI) |
74-
| `ci annotate`, `ci collect --from DIR` | a run's failures as GitHub annotations and a job summary; a CI store taken in |
74+
| `ci annotate`, `ci collect --from DIR` | a run's failures as GitHub annotations and its Markdown report as the job's summary; a CI store taken in |
75+
| `ci report [--group G]` | every collected run of a group (default: `GITHUB_RUN_ID`) as one Markdown report, in the job's summary and `--out` |
76+
| `ci timeline --repo OWNER/REPO --run-id N` | a workflow run's jobs as a schedule with the critical path (each job waited for the job that ended last before it began), as Markdown with a gantt; `--summary` writes it to the job's summary |
77+
| `measure --out FILE -- ARGV` | runs ARGV and writes what it used (its children's account) as JSON: how the engine measures a program that reports no use of its own (P10.4) |

‎docs/config.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ tags = ["slow"]
2222
timeout = "10m"
2323
isolation = "process" # or "case": a process per case
2424
kind = "e2e" # the kind of its cases that state none (default: its directory's, else unit)
25+
split = true # whether [run] split may divide its cases among processes
2526

2627
[discover]
2728
globs = ["build/tests/*"] # every executable that matches is a program
@@ -59,6 +60,32 @@ diagnose = { env = { APP_LOG = "debug" }, timeout = "60s" } # once more aft
5960
skip = "not on this host" # recorded as skipped, not run
6061
expect_fail = "a defect upstream" # a failure is xfail, a pass xpass
6162
at_most = { ready = 15 } # bounds on its metrics (P6.5); at_least likewise
63+
uses = ["index"] # the run fixtures it uses (P11.2)
64+
65+
# How the engine places work.
66+
[run]
67+
split = "auto" # divide a program's cases among processes while workers idle; "off"
68+
memory = "auto" # schedule within the machine's memory, by each program's measured
69+
# largest resident set; "off", or a size such as "16GiB"
70+
71+
# How closely use is measured (P10): each case's processor time and the program's use at `basic`; also
72+
# each case's memory and I/O at `detailed`; also the load and memory over time at `trace`.
73+
[monitor]
74+
level = "basic" # off, basic, detailed, trace
75+
sample = "50ms" # trace: how often
76+
77+
# What `mtest report --format md`, `--md FILE` and `mtest ci annotate` write.
78+
[report]
79+
sections = ["summary", "failures", "slowest", "metrics", "resources", "path", "gantt"]
80+
# also kinds, flaky, trend, graph
81+
scope = "run" # run, program:<glob>, kind:<kind>
82+
top = 10 # rows of a ranked table
83+
max_nodes = 60 # nodes of a drawn graph: the critical path's, then the longest
84+
85+
# A run fixture a command serves (P11.3), for one no test program declares: it prints
86+
# `mtest-ready <endpoint>` and ends when its input ends.
87+
[fixtures.index]
88+
command = ["python3", "tests/serve_index.py"]
6289

6390
# The test files `mtest list --static` reads; with host.kind = "mcpp", mcpp.toml's [test] discover
6491
# (else tests/**/*.cpp).

0 commit comments

Comments
 (0)