feat: Build Event Protocol stream and vbs new (G1, F7)
VoidBuildSystem CI / 1 · Requirements (push) Successful in 3s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m18s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 3m10s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m2s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m25s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m26s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m29s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 35s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 18s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m57s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 7m56s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 1 · Requirements (push) Successful in 3s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m18s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 3m10s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 5m2s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m25s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m26s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 1m29s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 35s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 18s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m57s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 7m56s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
--bep FILE on build/test/run writes a newline-delimited JSON event stream (build_started, profile_started, action_started, action_finished, test_finished with the exit code, build_finished), serialized with Void::Json::Strict. vbs new is a Cargo-style alias of init with the same project templates. Verified: bep_stream_contains_build_action_and_test_events passes (all event kinds present, failing test carries a non-zero exit code) and the CLI contract suite passes; clang-format clean.
This commit is contained in:
1 parent
55f93d5c1c
commit
11d4a3f5d7
7 files changed
+167
-18
No files matched your search
@@ -410,6 +410,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
- `vbs install-binary NAME [--version V] [--variant ID] [--prefix DIR] [--list]` resolves the newest release when no version is given (Void::Semver ordering), picks the host os/arch variant by default, verifies signatures when trusted keys are configured, downloads with SHA-256 verification and installs into `<prefix>/bin`.
|
||||
- `vbs add NAME[@RANGE]` and `vbs remove NAME` edit `vbs.deps.toml` (canonical, comment-preserving block append/removal), validate version ranges through `Void::Semver::parse_range`, and refresh `vbs.lock` through the existing resolver (`--no-lock` skips it).
|
||||
- `--frozen` on `build`/`test`/`run` implies `--locked --offline`.
|
||||
- `vbs new` is a Cargo-style alias of `init` with the same templates.
|
||||
- `--bep FILE` on `build`/`test`/`run` writes a newline-delimited JSON Build Event Protocol stream (build/profile started, action started/finished, test finished with exit code, build finished), serialized with `Void::Json::Strict`.
|
||||
- **Native compiler caching**: `--native-cache off|auto|ccache|sccache` (or `VBS_NATIVE_CACHE`) prepends ccache/sccache to compile actions only; the wrapper and real compiler are part of the action key, archives/links are untouched, and `vbs doctor` reports availability. Verified deterministically by `FullV1Tests.native_cache_wrapper_is_lowered_into_compile_commands` and end to end when the tool is installed (`native_cache_wraps_compile_actions`).
|
||||
|
||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||
|
||||
@@ -146,5 +146,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 144 (NuGet generator) | `--archive-format nuget`: `.nupkg` with nuspec, OPC parts and `runtimes/<rid>/native` assets | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Python validates the package, install test passes, full CTest 8/8) | `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Wave 145 (Coverage reporting) | `vbs test --coverage DIR`; gcov JSON -> lcov + summary | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `include/Void/Build/Report/Coverage.hpp`, `src/Report/Coverage.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Wave 146 (CI hardening, explainability, shared caches, CLI surface, migration breadth) | CI image tool upgrades + coverage lane; test `--repeat/--retry/--shuffle/--stop-on-failure`; `vbs explain`; `--trace` Chrome traces; shared descriptor/probe caches; `vbs completions`/`vbs man`; `vbs migrate --from meson`; `vbs init --template`; `vbs presets --export`; MSI installer | COMPLETE & VERIFIED (GCC 16.2; new FullV1Tests cases for every feature pass, CLI contract suite passes; cold build 3897 -> 755 ms measured) | `src/Main.cpp`, `src/Execution/Scheduler.{hpp,cpp}`, `src/Cli/CommandModel.{hpp,cpp}`, `src/Config/{Frontend,Scaffold,CmakeImport}.cpp`, `src/Toolchain/Driver.cpp`, `include/Void/Build/Util/UserCache.hpp`, `.gitea/workflows/ci.yml`, [Void/CI-Images](https://git.faumaray.com/Void/CI-Images), `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Wave 147 (Lifecycle CLI + native caching) | `vbs run` (Void::Process inherited stdio, exit-code passthrough, Wine), `vbs metadata` (StrictJson schema v1), `vbs why`, `vbs tree`, `vbs fmt`/`vbs lint`, `vbs install-binary`, `vbs add`/`vbs remove` (Semver-validated manifest editing + lock refresh), `--frozen`, `--native-cache off/auto/ccache/sccache` with doctor reporting | COMPLETE & VERIFIED for the implemented commands (GCC 16.2; `lifecycle_run_metadata_why_and_manifest_editing`, `tree_prints_lock_entries_and_reports_duplicates`, `fmt_check_detects_unformatted_files_and_fixes_them`, `native_cache_wrapper_is_lowered_into_compile_commands`, `native_cache_wraps_compile_actions` pass; CLI contracts pass) | `src/Main.cpp`, `src/Toolchain/Driver.{hpp,cpp}`, `src/Package/Manifest.{hpp,cpp}`, `include/Void/Build/Package/Manifest.hpp`, `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Wave 147 (Lifecycle CLI + native caching + BEP) | `vbs run` (Void::Process inherited stdio, exit-code passthrough, Wine), `vbs metadata` (StrictJson schema v1), `vbs why`, `vbs tree`, `vbs fmt`/`vbs lint`, `vbs install-binary`, `vbs add`/`vbs remove` (Semver-validated manifest editing + lock refresh), `vbs new`, `--frozen`, `--bep` event stream, `--native-cache off/auto/ccache/sccache` with doctor reporting | COMPLETE & VERIFIED for the implemented commands (GCC 16.2; lifecycle, tree, fmt, BEP and native-cache tests pass; CLI contracts pass) | `src/Main.cpp`, `src/Toolchain/Driver.{hpp,cpp}`, `src/Package/Manifest.{hpp,cpp}`, `include/Void/Build/Package/Manifest.hpp`, `tests/{FullV1Tests,CliContracts}`, docs |
|
||||
| Future (Plans 23–24) | Gap closure and superiority tracks | PLANNED (see the plans for per-track acceptance gates) | [23-remaining-upgrade-plan.md](../roadmap/23-remaining-upgrade-plan.md), [24-superiority-tracks.md](../roadmap/24-superiority-tracks.md) |
|
||||
@@ -327,6 +327,11 @@ federation doubles storage; mirror ordering can hide stale artifacts.
|
||||
|
||||
### F7 — Build Event Protocol stream *(S)*
|
||||
|
||||
**Status: implemented (Wave 147).** `vbs build|test|run --bep FILE` writes newline-delimited
|
||||
JSON with `build_started`, `profile_started`, `action_started`, `action_finished`,
|
||||
`test_finished` (exit code) and `build_finished` events, verified by
|
||||
`FullV1Tests.bep_stream_contains_build_action_and_test_events`. `--bep-http` remains out of scope.
|
||||
|
||||
**Goal.** Emit a machine-readable event stream for CI dashboards, beyond the Chrome trace.
|
||||
|
||||
**Planned interface.**
|
||||
|
||||
@@ -109,9 +109,9 @@ the concrete acceptance gate.
|
||||
|
||||
### G1 — Cargo-grade lifecycle CLI *(S–M per command)*
|
||||
|
||||
**Status: partially implemented (Wave 147).** Done: `run`, `metadata`, `why`, `add`, `remove`,
|
||||
`tree`, `fmt`, `lint`, `install-binary`, `--frozen`. Pending: `new`, `bench`, `doc`, `outdated`,
|
||||
`update -p`, `audit`, `deny`, `vendor`.
|
||||
**Status: partially implemented (Wave 147).** Done: `new`, `run`, `metadata`, `why`, `add`,
|
||||
`remove`, `tree`, `fmt`, `lint`, `install-binary`, `--frozen`. Pending: `bench`, `doc`,
|
||||
`outdated`, `update -p`, `audit`, `deny`, `vendor`.
|
||||
|
||||
**Beats:** Cargo (parity), CMake/Meson/build2 (they have no unified lifecycle).
|
||||
|
||||
|
||||
+97
-14
@@ -451,6 +451,7 @@ struct BuildCmdOptions {
|
||||
bool explain{false};
|
||||
std::string explain_format{"text"};
|
||||
std::optional<std::string> trace_arg;
|
||||
std::optional<std::string> bep_arg;
|
||||
bool run_after_build{false};
|
||||
std::vector<std::string> run_args;
|
||||
bool frozen{false};
|
||||
@@ -570,6 +571,59 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
std::max(0.0, trace_now_us() - dur), dur, std::move(detail)});
|
||||
};
|
||||
|
||||
// Build Event Protocol stream (`--bep FILE`): newline-delimited JSON events.
|
||||
struct BepEvent {
|
||||
std::string kind;
|
||||
std::string label;
|
||||
std::string detail;
|
||||
std::optional<int> exit_code;
|
||||
double duration_ms{0};
|
||||
};
|
||||
std::vector<BepEvent> bep_events;
|
||||
std::mutex bep_mutex;
|
||||
const auto bep_emit = [&](std::string kind, std::string label, std::string detail,
|
||||
std::optional<int> exit_code = std::nullopt,
|
||||
double duration_ms = 0.0) {
|
||||
if (!opts.bep_arg) {
|
||||
return;
|
||||
}
|
||||
std::lock_guard lock{bep_mutex};
|
||||
bep_events.push_back({std::move(kind), std::move(label), std::move(detail), exit_code,
|
||||
duration_ms});
|
||||
};
|
||||
const auto flush_bep = [&]() {
|
||||
if (!opts.bep_arg) {
|
||||
return;
|
||||
}
|
||||
using JsonValue = Void::Json::Strict::Value;
|
||||
std::string out;
|
||||
std::int64_t seq = 0;
|
||||
std::lock_guard lock{bep_mutex};
|
||||
for (const auto &event : bep_events) {
|
||||
JsonValue::Object object;
|
||||
object["seq"] = JsonValue{++seq};
|
||||
object["kind"] = JsonValue{event.kind};
|
||||
object["label"] = JsonValue{event.label};
|
||||
if (!event.detail.empty()) {
|
||||
object["detail"] = JsonValue{event.detail};
|
||||
}
|
||||
if (event.exit_code) {
|
||||
object["exit_code"] = JsonValue{static_cast<std::int64_t>(*event.exit_code)};
|
||||
}
|
||||
object["duration_ms"] = JsonValue{event.duration_ms};
|
||||
JsonValue root;
|
||||
root.value = std::move(object);
|
||||
if (auto line = Void::Json::Strict::serialize(root); line) {
|
||||
out += *line;
|
||||
out += '\n';
|
||||
}
|
||||
}
|
||||
if (auto written = Platform::atomic_write_file(*opts.bep_arg, out, false); !written) {
|
||||
std::cerr << "vbs: cannot write the BEP stream: " << written.error().message()
|
||||
<< '\n';
|
||||
}
|
||||
};
|
||||
|
||||
std::optional<CompilerFamily> compiler_override;
|
||||
if (opts.compiler_arg) {
|
||||
try {
|
||||
@@ -739,7 +793,9 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
}
|
||||
}
|
||||
|
||||
bep_emit("build_started", project_root.filename().string(), project_root.string());
|
||||
for (const auto &prof_name : opts.profiles) {
|
||||
bep_emit("profile_started", prof_name, project_root.string());
|
||||
const auto prof_sw = Void::Time::Stopwatch::started();
|
||||
ProfileContext ctx;
|
||||
try {
|
||||
@@ -982,8 +1038,18 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
eopts.jobs = jobs;
|
||||
eopts.use_cache = !opts.no_cache;
|
||||
eopts.selected_targets = opts.targets;
|
||||
if (opts.trace_arg) {
|
||||
if (opts.trace_arg || opts.bep_arg) {
|
||||
eopts.on_event = [&](const Execution::ExecutionEvent &ev) {
|
||||
if (ev.kind == Execution::ExecutionEvent::Kind::ActionStarted) {
|
||||
bep_emit("action_started", ev.label, ev.action_id);
|
||||
} else {
|
||||
bep_emit("action_finished", ev.label, ev.message,
|
||||
ev.kind == Execution::ExecutionEvent::Kind::ActionFailed ? 1 : 0,
|
||||
static_cast<double>(ev.elapsed.count()));
|
||||
}
|
||||
if (!opts.trace_arg) {
|
||||
return;
|
||||
}
|
||||
std::lock_guard lock{trace_mutex};
|
||||
const double now = trace_now_us();
|
||||
if (ev.kind == Execution::ExecutionEvent::Kind::ActionStarted) {
|
||||
@@ -1182,6 +1248,8 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
std::cerr << "vbs run: program terminated by signal " << status->signal << '\n';
|
||||
return 128 + status->signal;
|
||||
}
|
||||
bep_emit("build_finished", chosen->name, "run", status->code, total_sw.elapsed_ms());
|
||||
flush_bep();
|
||||
return status->code;
|
||||
}
|
||||
|
||||
@@ -1567,6 +1635,8 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
} else {
|
||||
std::cout << "vbs test: PASSED '" << record->name << "'\n";
|
||||
}
|
||||
bep_emit("test_finished", record->name, record->profile, record->exit_code,
|
||||
record->elapsed_ms);
|
||||
test_records.push_back(std::move(*record));
|
||||
}
|
||||
}
|
||||
@@ -1726,6 +1796,10 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
}
|
||||
}
|
||||
|
||||
bep_emit("build_finished", project_root.filename().string(), all_ok ? "ok" : "failed",
|
||||
all_ok ? 0 : 1, total_sw.elapsed_ms());
|
||||
flush_bep();
|
||||
|
||||
if (opts.trace_arg && !opts.trace_arg->empty()) {
|
||||
trace_phase("total", "phase", total_sw.elapsed_ms(), "whole invocation");
|
||||
const auto json_escape = [](std::string_view text) {
|
||||
@@ -5397,6 +5471,9 @@ int main(int argc, char **argv) {
|
||||
.option("--trace", "",
|
||||
"Write a Chrome trace (JSON) of build phases and action spans",
|
||||
build_opts.trace_arg)
|
||||
.option("--bep", "",
|
||||
"Write a newline-delimited JSON Build Event Protocol stream to this file",
|
||||
build_opts.bep_arg)
|
||||
.option("--junit", "", "Write a JUnit XML report of test results", build_opts.junit_arg)
|
||||
.option("--coverage", "", "Build with --coverage and write an lcov report to this directory",
|
||||
build_opts.coverage_arg)
|
||||
@@ -5773,20 +5850,26 @@ int main(int argc, char **argv) {
|
||||
gen_tests_opts.out_arg);
|
||||
add_log_flags(gen_tests_cmd);
|
||||
|
||||
auto configure_init = [&](Void::Argparse::Parser &p) {
|
||||
p.option_default("--dir", "-C", "Target project directory", init_opts.dir_arg, cwd)
|
||||
.option("--name", "-n", "Project/target name (defaults to directory name)",
|
||||
init_opts.name_arg)
|
||||
.option_default_checked(
|
||||
"--template", "-t",
|
||||
"Project template: app (default), library, header-only or shared",
|
||||
init_opts.template_arg, "app", {"app", "library", "header-only", "shared"})
|
||||
.flag("--library", "", "Scaffold a static library project instead of an executable",
|
||||
init_opts.library)
|
||||
.flag("--with-toml", "", "Include a vbs.deps.toml dependency manifest",
|
||||
init_opts.with_toml)
|
||||
.flag("--force", "", "Overwrite existing build.cpp if present", init_opts.force);
|
||||
add_log_flags(p);
|
||||
};
|
||||
auto &init_cmd =
|
||||
root.subcommand("init", "Scaffold a new ready-to-build C++26 VoidBuildSystem project");
|
||||
init_cmd.option_default("--dir", "-C", "Target project directory", init_opts.dir_arg, cwd)
|
||||
.option("--name", "-n", "Project/target name (defaults to directory name)",
|
||||
init_opts.name_arg)
|
||||
.option_default_checked("--template", "-t",
|
||||
"Project template: app (default), library, header-only or shared",
|
||||
init_opts.template_arg, "app",
|
||||
{"app", "library", "header-only", "shared"})
|
||||
.flag("--library", "", "Scaffold a static library project instead of an executable",
|
||||
init_opts.library)
|
||||
.flag("--with-toml", "", "Include a vbs.deps.toml dependency manifest", init_opts.with_toml)
|
||||
.flag("--force", "", "Overwrite existing build.cpp if present", init_opts.force);
|
||||
add_log_flags(init_cmd);
|
||||
configure_init(init_cmd);
|
||||
auto &new_cmd = root.subcommand("new", "Create a new VBS project (init with templates)");
|
||||
configure_init(new_cmd);
|
||||
|
||||
auto &clean_cmd =
|
||||
root.subcommand("clean", "Remove generated profile build artifacts (preserving cache)");
|
||||
@@ -6287,7 +6370,7 @@ int main(int argc, char **argv) {
|
||||
if (cmd == "gen-tests") {
|
||||
return execute_gen_tests_command(gen_tests_opts);
|
||||
}
|
||||
if (cmd == "init") {
|
||||
if (cmd == "init" || cmd == "new") {
|
||||
return execute_init_command(init_opts);
|
||||
}
|
||||
if (cmd == "clean") {
|
||||
|
||||
@@ -50,6 +50,8 @@ check_process(0 "Usage: vbs add " "" add --help)
|
||||
check_process(0 "Usage: vbs remove " "" remove --help)
|
||||
check_process(0 "--frozen" "" build --help)
|
||||
check_process(0 "--native-cache" "" build --help)
|
||||
check_process(0 "--bep" "" build --help)
|
||||
check_process(0 "Usage: vbs new " "" new --help)
|
||||
check_process(2 "" "unsupported --native-cache" build --native-cache bogus)
|
||||
check_process(2 "" "invalid version range" add fmt@bad --no-lock)
|
||||
check_process(0 "Usage: vbs fmt " "" fmt --help)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <Void/Core/Scope.hpp>
|
||||
#include <Void/Data/StrictJson.hpp>
|
||||
#include <Void/System/Path.hpp>
|
||||
#include <Void/Text/Str.hpp>
|
||||
#include <Void/System/TempDir.hpp>
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
@@ -4655,3 +4656,59 @@ void build(Void::Build::Project &p) { p.executable("app").sources({"src/main.cpp
|
||||
auto recheck = run_vbs({"fmt", "--check", "--project", proj.string(), "src/ugly.cpp"});
|
||||
Void::Testing::expect(recheck.has_value() && recheck->succeeded());
|
||||
}
|
||||
|
||||
// === Build Event Protocol stream ===
|
||||
VOID_TEST(FullV1Tests, bep_stream_contains_build_action_and_test_events) {
|
||||
const auto vbs_bin = locate_vbs_binary();
|
||||
Void::Testing::expect(!vbs_bin.empty() && std::filesystem::exists(vbs_bin));
|
||||
if (vbs_bin.empty() || !std::filesystem::exists(vbs_bin)) {
|
||||
return;
|
||||
}
|
||||
Void::FileSystem::TempDir tmp{"vbs_bep_"};
|
||||
const auto proj = tmp / "proj";
|
||||
write_file(proj / "build.cpp", R"cpp(#include <Void/Build.hpp>
|
||||
void build(Void::Build::Project &p) {
|
||||
p.test("pass").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"tests/pass.cpp"});
|
||||
p.test("fail").cxx_standard(Void::Build::CxxStandard::Cxx26).sources({"tests/fail.cpp"});
|
||||
}
|
||||
)cpp");
|
||||
write_file(proj / "tests" / "pass.cpp", "int main() { return 0; }\n");
|
||||
write_file(proj / "tests" / "fail.cpp", "int main() { return 3; }\n");
|
||||
const auto bep = tmp / "events.jsonl";
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = {"test", "--project", proj.string(), "--build-dir",
|
||||
(tmp / "build").string(), "--jobs", "2", "--bep", bep.string()};
|
||||
req.timeout = std::chrono::seconds{600};
|
||||
auto res = Platform::run_supervised(req);
|
||||
Void::Testing::expect(res.has_value() && !res->succeeded()); // the failing test fails the run
|
||||
auto text = Void::FileSystem::read_file(bep);
|
||||
Void::Testing::require(text.has_value());
|
||||
std::set<std::string> kinds;
|
||||
bool saw_failing_test = false;
|
||||
for (const auto &line : Void::Str::split(*text, '\n')) {
|
||||
if (line.empty()) {
|
||||
continue;
|
||||
}
|
||||
auto parsed = Void::Json::Strict::parse(std::string{line});
|
||||
Void::Testing::require(parsed.has_value());
|
||||
const auto *object = std::get_if<Void::Json::Strict::Value::Object>(&parsed->value);
|
||||
Void::Testing::require(object != nullptr);
|
||||
const auto *kind = std::get_if<std::string>(&object->at("kind").value);
|
||||
Void::Testing::require(kind != nullptr);
|
||||
kinds.insert(*kind);
|
||||
const auto *label = std::get_if<std::string>(&object->at("label").value);
|
||||
if (*kind == "test_finished" && label != nullptr && *label == "fail") {
|
||||
const auto *exit_code = std::get_if<std::int64_t>(&object->at("exit_code").value);
|
||||
Void::Testing::require(exit_code != nullptr);
|
||||
saw_failing_test = *exit_code != 0;
|
||||
}
|
||||
}
|
||||
Void::Testing::expect(kinds.contains("build_started"));
|
||||
Void::Testing::expect(kinds.contains("profile_started"));
|
||||
Void::Testing::expect(kinds.contains("action_started"));
|
||||
Void::Testing::expect(kinds.contains("action_finished"));
|
||||
Void::Testing::expect(kinds.contains("test_finished"));
|
||||
Void::Testing::expect(kinds.contains("build_finished"));
|
||||
Void::Testing::expect(saw_failing_test);
|
||||
}
|
||||
Reference in new issue
Block a user