From 67f435975b1541a3cad9df20fede44dc52f9a899 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Mon, 10 Feb 2025 17:11:26 +1300 Subject: [PATCH] headless-browser: Fix crash test globbing Tests have the glob run against the relative path of the test file. Since this was never set for crash tests the '-f' argument to headless browser would never match the global against any crash test. --- UI/Headless/Test.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UI/Headless/Test.cpp b/UI/Headless/Test.cpp index 48b3f8bfc30..50ce346d5d0 100644 --- a/UI/Headless/Test.cpp +++ b/UI/Headless/Test.cpp @@ -106,7 +106,7 @@ static ErrorOr collect_ref_tests(Application const& app, Vector& tes return {}; } -static ErrorOr collect_crash_tests(Vector& tests, StringView path, StringView trail) +static ErrorOr collect_crash_tests(Application const& app, Vector& tests, StringView path, StringView trail) { Core::DirIterator it(ByteString::formatted("{}/{}", path, trail), Core::DirIterator::Flags::SkipDots); while (it.has_next()) { @@ -114,14 +114,14 @@ static ErrorOr collect_crash_tests(Vector& tests, StringView path, S auto input_path = TRY(FileSystem::real_path(ByteString::formatted("{}/{}/{}", path, trail, name))); if (FileSystem::is_directory(input_path)) { - TRY(collect_crash_tests(tests, path, ByteString::formatted("{}/{}", trail, name))); + TRY(collect_crash_tests(app, tests, path, ByteString::formatted("{}/{}", trail, name))); continue; } - if (!is_valid_test_name(name)) continue; - tests.append({ TestMode::Crash, input_path, {}, {} }); + auto relative_path = LexicalPath::relative_path(input_path, app.test_root_path).release_value(); + tests.append({ TestMode::Crash, input_path, {}, move(relative_path) }); } return {}; @@ -478,7 +478,7 @@ ErrorOr run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize TRY(collect_dump_tests(app, tests, ByteString::formatted("{}/Layout", app.test_root_path), "."sv, TestMode::Layout)); TRY(collect_dump_tests(app, tests, ByteString::formatted("{}/Text", app.test_root_path), "."sv, TestMode::Text)); TRY(collect_ref_tests(app, tests, ByteString::formatted("{}/Ref", app.test_root_path), "."sv)); - TRY(collect_crash_tests(tests, ByteString::formatted("{}/Crash", app.test_root_path), "."sv)); + TRY(collect_crash_tests(app, tests, ByteString::formatted("{}/Crash", app.test_root_path), "."sv)); #if !defined(AK_OS_MACOS) TRY(collect_ref_tests(app, tests, ByteString::formatted("{}/Screenshot", app.test_root_path), "."sv)); #endif