mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibTest/Utilities: Add method for TestRunner to print failed test names
If a test run has a lot of tests in it, and they fill up the terminal buffer, it can be difficult to find out exactly which tests have failed from your large test run. Make TestRunner print out an optional Vector of failed test names at the end of the run, and have run-tests add each failed or crashed test to a Vector it uses for this purpose.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
64aac345d3
commit
ff8429a749
@@ -48,6 +48,7 @@ public:
|
||||
protected:
|
||||
virtual void do_run_single_test(const String& test_path) override;
|
||||
virtual Vector<String> get_test_paths() const override;
|
||||
virtual const Vector<String>* get_failed_test_names() const override { return &m_failed_test_names; }
|
||||
|
||||
virtual FileResult run_test_file(const String& test_path);
|
||||
|
||||
@@ -57,6 +58,7 @@ protected:
|
||||
NonnullRefPtr<Core::ConfigFile> m_config;
|
||||
Vector<String> m_skip_directories;
|
||||
Vector<String> m_skip_files;
|
||||
Vector<String> m_failed_test_names;
|
||||
Regex<PosixExtended> m_skip_regex;
|
||||
bool m_print_all_output { false };
|
||||
};
|
||||
@@ -120,6 +122,7 @@ void TestRunner::do_run_single_test(const String& test_path)
|
||||
bool crashed_or_failed = test_result.result == Test::Result::Fail || test_result.result == Test::Result::Crashed;
|
||||
bool print_stdout_stderr = crashed_or_failed || m_print_all_output;
|
||||
if (crashed_or_failed) {
|
||||
m_failed_test_names.append(test_path);
|
||||
print_modifiers({ Test::BG_RED, Test::FG_BLACK, Test::FG_BOLD });
|
||||
out("{}", test_result.result == Test::Result::Fail ? " FAIL " : "CRASHED");
|
||||
print_modifiers({ Test::CLEAR });
|
||||
|
||||
Reference in New Issue
Block a user