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
@@ -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