Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions modules/core/runners/src/runners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ void WorkerTestFailurePrinter::PrintProcessRank() {
std::cerr << std::format(" [ PROCESS {} ] ", rank);
}

namespace {
int RunAllTests() {
auto status = RUN_ALL_TESTS();
if (ppc::util::DestructorFailureFlag::Get()) {
throw std::runtime_error(
std::format("[ ERROR ] Destructor failed with code {}", ppc::util::DestructorFailureFlag::Get()));
}
return status;
}
} // namespace

int Init(int argc, char** argv) {
const int init_res = MPI_Init(&argc, &argv);
if (init_res != MPI_SUCCESS) {
Expand All @@ -81,12 +92,8 @@ int Init(int argc, char** argv) {
listeners.Append(new ppc::core::WorkerTestFailurePrinter(std::shared_ptr<::testing::TestEventListener>(listener)));
}
listeners.Append(new ppc::core::UnreadMessagesDetector());
auto status = RUN_ALL_TESTS();

if (ppc::util::DestructorFailureFlag::Get()) {
throw std::runtime_error(
std::format("[ ERROR ] Destructor failed with code {}", ppc::util::DestructorFailureFlag::Get()));
}
auto status = RunAllTests();

const int finalize_res = MPI_Finalize();
if (finalize_res != MPI_SUCCESS) {
Expand All @@ -102,12 +109,7 @@ int SimpleInit(int argc, char** argv) {
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetNumThreads());

testing::InitGoogleTest(&argc, argv);
auto status = RUN_ALL_TESTS();
if (ppc::util::DestructorFailureFlag::Get()) {
throw std::runtime_error(
std::format("[ ERROR ] Destructor failed with code {}", ppc::util::DestructorFailureFlag::Get()));
}
return status;
return RunAllTests();
}

} // namespace ppc::core
Loading