1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibTest+Utilities: Print a start message before each test in run-tests

It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
This commit is contained in:
Andrew Kaster 2021-08-18 19:16:23 -06:00 committed by Andreas Kling
parent 6666230d3e
commit 332b29c741
Notes: sideshowbarker 2024-07-18 05:29:01 +09:00
3 changed files with 11 additions and 9 deletions

View file

@ -46,7 +46,7 @@ public:
virtual ~TestRunner() = default;
protected:
virtual void do_run_single_test(const String& test_path) override;
virtual void do_run_single_test(const String& test_path, size_t current_text_index, size_t num_tests) override;
virtual Vector<String> get_test_paths() const override;
virtual const Vector<String>* get_failed_test_names() const override { return &m_failed_test_names; }
@ -94,10 +94,12 @@ bool TestRunner::should_skip_test(const LexicalPath& test_path)
return false;
}
void TestRunner::do_run_single_test(const String& test_path)
void TestRunner::do_run_single_test(const String& test_path, size_t current_test_index, size_t num_tests)
{
g_currently_running_test = test_path;
auto test_relative_path = LexicalPath::relative_path(test_path, m_test_root);
outln(" START {} ({}/{})", test_relative_path, current_test_index, num_tests);
fflush(stdout); // we really want to see the start text in case the test hangs
auto test_result = run_test_file(test_path);
switch (test_result.result) {
@ -128,11 +130,11 @@ void TestRunner::do_run_single_test(const String& test_path)
print_modifiers({ Test::CLEAR });
} else {
print_modifiers({ Test::BG_GREEN, Test::FG_BLACK, Test::FG_BOLD });
out(" PASS ");
out(" PASS ");
print_modifiers({ Test::CLEAR });
}
out(" {}", LexicalPath::relative_path(test_path, m_test_root));
out(" {}", test_relative_path);
print_modifiers({ Test::CLEAR, Test::ITALIC, Test::FG_GRAY });
if (test_result.time_taken < 1000) {