From 25c067872c23e3c3fe5ecedd91963fce748a7bf2 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 13 Nov 2024 16:14:30 -0500 Subject: [PATCH] headless-browser: Ensure crashing tests cause LibWeb tests to fail --- UI/Headless/Test.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UI/Headless/Test.cpp b/UI/Headless/Test.cpp index 67c46ce467b..84e78531499 100644 --- a/UI/Headless/Test.cpp +++ b/UI/Headless/Test.cpp @@ -437,6 +437,7 @@ ErrorOr run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize size_t timeout_count = 0; size_t crashed_count = 0; size_t skipped_count = 0; + bool all_tests_ok = true; bool is_tty = isatty(STDOUT_FILENO); outln("Running {} tests...", tests.size()); @@ -486,12 +487,15 @@ ErrorOr run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize ++pass_count; break; case TestResult::Fail: + all_tests_ok = false; ++fail_count; break; case TestResult::Timeout: + all_tests_ok = false; ++timeout_count; break; case TestResult::Crashed: + all_tests_ok = false; ++crashed_count; break; case TestResult::Skipped: @@ -558,7 +562,7 @@ ErrorOr run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize app.destroy_web_views(); - if (timeout_count == 0 && fail_count == 0) + if (all_tests_ok) return {}; return Error::from_string_literal("Failed LibWeb tests");