From f8f3968ec43efd61766f613267e469c8a2b676b4 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sat, 21 Nov 2026 05:20:41 +0900 Subject: [PATCH 1/3] 0.11.1: a command is held to what its case has left time_left() states what the running case has left of its timeout and its scopes'; e2e::run holds a command to it, less a tenth (at most five seconds) the case keeps for its report, and says so (outcome::case_limit). --- CHANGELOG.md | 11 +++++++++++ README.md | 2 +- README.zh-CN.md | 2 +- adapters/doctest/docs/writing-tests.md | 2 +- adapters/doctest/mcpp.toml | 4 ++-- adapters/gtest/mcpp.toml | 2 +- capi/mcpp.toml | 2 +- conformance/mcpp.toml | 2 +- engine/mcpp.toml | 2 +- engine/src/commands.cpp | 2 +- engine/src/service.cpp | 2 +- lib/docs/writing-tests.md | 4 ++-- lib/mcpp.toml | 2 +- lib/src/e2e.cpp | 14 +++++++++++++- lib/src/e2e.cppm | 2 ++ lib/src/mtest.cpp | 14 ++++++++++++++ lib/src/mtest.cppm | 5 +++++ lib/tests/children.cpp | 24 ++++++++++++++++++++++++ manifest/mcpp.toml | 2 +- spec/protocol.md | 1 + 20 files changed, 85 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3230e..6ca6ece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.11.1] - 2026-11-21 + +- **A command is held to what its case has left.** `time_left()` states what the running case has + left of its `timeout`, the earliest end of its own and of each scope's around it, each counted + from when it began; nothing when none states one. `e2e::run` holds a command to it, less a tenth + (at most five seconds) the case keeps for its report: a command that would outlast its case ends + while the case can still say so, with the outputs it wrote, and the outcome's `case_limit` and + the failure's text (`the time its case had left`) say why. A command of a case that states no + time keeps its own limit. Source-compatible with 0.11.0; the engine changes only the version + it states, which the five packages share. + ## [0.11.0] - 2026-11-21 What a test system needs to see the cost of the tests it runs (SPEC-017 v2.5; mcpp's test and CI diff --git a/README.md b/README.md index c553e88..ca18f38 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ int main() { ```toml [dev-dependencies] -mcpplibs.mtest = "0.11.0" +mcpplibs.mtest = "0.11.1" ``` A failure names its place and both sides (`expected 2, actual 3`). Under a runner the same program diff --git a/README.zh-CN.md b/README.zh-CN.md index 97dcd20..aeb8941 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -37,7 +37,7 @@ int main() { ```toml [dev-dependencies] -mcpplibs.mtest = "0.11.0" +mcpplibs.mtest = "0.11.1" ``` 失败时给出位置与两侧的值(`expected 2, actual 3`)。在运行器之下,同一程序按协议报告;单独运行时每个用例输出一行。 diff --git a/adapters/doctest/docs/writing-tests.md b/adapters/doctest/docs/writing-tests.md index e807085..a9083a2 100644 --- a/adapters/doctest/docs/writing-tests.md +++ b/adapters/doctest/docs/writing-tests.md @@ -5,7 +5,7 @@ package `mcpplibs.mtest.doctest` supplies doctest's implementation and the progr ```toml [dev-dependencies] -mcpplibs.mtest.doctest = "0.11.0" +mcpplibs.mtest.doctest = "0.11.1" ``` ```cpp diff --git a/adapters/doctest/mcpp.toml b/adapters/doctest/mcpp.toml index 3acb26e..167024d 100644 --- a/adapters/doctest/mcpp.toml +++ b/adapters/doctest/mcpp.toml @@ -5,7 +5,7 @@ # neither (no `DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN`): # # [dev-dependencies] -# mcpplibs.mtest.doctest = "0.11.0" +# mcpplibs.mtest.doctest = "0.11.1" # # A case's identifier is `/` (P3.2), or `` outside a `TEST_SUITE`. doctest's # macros exist only in its header, so this package's one source includes it, and nlohmann/json's @@ -13,7 +13,7 @@ [package] namespace = "mcpplibs.mtest" name = "doctest" -version = "0.11.0" +version = "0.11.1" description = "doctest speaking the mtest protocol: doctest's implementation and a test main that lists, selects and reports its cases" license = "Apache-2.0" diff --git a/adapters/gtest/mcpp.toml b/adapters/gtest/mcpp.toml index d94e3d6..43e08c3 100644 --- a/adapters/gtest/mcpp.toml +++ b/adapters/gtest/mcpp.toml @@ -13,7 +13,7 @@ [package] namespace = "mcpplibs.mtest" name = "gtest" -version = "0.11.0" +version = "0.11.1" description = "GoogleTest speaking the mtest protocol: a test main that lists, selects and reports GoogleTest's cases" license = "Apache-2.0" diff --git a/capi/mcpp.toml b/capi/mcpp.toml index 9c4f801..f624bc3 100644 --- a/capi/mcpp.toml +++ b/capi/mcpp.toml @@ -4,7 +4,7 @@ [package] namespace = "mcpplibs.mtest" name = "capi" -version = "0.11.0" +version = "0.11.1" description = "mtest's C ABI: the protocol's events for any language with a C FFI" license = "Apache-2.0" diff --git a/conformance/mcpp.toml b/conformance/mcpp.toml index bdf0695..e59cef6 100644 --- a/conformance/mcpp.toml +++ b/conformance/mcpp.toml @@ -8,7 +8,7 @@ [package] namespace = "mcpplibs.mtest" name = "conformance" -version = "0.11.0" +version = "0.11.1" description = "The conformance suite of the mtest protocol, for every implementation of its program side" license = "Apache-2.0" diff --git a/engine/mcpp.toml b/engine/mcpp.toml index dc947f7..3268701 100644 --- a/engine/mcpp.toml +++ b/engine/mcpp.toml @@ -10,7 +10,7 @@ [package] namespace = "mtest" name = "mtest" -version = "0.11.0" +version = "0.11.1" description = "The mtest engine: run, schedule, store, explain and analyse tests of any language" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/engine/src/commands.cpp b/engine/src/commands.cpp index 43c8bf2..51592d2 100644 --- a/engine/src/commands.cpp +++ b/engine/src/commands.cpp @@ -2009,7 +2009,7 @@ json catalog() { plain({{"out", {{"type", "string"}}}, {"argv", {{"type", "array"}, {"items", {{"type", "string"}}}}}}), true); - return {{"schema", "mtest.catalog/1"}, {"version", "0.11.0"}, {"tools", tools}}; + return {{"schema", "mtest.catalog/1"}, {"version", "0.11.1"}, {"tools", tools}}; } } // namespace mcpplibs::mtest::engine diff --git a/engine/src/service.cpp b/engine/src/service.cpp index d3784d7..e1d0d3a 100644 --- a/engine/src/service.cpp +++ b/engine/src/service.cpp @@ -56,7 +56,7 @@ int serve(const std::filesystem::path& cwd) { {"result", {{"protocolVersion", params.value("protocolVersion", std::string("2025-06-18"))}, {"capabilities", {{"tools", {{"listChanged", false}}}}}, - {"serverInfo", {{"name", "mtest"}, {"version", "0.11.0"}}}, + {"serverInfo", {{"name", "mtest"}, {"version", "0.11.1"}}}, {"instructions", "Run tests and ask about runs: run, plan, explain, history, analyze, graph, " "gate, ci. A test session (test/plan, test/run, test/add, test/cancel, " diff --git a/lib/docs/writing-tests.md b/lib/docs/writing-tests.md index 26cc03d..10aaf48 100644 --- a/lib/docs/writing-tests.md +++ b/lib/docs/writing-tests.md @@ -53,7 +53,7 @@ E2E cli{"cli", resource{"serial:home"}, timeout{std::chrono::minutes{2}}, [] { / The entry enters the child before any case; the copy runs no case and reports nothing. The files of one directory are then one program (mcpp `[test] programs = "directory"`) however many of them start copies. -- The manifest names the library once: `[dev-dependencies] mcpplibs.mtest = "0.11.0"`. +- The manifest names the library once: `[dev-dependencies] mcpplibs.mtest = "0.11.1"`. - Identifiers are stable: a selection, a history and a shard name a case by them. ## Expectations @@ -84,7 +84,7 @@ isolation holds for everything inside; the others are the innermost one stated. | `clause{"P3.1"}` | a specification clause the case covers | forms the conformance matrix | | `resource{"serial:db"}`, `resource{"machine"}` | what it holds exclusively | never runs two holders of one `serial:` group, nor a `machine` case beside another, at once | | `artifact{"file:data/x.txt"}` | what it reads | selects it when that changes | -| `timeout{std::chrono::seconds{90}}` | how long it may run | ends the process that runs it at that time; `mtest` first records its processes and asks it to end ([docs/commands.md](../../docs/commands.md) "Timeouts") | +| `timeout{std::chrono::seconds{90}}` | how long it may run | ends the process that runs it at that time; `mtest` first records its processes and asks it to end ([docs/commands.md](../../docs/commands.md) "Timeouts"). Within the case, `time_left()` is what remains of it and of each scope's around it, and `e2e::run` holds a command to that, less a tenth (at most five seconds) the case keeps for its report (0.11.1) | | `isolate{}` | that it runs in a process of its own | starts one for it | | `retries{2}` | that a failure may be retried | runs it again, alone; one that then passes is `flaky` | | `diagnose{.env = {{"APP_LOG", "debug"}}}` | how to look at a failure | runs a failing case once more with that environment and keeps the output (`mtest explain`) | diff --git a/lib/mcpp.toml b/lib/mcpp.toml index 29310cb..d5691c4 100644 --- a/lib/mcpp.toml +++ b/lib/mcpp.toml @@ -17,7 +17,7 @@ [package] namespace = "mcpplibs" name = "mtest" -version = "0.11.0" +version = "0.11.1" description = "The C++ test library of mtest: cases, expectations, fixtures, bench, conformance and end-to-end helpers, with no macro and no header, speaking the mtest protocol" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/lib/src/e2e.cpp b/lib/src/e2e.cpp index 6811905..aff4a7b 100644 --- a/lib/src/e2e.cpp +++ b/lib/src/e2e.cpp @@ -163,6 +163,17 @@ outcome run(command c) { for (auto& kv : c.env) o.env.push_back(std::move(kv)); o.in = c.input.empty() ? os::process::stdio::null : os::process::stdio::pipe; + // A command is held to what its case has left (0.11.1): one that would outlast the case ends + // while the case can still say so, with the outputs it wrote, instead of with the program the + // runner ends at its limit. A tenth of what is left, at most five seconds, stays the case's own + // for its report. + if (const auto left = time_left()) { + const auto keep = (std::min)(*left / 10, std::chrono::milliseconds{5000}); + if (const auto usable = *left - keep; usable < c.timeout) { + c.timeout = (std::max)(usable, std::chrono::milliseconds{1}); + r.case_limit = true; + } + } os::process::bounds limits; limits.hard = c.timeout; limits.out_limit = c.out_limit; @@ -351,7 +362,8 @@ comparison about(const outcome& r, bool held, std::string expression, std::strin if (!r.started) c.actual = std::format("did not start: {}", r.err); else if (r.timed_out) - c.actual = std::format("timed out after {} ms", r.duration.count()); + c.actual = std::format("timed out after {} ms{}", r.duration.count(), + r.case_limit ? ", the time its case had left" : ""); else c.actual = std::format("status {}", r.status); if (!held) diff --git a/lib/src/e2e.cppm b/lib/src/e2e.cppm index 8078ab3..9f0eead 100644 --- a/lib/src/e2e.cppm +++ b/lib/src/e2e.cppm @@ -40,6 +40,8 @@ struct outcome { bool out_truncated = false; bool err_truncated = false; bool held_open = false; + // Its timeout was what its case had left, not the command's own (0.11.1). + bool case_limit = false; std::string out, err; std::chrono::milliseconds duration{0}; std::string line; // the command as a POSIX shell line, to repeat it by hand (0.7.0) diff --git a/lib/src/mtest.cpp b/lib/src/mtest.cpp index f25b705..1bf6a71 100644 --- a/lib/src/mtest.cpp +++ b/lib/src/mtest.cpp @@ -43,6 +43,8 @@ struct running_case { bool capturing = false; // Checks made at its end, before its verdict, by key (at_case_end, 0.11.0). std::vector>> end_checks; + // When it began: its `timeout` counts from here (time_left, 0.11.1). + clock::time_point began = clock::now(); }; // The expectations that held, in the whole program: a case's share is the difference over its @@ -1377,6 +1379,18 @@ std::string current_case() { return s.stack.empty() || s.stack.back().scope ? std::string{} : s.stack.back().id; } +std::optional time_left() { + auto& s = the(); + std::lock_guard g(s.lock); + std::optional deadline; + for (const auto& r : s.stack) + if (r.attrs.limit && (!deadline || r.began + *r.attrs.limit < *deadline)) + deadline = r.began + *r.attrs.limit; + if (!deadline) return std::nullopt; + const auto left = std::chrono::duration_cast(*deadline - clock::now()); + return (std::max)(left, std::chrono::milliseconds{0}); +} + void produced(const std::filesystem::path& file, std::string_view kind) { write_event({{"e", "artifact"}, {"id", current_case()}, diff --git a/lib/src/mtest.cppm b/lib/src/mtest.cppm index ca43117..f5f756e 100644 --- a/lib/src/mtest.cppm +++ b/lib/src/mtest.cppm @@ -846,6 +846,11 @@ private: std::uint64_t seed(); // The identifier of the case that runs now; empty outside a case. std::string current_case(); +// What the running case has left of the time it may run: the earliest end of its own `timeout` and +// of each scope's around it, each counted from when it began; nothing when none states one, or +// outside a case (0.11.1). mcpplibs.mtest.e2e holds each command to it, less a tenth (at most five +// seconds) the case keeps for its report. +std::optional time_left(); // A file the case produced, reported with the case (P5.2 `artifact`). void produced(const std::filesystem::path& file, std::string_view kind = "file"); diff --git a/lib/tests/children.cpp b/lib/tests/children.cpp index 712b150..0496906 100644 --- a/lib/tests/children.cpp +++ b/lib/tests/children.cpp @@ -12,6 +12,12 @@ child echo{"echo", [](std::vector args) { return static_cast(args.size()) + 3; }}; +// Sleeps for its first argument's count of seconds. +child sleeper{"sleeper", [](std::vector args) { + std::this_thread::sleep_for(std::chrono::seconds(std::stoul(args.at(0)))); + return 0; + }}; + // Writes its first argument's count of bytes to standard error, and one line to standard output. child loud{"loud", [](std::vector args) { std::print(std::cerr, "{}", std::string(std::stoul(args.at(0)), 'e')); @@ -43,6 +49,24 @@ UTest children{"children", [] { expect(eq(whole.err.size(), std::size_t{65536})); expect(!whole.err_truncated); }; + // 0.11.1: a command is held to what its case has left of its `timeout`. + "a command ends when its case's time does"_test[timeout{std::chrono::seconds{5}}] = [] { + const auto left = time_left(); + expect(fatal(left.has_value())); + expect(le(left->count(), 5000LL)); + const std::vector secs{"30"}; + auto o = e2e::run({.argv = child_command("sleeper", secs), + .timeout = std::chrono::seconds{60}}); + expect(o.timed_out); + expect(o.case_limit); + expect(lt(o.duration.count(), 5000LL)) << "it did not leave the case time of its own"; + expect(e2e::succeeded(o).actual.contains("the time its case had left")); + }; + "a case that states no time leaves the command its own"_test = [] { + expect(!time_left().has_value()); + auto o = e2e::run({.argv = child_command("echo", {})}); + expect(!o.case_limit); + }; "a name no file declares is refused"_test = [] { auto argv = self_command(); argv.insert(argv.end(), {"--mtest-child", "none"}); diff --git a/manifest/mcpp.toml b/manifest/mcpp.toml index 395cfc5..38e6a07 100644 --- a/manifest/mcpp.toml +++ b/manifest/mcpp.toml @@ -8,7 +8,7 @@ [package] namespace = "mcpplibs.mtest" name = "manifest" -version = "0.11.0" +version = "0.11.1" description = "The static case manifest of mtest: the cases a source file declares, read without building it" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/spec/protocol.md b/spec/protocol.md index ea28e29..57152d0 100644 --- a/spec/protocol.md +++ b/spec/protocol.md @@ -24,6 +24,7 @@ on the spec; this list says which of its clauses mtest's parts answer, and since | P3.3, places and capabilities | a `case` event states `only` and `except` (the platforms and architectures of `only{}`, `except{}`), `capabilities` (each `capability` the case requires, as the program answered it), and the `reason` of a case it lists skipped; the program skips a case outside its places or lacking a capability, whichever runner starts it | 0.8.0 | | B2: P4.3 | a selection's `!` lines leave out a case and the cases it declares, and its `?` lines select a case where it is declared and are not `missing` elsewhere; the `program` event states `selection: ["except", "optional"]` | 0.9.0 | | P5.6 | `step()` writes a `step` event and `exercise()` an `exercise` event of the running case; `e2e::run` writes a step for each command it runs | 0.11.0 | +| O5 within a case | `time_left()` states what a case has left of its `timeout` and its scopes'; `e2e::run` holds a command to it | 0.11.1 | | O12 `jitter` | `contention_point()` waits a random time up to `MTEST_JITTER`, the same for the same `MTEST_JITTER_SEED`; a case begins and a shared object is made at one | 0.11.0 | | O8 `output` | each case's output, kept while it runs under a runner and stated as `output` events; a case declared inside another keeps its own. Where the system cannot rearrange the program's streams (an ok image), no output is kept for a case, the spec's fallback | 0.6.0 | From 38dfc8f2759d23aa1881121bef25222c2fdcfb4d Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sat, 21 Nov 2026 05:38:47 +0900 Subject: [PATCH 2/3] 0.11.1: the clamp leaves what ending a command takes; versions; format --- CHANGELOG.md | 5 +++-- engine/src/main.cpp | 4 ++-- lib/docs/writing-tests.md | 2 +- lib/src/e2e.cpp | 10 ++++++---- lib/src/mtest.cpp | 8 +++++--- lib/src/mtest.cppm | 4 ++-- lib/tests/children.cpp | 8 +++++--- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca6ece..d8f7ab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ - **A command is held to what its case has left.** `time_left()` states what the running case has left of its `timeout`, the earliest end of its own and of each scope's around it, each counted - from when it began; nothing when none states one. `e2e::run` holds a command to it, less a tenth - (at most five seconds) the case keeps for its report: a command that would outlast its case ends + from when it began; nothing when none states one. `e2e::run` holds a command to it, less what ending + the command takes (its grace and drain) and a tenth (at most five seconds) the case keeps for its + report: a command that would outlast its case ends while the case can still say so, with the outputs it wrote, and the outcome's `case_limit` and the failure's text (`the time its case had left`) say why. A command of a case that states no time keeps its own limit. Source-compatible with 0.11.0; the engine changes only the version diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 064ad41..066958d 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -98,7 +98,7 @@ const json* tool_named(const json& tools, std::string_view name) { cmdline::App application(const json& tools) { auto app = cmdline::App("mtest") - .version("0.11.0") + .version("0.11.1") .description("run tests of any language, and ask about their runs") .option(cmdline::Option("json").global().help("print the answer's data")); for (const auto& t : tools) @@ -253,7 +253,7 @@ int main(int argc, char** argv) { const std::string name(parsed->subcommand_name()); const auto& sub = parsed->subcommand()->get(); if (name == "version") { - std::println("mtest 0.11.0"); + std::println("mtest 0.11.1"); return 0; } const auto cwd = std::filesystem::current_path(); diff --git a/lib/docs/writing-tests.md b/lib/docs/writing-tests.md index 10aaf48..56c16fe 100644 --- a/lib/docs/writing-tests.md +++ b/lib/docs/writing-tests.md @@ -84,7 +84,7 @@ isolation holds for everything inside; the others are the innermost one stated. | `clause{"P3.1"}` | a specification clause the case covers | forms the conformance matrix | | `resource{"serial:db"}`, `resource{"machine"}` | what it holds exclusively | never runs two holders of one `serial:` group, nor a `machine` case beside another, at once | | `artifact{"file:data/x.txt"}` | what it reads | selects it when that changes | -| `timeout{std::chrono::seconds{90}}` | how long it may run | ends the process that runs it at that time; `mtest` first records its processes and asks it to end ([docs/commands.md](../../docs/commands.md) "Timeouts"). Within the case, `time_left()` is what remains of it and of each scope's around it, and `e2e::run` holds a command to that, less a tenth (at most five seconds) the case keeps for its report (0.11.1) | +| `timeout{std::chrono::seconds{90}}` | how long it may run | ends the process that runs it at that time; `mtest` first records its processes and asks it to end ([docs/commands.md](../../docs/commands.md) "Timeouts"). Within the case, `time_left()` is what remains of it and of each scope's around it, and `e2e::run` holds a command to that, less what ending it takes and a tenth (at most five seconds) the case keeps for its report (0.11.1) | | `isolate{}` | that it runs in a process of its own | starts one for it | | `retries{2}` | that a failure may be retried | runs it again, alone; one that then passes is `flaky` | | `diagnose{.env = {{"APP_LOG", "debug"}}}` | how to look at a failure | runs a failing case once more with that environment and keeps the output (`mtest explain`) | diff --git a/lib/src/e2e.cpp b/lib/src/e2e.cpp index aff4a7b..ffb69ba 100644 --- a/lib/src/e2e.cpp +++ b/lib/src/e2e.cpp @@ -163,18 +163,20 @@ outcome run(command c) { for (auto& kv : c.env) o.env.push_back(std::move(kv)); o.in = c.input.empty() ? os::process::stdio::null : os::process::stdio::pipe; + os::process::bounds limits; // A command is held to what its case has left (0.11.1): one that would outlast the case ends // while the case can still say so, with the outputs it wrote, instead of with the program the - // runner ends at its limit. A tenth of what is left, at most five seconds, stays the case's own - // for its report. + // runner ends at its limit. What ending it takes -- the grace after asking it to end, the + // drain of its outputs -- comes off first, and a tenth of what is left, at most five seconds, + // stays the case's own for its report. if (const auto left = time_left()) { - const auto keep = (std::min)(*left / 10, std::chrono::milliseconds{5000}); + const auto keep = + (std::min)(*left / 10, std::chrono::milliseconds{5000}) + limits.grace + limits.drain; if (const auto usable = *left - keep; usable < c.timeout) { c.timeout = (std::max)(usable, std::chrono::milliseconds{1}); r.case_limit = true; } } - os::process::bounds limits; limits.hard = c.timeout; limits.out_limit = c.out_limit; limits.err_limit = c.err_limit; diff --git a/lib/src/mtest.cpp b/lib/src/mtest.cpp index 1bf6a71..322fd22 100644 --- a/lib/src/mtest.cpp +++ b/lib/src/mtest.cpp @@ -342,7 +342,7 @@ void write_program() { {"protocol", 1}, {"level", 3}, {"framework", "mcpplibs.mtest"}, - {"version", "0.11.0"}, + {"version", "0.11.1"}, {"isolation", {"process", "case"}}, // P4.3: a selection's `!` and `?` lines are understood. {"selection", {"except", "optional"}}, @@ -1386,8 +1386,10 @@ std::optional time_left() { for (const auto& r : s.stack) if (r.attrs.limit && (!deadline || r.began + *r.attrs.limit < *deadline)) deadline = r.began + *r.attrs.limit; - if (!deadline) return std::nullopt; - const auto left = std::chrono::duration_cast(*deadline - clock::now()); + if (!deadline) + return std::nullopt; + const auto left = + std::chrono::duration_cast(*deadline - clock::now()); return (std::max)(left, std::chrono::milliseconds{0}); } diff --git a/lib/src/mtest.cppm b/lib/src/mtest.cppm index f5f756e..053d3f0 100644 --- a/lib/src/mtest.cppm +++ b/lib/src/mtest.cppm @@ -848,8 +848,8 @@ std::uint64_t seed(); std::string current_case(); // What the running case has left of the time it may run: the earliest end of its own `timeout` and // of each scope's around it, each counted from when it began; nothing when none states one, or -// outside a case (0.11.1). mcpplibs.mtest.e2e holds each command to it, less a tenth (at most five -// seconds) the case keeps for its report. +// outside a case (0.11.1). mcpplibs.mtest.e2e holds each command to it, less what ending the +// command takes and a tenth (at most five seconds) the case keeps for its report. std::optional time_left(); // A file the case produced, reported with the case (P5.2 `artifact`). void produced(const std::filesystem::path& file, std::string_view kind = "file"); diff --git a/lib/tests/children.cpp b/lib/tests/children.cpp index 0496906..02f06b9 100644 --- a/lib/tests/children.cpp +++ b/lib/tests/children.cpp @@ -50,16 +50,18 @@ UTest children{"children", [] { expect(!whole.err_truncated); }; // 0.11.1: a command is held to what its case has left of its `timeout`. - "a command ends when its case's time does"_test[timeout{std::chrono::seconds{5}}] = [] { + "a command ends when its case's time does"_test[timeout{ + std::chrono::seconds{10}}] = [] { const auto left = time_left(); expect(fatal(left.has_value())); - expect(le(left->count(), 5000LL)); + expect(le(left->count(), 10000LL)); const std::vector secs{"30"}; auto o = e2e::run({.argv = child_command("sleeper", secs), .timeout = std::chrono::seconds{60}}); expect(o.timed_out); expect(o.case_limit); - expect(lt(o.duration.count(), 5000LL)) << "it did not leave the case time of its own"; + expect(lt(o.duration.count(), 10000LL)) + << "it did not leave the case time of its own"; expect(e2e::succeeded(o).actual.contains("the time its case had left")); }; "a case that states no time leaves the command its own"_test = [] { From d4a049dc5172ac6a931fdd715201790343d8804e Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sat, 21 Nov 2026 05:42:57 +0900 Subject: [PATCH 3/3] 0.11.1: every program event states the version --- adapters/doctest/src/protocol.cpp | 2 +- adapters/gtest/src/protocol.cpp | 2 +- capi/src/mtest.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adapters/doctest/src/protocol.cpp b/adapters/doctest/src/protocol.cpp index 12999d3..fa06d88 100644 --- a/adapters/doctest/src/protocol.cpp +++ b/adapters/doctest/src/protocol.cpp @@ -162,7 +162,7 @@ int mcpplibs_mtest_doctest_main(int argc, char** argv) { {"protocol", 1}, {"level", 1}, {"framework", "doctest"}, - {"version", "0.11.0"}, + {"version", "0.11.1"}, {"isolation", {"process", "case"}}, {"guide", "https://github.com/mcpp-community/mtest/blob/main/adapters/doctest/docs/" "writing-tests.md"}}); diff --git a/adapters/gtest/src/protocol.cpp b/adapters/gtest/src/protocol.cpp index e47dd1d..0de61e6 100644 --- a/adapters/gtest/src/protocol.cpp +++ b/adapters/gtest/src/protocol.cpp @@ -128,7 +128,7 @@ int mcpplibs_mtest_gtest_main(int argc, char** argv) { {"protocol", 1}, {"level", 1}, {"framework", "googletest"}, - {"version", "0.11.0"}, + {"version", "0.11.1"}, {"isolation", {"process", "case"}}, {"guide", "https://github.com/mcpp-community/mtest/blob/main/adapters/gtest/docs/" "writing-tests.md"}}); diff --git a/capi/src/mtest.cpp b/capi/src/mtest.cpp index c30cd2e..ab1037e 100644 --- a/capi/src/mtest.cpp +++ b/capi/src/mtest.cpp @@ -120,7 +120,7 @@ void mtest_init(const char* framework, int level) { {"protocol", 1}, {"level", std::clamp(level, 1, 3)}, {"framework", text(framework)}, - {"version", "0.11.0"}, + {"version", "0.11.1"}, {"isolation", {"process", "case"}}}); }