From 8b17887240178c9044c3b84064c61d4c0f49baf4 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Sat, 18 Jan 2025 16:24:10 +0100 Subject: [PATCH] Mark tests with exit signal != 0 as failed --- runner/main.cpp | 14 ++++---------- runner/process.cpp | 2 +- runner/runner.cpp | 11 +++-------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/runner/main.cpp b/runner/main.cpp index 0e11459..c1cd48e 100644 --- a/runner/main.cpp +++ b/runner/main.cpp @@ -21,16 +21,10 @@ int main(int argc, char *argv[]) if (args.help()) showHelp(); - if (!args.watch()) - { - std::vector results; - const auto executables = Directory::findExecutableFiles(args.path(), "test_"); - return Runner::runTests(executables, results); - } - else - { + if (args.watch()) WatchMode::runInPath(args.path()); - } - return 0; + std::vector results; + const auto executables = Directory::findExecutableFiles(args.path(), "test_"); + return Runner::runTests(executables, results); } diff --git a/runner/process.cpp b/runner/process.cpp index 323e211..c7b133e 100644 --- a/runner/process.cpp +++ b/runner/process.cpp @@ -39,7 +39,7 @@ static int waitForChildren() return status; } -#include + static int handleParentProcess(int pipe_fd[2], std::function on_output) { std::string output = ""; diff --git a/runner/runner.cpp b/runner/runner.cpp index a935b96..d6f1bce 100644 --- a/runner/runner.cpp +++ b/runner/runner.cpp @@ -58,15 +58,10 @@ int Runner::runTests( counts.total_failed_tests += test_result.num_failed_tests; counts.total_skipped_tests += test_result.num_skipped_tests; - results.push_back( - { - test_result.src_path, - test_result.bin_path, - test_result.num_failed_tests > 0 - } - ); + const auto failed = test_result.num_failed_tests > 0 || test_status != 0; + results.push_back({ test_result.src_path, test_result.bin_path, failed }); - if (test_result.num_failed_tests > 0) + if (failed) counts.total_failed_suites++; else counts.total_passed_suites++;