From 168ea88cb2bccd711047d877f141d7648e99ec11 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Sun, 27 Jul 2025 22:52:12 +0100 Subject: [PATCH] test-web: Add an option to randomize the test order --- Tests/LibWeb/test-web/Application.cpp | 1 + Tests/LibWeb/test-web/Application.h | 1 + Tests/LibWeb/test-web/main.cpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/Tests/LibWeb/test-web/Application.cpp b/Tests/LibWeb/test-web/Application.cpp index d0eb65218a2..fb7433f7538 100644 --- a/Tests/LibWeb/test-web/Application.cpp +++ b/Tests/LibWeb/test-web/Application.cpp @@ -38,6 +38,7 @@ void Application::create_platform_arguments(Core::ArgsParser& args_parser) args_parser.add_option(dump_gc_graph, "Dump GC graph", "dump-gc-graph", 'G'); args_parser.add_option(test_dry_run, "List the tests that would be run, without running them", "dry-run"); args_parser.add_option(rebaseline, "Rebaseline any executed layout or text tests", "rebaseline"); + args_parser.add_option(shuffle, "Shuffle the order of tests before running them", "shuffle", 's'); args_parser.add_option(per_test_timeout_in_seconds, "Per-test timeout (default: 30)", "per-test-timeout", 't', "seconds"); args_parser.add_option(Core::ArgsParser::Option { diff --git a/Tests/LibWeb/test-web/Application.h b/Tests/LibWeb/test-web/Application.h index 971134bb6c6..71ae698a457 100644 --- a/Tests/LibWeb/test-web/Application.h +++ b/Tests/LibWeb/test-web/Application.h @@ -40,6 +40,7 @@ public: bool test_dry_run { false }; bool rebaseline { false }; + bool shuffle { false }; int per_test_timeout_in_seconds { 30 }; diff --git a/Tests/LibWeb/test-web/main.cpp b/Tests/LibWeb/test-web/main.cpp index 03ab90391ca..d60b2844fb6 100644 --- a/Tests/LibWeb/test-web/main.cpp +++ b/Tests/LibWeb/test-web/main.cpp @@ -612,6 +612,9 @@ static ErrorOr run_tests(Core::AnonymousBuffer const& theme, Web::DevicePix return is_support_file || !match_glob; }); + if (app.shuffle) + shuffle(tests); + if (app.test_dry_run) { outln("Found {} tests...", tests.size());