Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner
diff options
context:
space:
mode:
authorLeitwolf112026-10-24 10:06:25 +0300
committerLeitwolf112026-10-24 10:06:25 +0300
commite104b694513964d5a84e77f751203cda970d741b (patch)
treea7d6e6d5cca1e98702549f02489e3570599ca3b4 /src/Progmasoft/Runner
parent15eb534ee493a3388c168709eb79a954e9cb5fcf (diff)
downloadcatch3-e104b694513964d5a84e77f751203cda970d741b.tar.gz
Fix the CI failures of the runner and test its planner, options and analysis
ExtraTests X21 and X27 defined their listeners at namespace scope, which clang rejects under -Wweak-vtables with -Werror on Linux and macOS; they are now in anonymous namespaces. After a fatal signal Catch2 closes the open sections itself, so on POSIX a crash was reported outside the section it happened in. The scheduler now ignores section ends that follow a fatal condition. New unit tests cover the planner (every selection, dependency closure and cycles, hash and duration shards, incremental runs, learned time limits, ordering, retries, quarantine and replay), every command-line option and its errors, and the failure analysis (history classes, signature groups, crash and hang locations, changed files, replay commands). Catalog::FromEntries builds a catalog without a test registry so the planner can be tested on its own.
Diffstat (limited to 'src/Progmasoft/Runner')
-rw-r--r--src/Progmasoft/Runner/Catalog.cpp21
-rw-r--r--src/Progmasoft/Runner/Catalog.hpp13
-rw-r--r--src/Progmasoft/Runner/Scheduler.cpp5
3 files changed, 34 insertions, 5 deletions
diff --git a/src/Progmasoft/Runner/Catalog.cpp b/src/Progmasoft/Runner/Catalog.cpp
index c34e81e0..c9d838f4 100644
--- a/src/Progmasoft/Runner/Catalog.cpp
+++ b/src/Progmasoft/Runner/Catalog.cpp
@@ -209,6 +209,27 @@ namespace Progmasoft::Catch3::Runner
return catalog;
}
+ Catalog
+ Catalog::FromEntries(std::vector<TestEntry> entries)
+ {
+ Catalog catalog;
+ Sha256 identity;
+ for (std::size_t index = 0; index < entries.size(); ++index)
+ {
+ TestEntry &entry = entries[index];
+ entry.index = index;
+ if (entry.key.empty())
+ {
+ entry.key = entry.name;
+ }
+ identity.Update(entry.key);
+ identity.Update("\n");
+ }
+ catalog.tests_ = std::move(entries);
+ catalog.identity_ = identity.HexDigest();
+ return catalog;
+ }
+
const TestEntry *
Catalog::Find(const std::string &keyOrName) const
{
diff --git a/src/Progmasoft/Runner/Catalog.hpp b/src/Progmasoft/Runner/Catalog.hpp
index 49c7a9f5..5cc9d0c6 100644
--- a/src/Progmasoft/Runner/Catalog.hpp
+++ b/src/Progmasoft/Runner/Catalog.hpp
@@ -2,20 +2,19 @@
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1
#pragma once
-#include "Expected.hpp"
-
#include <catch2/catch_test_case_info.hpp>
-
#include <chrono>
#include <cstddef>
#include <optional>
#include <string>
#include <vector>
+#include "Expected.hpp"
+
namespace Catch
{
class IConfig;
-}
+} // namespace Catch
namespace Progmasoft::Catch3::Runner
{
@@ -65,6 +64,12 @@ namespace Progmasoft::Catch3::Runner
[[nodiscard]] static Expected<Catalog>
Load();
+ /// A catalog of the given tests, without a registry behind it: the
+ /// tests cannot run, but they can be planned. Each entry's index
+ /// becomes its position, and an empty key becomes its name.
+ [[nodiscard]] static Catalog
+ FromEntries(std::vector<TestEntry> entries);
+
[[nodiscard]] const std::vector<TestEntry> &
Tests() const noexcept
{
diff --git a/src/Progmasoft/Runner/Scheduler.cpp b/src/Progmasoft/Runner/Scheduler.cpp
index e6c8eec5..6a65f289 100644
--- a/src/Progmasoft/Runner/Scheduler.cpp
+++ b/src/Progmasoft/Runner/Scheduler.cpp
@@ -754,8 +754,11 @@ namespace Progmasoft::Catch3::Runner
attempt.sections.push_back(section);
}
}
- else
+ else if (!running.fatal)
{
+ // After a fatal signal Catch2 closes the open
+ // sections itself; they stay open here, because the
+ // crash happened inside them.
const auto depth = message["depth"].AsUnsigned();
for (auto section = attempt.sections.rbegin();
section != attempt.sections.rend();