feat(test): write JUnit reports and honour a per-test timeout
This commit is contained in:
1 parent
ce47c23cda
commit
1e670cb96b
7 files changed
+147
-3
No files matched your search
@@ -24,6 +24,7 @@ check_process(2 "" "--version cannot be combined with subcommands" --version bui
|
||||
check_process(2 "" "unknown subcommand: invalid" invalid)
|
||||
check_process(0 "Usage: vbs build .*--native-foreign.*--profile.*\\(repeatable\\)" "" build --help)
|
||||
check_process(0 "Usage: vbs test " "" test --help)
|
||||
check_process(2 "" "invalid --test-timeout" test --test-timeout 0)
|
||||
check_process(0 "Usage: vbs init " "" init --help)
|
||||
check_process(0 "Usage: vbs clean " "" clean --help)
|
||||
check_process(0 "Usage: vbs doctor " "" doctor --help)
|
||||
|
||||
+12
-1
@@ -1988,7 +1988,10 @@ void build(Void::Build::Project &p) {
|
||||
|
||||
Platform::ProcessRequest req;
|
||||
req.executable = vbs_bin;
|
||||
req.arguments = {"test", "--project", cons_dir.string(), "--build-dir", cons_build.string()};
|
||||
const auto junit_report = tmp / "consumer-junit.xml";
|
||||
req.arguments = {"test", "--project", cons_dir.string(),
|
||||
"--build-dir", cons_build.string(), "--test-timeout",
|
||||
"120", "--junit", junit_report.string()};
|
||||
req.environment.set_vars["PATH"] = trapped_path;
|
||||
req.timeout = std::chrono::seconds{120};
|
||||
auto res = Platform::run_supervised(req);
|
||||
@@ -2000,6 +2003,14 @@ void build(Void::Build::Project &p) {
|
||||
if (res) {
|
||||
Void::Testing::expect(res->stdout_data.find("PASSED 'consumer_test'") != std::string::npos);
|
||||
}
|
||||
|
||||
// JUnit XML report for CI consumption.
|
||||
auto junit = Void::FileSystem::read_file(junit_report);
|
||||
Void::Testing::require(junit.has_value());
|
||||
Void::Testing::expect(junit->find("<testsuites") != std::string::npos);
|
||||
Void::Testing::expect(junit->find("<testsuite name=\"debug\"") != std::string::npos);
|
||||
Void::Testing::expect(junit->find("name=\"consumer_test\"") != std::string::npos);
|
||||
Void::Testing::expect(junit->find("failures=\"0\"") != std::string::npos);
|
||||
}
|
||||
|
||||
// === Track B1: First-class C driver & mixed C/C++ native CMake + Meson translation ===
|
||||
|
||||
Reference in new issue
Block a user