feat(test): report results to CDash
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 10s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 14s
VoidBuildSystem CI / fuzz-clang (push) Failing after 8s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 7s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 54s
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 10s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 14s
VoidBuildSystem CI / fuzz-clang (push) Failing after 8s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 7s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 54s
This commit is contained in:
1 parent
6befa6b5e2
commit
9d7c801e2d
9 files changed
+458
-2
No files matched your search
@@ -27,6 +27,7 @@
|
||||
#include <Void/Build/Provenance/Verification.hpp>
|
||||
#include <Void/Build/Provider/Provider.hpp>
|
||||
#include <Void/Build/Provider/Translator.hpp>
|
||||
#include <Void/Build/Report/Cdash.hpp>
|
||||
#include <Void/Build/SelfHost/TestRegistryGen.hpp>
|
||||
#include <Void/Build/Snapshot/Snapshot.hpp>
|
||||
#include <Void/Build/State/StateStore.hpp>
|
||||
@@ -57,6 +58,7 @@
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <filesystem>
|
||||
#include <format>
|
||||
#include <functional>
|
||||
@@ -391,6 +393,10 @@ struct BuildCmdOptions {
|
||||
std::optional<std::string> target_os_arg;
|
||||
std::optional<std::string> target_arch_arg;
|
||||
std::optional<std::string> junit_arg;
|
||||
std::optional<std::string> cdash_arg;
|
||||
std::optional<std::string> cdash_project_arg;
|
||||
std::optional<std::string> cdash_build_arg;
|
||||
std::optional<std::string> cdash_output_arg;
|
||||
std::string test_timeout_arg{"300"};
|
||||
bool publish_editor_selection{true};
|
||||
bool no_cache{false};
|
||||
@@ -1161,6 +1167,46 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
|
||||
}
|
||||
}
|
||||
|
||||
// CDash Test.xml report (and optional submission) for CI dashboards.
|
||||
if (run_tests && !test_records.empty() &&
|
||||
(opts.cdash_arg.has_value() || opts.cdash_output_arg.has_value())) {
|
||||
Report::CdashReportOptions cdash;
|
||||
cdash.build_name = opts.cdash_build_arg.value_or("vbs");
|
||||
cdash.os_name = Toolchain::host_os_name();
|
||||
const std::time_t now =
|
||||
std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||
std::tm tm{};
|
||||
::gmtime_r(&now, &tm);
|
||||
cdash.build_stamp =
|
||||
std::format("{:04d}{:02d}{:02d}-{:02d}{:02d}-Experimental", tm.tm_year + 1900,
|
||||
tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min);
|
||||
for (const auto &record : test_records) {
|
||||
cdash.tests.push_back(Report::CdashTestResult{
|
||||
record.name, record.passed, record.elapsed_ms / 1000.0, record.output});
|
||||
}
|
||||
if (opts.cdash_output_arg) {
|
||||
if (auto written = Platform::atomic_write_file(
|
||||
*opts.cdash_output_arg, Report::render_cdash_test_xml(cdash), false);
|
||||
!written) {
|
||||
std::cerr << "vbs test: cannot write CDash report: " << written.error().message()
|
||||
<< '\n';
|
||||
all_ok = false;
|
||||
}
|
||||
}
|
||||
if (opts.cdash_arg) {
|
||||
const std::string project =
|
||||
opts.cdash_project_arg.value_or(project_root.filename().string());
|
||||
if (auto submitted = Report::submit_cdash_report(*opts.cdash_arg, project, cdash);
|
||||
!submitted) {
|
||||
std::cerr << "vbs test: " << submitted.error().message() << '\n';
|
||||
all_ok = false;
|
||||
} else {
|
||||
Void::Log::info("Test", "Submitted CDash test report to {} (project '{}')",
|
||||
*opts.cdash_arg, project);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void::Log::debug("Build", "Total wall time: {:.2f}s", total_sw.elapsed_ms() / 1000.0);
|
||||
return all_ok ? 0 : 1;
|
||||
}
|
||||
@@ -3364,6 +3410,14 @@ int main(int argc, char **argv) {
|
||||
.option_default("--test-timeout", "", "Per-test timeout in seconds (1..86400)",
|
||||
build_opts.test_timeout_arg, "300")
|
||||
.option("--junit", "", "Write a JUnit XML report of test results", build_opts.junit_arg)
|
||||
.option("--cdash", "", "Upload a CDash test report to this base URL",
|
||||
build_opts.cdash_arg)
|
||||
.option("--cdash-project", "", "CDash project name (default: project directory name)",
|
||||
build_opts.cdash_project_arg)
|
||||
.option("--cdash-build", "", "CDash build name (default: vbs)",
|
||||
build_opts.cdash_build_arg)
|
||||
.option("--cdash-output", "", "Write the CDash Test.xml report to this file",
|
||||
build_opts.cdash_output_arg)
|
||||
.option("--editor-profile", "", "Editor profile for compile_commands.json",
|
||||
build_opts.editor_profile)
|
||||
.option_many("--build-source", "", "Additional build description source",
|
||||
|
||||
Reference in new issue
Block a user