Include Catch2 test run in timing and logging

This commit is contained in:
Josiah VanderZee 2024-05-16 12:37:29 -05:00
parent c2bd2507b8
commit a9d52ca126
1 changed files with 12 additions and 4 deletions

View File

@ -236,6 +236,17 @@ bool run_tests()
num_total_tests_run += testmod->num_tests_run;
}
rawstream << "Catch test results: " << std::endl;
// Catch prints out the results of this invocation.
auto num_catch_tests_failed = Catch::Session().run();
// We count the all the Catch tests as one test for Minetest's own logging
// because we don't have a way to tell how many individual tests Catch ran.
num_total_tests_run = 1;
if (num_catch_tests_failed > 0) {
++num_modules_failed;
++num_total_tests_failed;
}
u64 tdiff = porting::getTimeMs() - t1;
g_logger.setLevelSilenced(LL_ERROR, false);
@ -251,10 +262,7 @@ bool run_tests()
<< num_total_tests_run << " failed individual tests)." << std::endl
<< " Testing took " << tdiff << "ms total." << std::endl
<< "++++++++++++++++++++++++++++++++++++++++"
<< "++++++++++++++++++++++++++++++++++++++++" << std::endl
<< "Catch test results: " << std::endl;
auto catch_test_failures = Catch::Session().run();
num_modules_failed += catch_test_failures;
<< "++++++++++++++++++++++++++++++++++++++++" << std::endl;
return num_modules_failed == 0;
}