diff --git a/Base/home/anon/.config/Tests.ini b/Base/home/anon/.config/Tests.ini index 550a26eeba..6483b81641 100644 --- a/Base/home/anon/.config/Tests.ini +++ b/Base/home/anon/.config/Tests.ini @@ -1,7 +1,8 @@ [Global] -SkipDirectories=Kernel/Legacy UserEmulator +SkipDirectories=Kernel/Legacy +SkipRegex=^ue-.*$ SkipTests=test-web -NotTestsPattern=.txt|.frm|.inc +NotTestsPattern=^.*(txt|frm|inc)$ [test-js] Arguments=--show-progress=false diff --git a/Userland/Utilities/run-tests.cpp b/Userland/Utilities/run-tests.cpp index 3be5fd35dd..efc5b29111 100644 --- a/Userland/Utilities/run-tests.cpp +++ b/Userland/Utilities/run-tests.cpp @@ -32,10 +32,11 @@ String g_currently_running_test; class TestRunner : public ::Test::TestRunner { public: - TestRunner(String test_root, Regex exclude_regex, NonnullRefPtr config, bool print_progress, bool print_json, bool print_all_output, bool print_times = true) + TestRunner(String test_root, Regex exclude_regex, NonnullRefPtr config, Regex skip_regex, bool print_progress, bool print_json, bool print_all_output, bool print_times = true) : ::Test::TestRunner(move(test_root), print_times, print_progress, print_json) , m_exclude_regex(move(exclude_regex)) , m_config(move(config)) + , m_skip_regex(move(skip_regex)) , m_print_all_output(print_all_output) { m_skip_directories = m_config->read_entry("Global", "SkipDirectories", "").split(' '); @@ -56,6 +57,7 @@ protected: NonnullRefPtr m_config; Vector m_skip_directories; Vector m_skip_files; + Regex m_skip_regex; bool m_print_all_output { false }; }; @@ -83,6 +85,10 @@ bool TestRunner::should_skip_test(const LexicalPath& test_path) if (test_path.basename().contains(file)) return true; } + auto result = m_skip_regex.match(test_path.basename(), PosixFlags::Global); + if (result.success) + return true; + return false; } @@ -331,7 +337,16 @@ int main(int argc, char** argv) return 1; } - TestRunner test_runner(test_root, move(exclude_regex), move(config), print_progress, print_json, print_all_output); + // we need to preconfigure this, because we can't autoinitialize Regex types + // in the Testrunner + auto skip_regex_pattern = config->read_entry("Global", "SkipRegex", "$^"); + Regex skip_regex { skip_regex_pattern, {} }; + if (skip_regex.parser_result.error != Error::NoError) { + warnln("SkipRegex pattern \"{}\" is invalid", skip_regex_pattern); + return 1; + } + + TestRunner test_runner(test_root, move(exclude_regex), move(config), move(skip_regex), print_progress, print_json, print_all_output); test_runner.run(test_glob); return test_runner.counts().tests_failed;