mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
headless-browser: Allow the -f argument to be used multiple times
A test path is now included if it matches any of the given globs.
This commit is contained in:
@@ -37,7 +37,7 @@ void Application::create_platform_arguments(Core::ArgsParser& args_parser)
|
||||
args_parser.add_option(test_concurrency, "Maximum number of tests to run at once", "test-concurrency", 'j', "jobs");
|
||||
args_parser.add_option(python_executable_path, "Path to python3", "python-executable", 'P', "path");
|
||||
args_parser.add_option(test_root_path, "Run tests in path", "run-tests", 'R', "test-root-path");
|
||||
args_parser.add_option(test_glob, "Only run tests matching the given glob", "filter", 'f', "glob");
|
||||
args_parser.add_option(test_globs, "Only run tests matching the given glob", "filter", 'f', "glob");
|
||||
args_parser.add_option(test_dry_run, "List the tests that would be run, without running them", "dry-run");
|
||||
args_parser.add_option(dump_failed_ref_tests, "Dump screenshots of failing ref tests", "dump-failed-ref-tests", 'D');
|
||||
args_parser.add_option(dump_gc_graph, "Dump GC graph", "dump-gc-graph", 'G');
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
size_t test_concurrency { 1 };
|
||||
ByteString python_executable_path;
|
||||
ByteString test_root_path;
|
||||
ByteString test_glob;
|
||||
Vector<ByteString> test_globs;
|
||||
bool test_dry_run { false };
|
||||
bool rebaseline { false };
|
||||
u8 verbosity { 0 };
|
||||
|
||||
@@ -469,7 +469,11 @@ ErrorOr<void> run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize
|
||||
TRY(load_test_config(app.test_root_path));
|
||||
|
||||
Vector<Test> tests;
|
||||
auto test_glob = ByteString::formatted("*{}*", app.test_glob);
|
||||
|
||||
for (auto& glob : app.test_globs)
|
||||
glob = ByteString::formatted("*{}*", glob);
|
||||
if (app.test_globs.is_empty())
|
||||
app.test_globs.append("*"sv);
|
||||
|
||||
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));
|
||||
@@ -486,7 +490,7 @@ ErrorOr<void> run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize
|
||||
"*/wpt-import/common/*"sv,
|
||||
};
|
||||
bool is_support_file = any_of(support_file_patterns, [&](auto pattern) { return test.input_path.matches(pattern); });
|
||||
bool match_glob = test.input_path.matches(test_glob, CaseSensitivity::CaseSensitive);
|
||||
bool match_glob = any_of(app.test_globs, [&](auto const& glob) { return test.relative_path.matches(glob, CaseSensitivity::CaseSensitive); });
|
||||
return is_support_file || !match_glob;
|
||||
});
|
||||
|
||||
@@ -500,7 +504,7 @@ ErrorOr<void> run_tests(Core::AnonymousBuffer const& theme, Web::DevicePixelSize
|
||||
}
|
||||
|
||||
if (tests.is_empty()) {
|
||||
if (app.test_glob.is_empty())
|
||||
if (app.test_globs.is_empty())
|
||||
return Error::from_string_literal("No tests found");
|
||||
return Error::from_string_literal("No tests found matching filter");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user