[Testing] Minor PPC testing updates

- add SIGTRAP handling
- remove per-test dots and print per suite instead
- refactor test loop from collecting all tests to iterating suites
- fix logging up output
This commit is contained in:
Herman S.
2026-03-15 22:16:12 +09:00
parent 56ac1c3f4b
commit 2a9b8de84b

View File

@@ -549,6 +549,9 @@ TestResult RunTestInChildProcess(TestSuite& test_suite, TestCase& test_case) {
case SIGABRT: case SIGABRT:
signal_name = "SIGABRT"; signal_name = "SIGABRT";
break; break;
case SIGTRAP:
signal_name = "SIGTRAP";
break;
} }
fprintf(stderr, " [%s] CRASHED (%s)\n", test_case.name.c_str(), fprintf(stderr, " [%s] CRASHED (%s)\n", test_case.name.c_str(),
signal_name); signal_name);
@@ -575,9 +578,6 @@ void ProtectedRunTest(TestSuite& test_suite, TestRunner& runner,
} }
if (runner.Run(test_case)) { if (runner.Run(test_case)) {
++passed_count; ++passed_count;
// Print progress dot
fprintf(stdout, ".");
fflush(stdout);
} else { } else {
fprintf(stderr, " [%s] FAILED\n", test_case.name.c_str()); fprintf(stderr, " [%s] FAILED\n", test_case.name.c_str());
fflush(stderr); fflush(stderr);
@@ -615,7 +615,11 @@ bool RunTests(const std::vector<std::string>& test_names) {
// Load skip list // Load skip list
auto skip_list = LoadSkipList(cvars::test_skip_file); auto skip_list = LoadSkipList(cvars::test_skip_file);
if (!skip_list.empty()) { if (!skip_list.empty()) {
XELOGI("Loaded skip list with {} test cases to skip.", skip_list.size()); fprintf(stderr, "Loaded skip list with %zu test cases to skip.\n",
skip_list.size());
} else {
fprintf(stderr, "Warning: skip list is empty (path: %s)\n",
cvars::test_skip_file.string().c_str());
} }
// Build a set of requested test names for fast lookup // Build a set of requested test names for fast lookup
@@ -655,22 +659,25 @@ bool RunTests(const std::vector<std::string>& test_names) {
XELOGI("{} tests loaded.", test_suites.size()); XELOGI("{} tests loaded.", test_suites.size());
// Collect all test cases across all suites, filtering out skipped tests // Count test cases across all suites, filtering out skipped tests
std::vector<std::pair<TestSuite*, TestCase*>> all_tests;
int skipped_count = 0; int skipped_count = 0;
size_t total_cases = 0;
for (auto& test_suite : test_suites) { for (auto& test_suite : test_suites) {
for (auto& test_case : test_suite.test_cases()) { for (auto& test_case : test_suite.test_cases()) {
if (skip_list.find(test_case.name) != skip_list.end()) { if (skip_list.find(test_case.name) != skip_list.end()) {
++skipped_count; ++skipped_count;
continue; // Skip this test } else {
++total_cases;
} }
all_tests.push_back({&test_suite, &test_case});
} }
} }
if (skipped_count > 0) { if (skipped_count > 0) {
XELOGI("{} test cases skipped based on skip list.", skipped_count); fprintf(stderr, "Skipped %d test cases based on skip list.\n",
skipped_count);
} }
fprintf(stderr, "Running %zu test suites, %zu test cases...\n",
test_suites.size(), total_cases);
#if XE_COMPILER_MSVC #if XE_COMPILER_MSVC
// On Windows, use a single shared test runner // On Windows, use a single shared test runner
@@ -681,11 +688,26 @@ bool RunTests(const std::vector<std::string>& test_names) {
TestRunner* runner_ptr = nullptr; TestRunner* runner_ptr = nullptr;
TestRunner& runner = *runner_ptr; // Never dereferenced on POSIX TestRunner& runner = *runner_ptr; // Never dereferenced on POSIX
#endif #endif
for (auto& [suite, tcase] : all_tests) {
ProtectedRunTest(*suite, runner, *tcase, failed_count, passed_count); // Run tests grouped by suite, printing a dot after each suite completes
for (auto& test_suite : test_suites) {
bool suite_has_tests = false;
for (auto& test_case : test_suite.test_cases()) {
if (skip_list.find(test_case.name) != skip_list.end()) {
continue;
}
suite_has_tests = true;
ProtectedRunTest(test_suite, runner, test_case, failed_count,
passed_count);
}
if (suite_has_tests) {
fprintf(stdout, ".");
fflush(stdout);
}
} }
fprintf(stderr, "\n"); fprintf(stdout, "\n");
fflush(stdout);
fprintf(stderr, "Total tests: %d\n", failed_count + passed_count); fprintf(stderr, "Total tests: %d\n", failed_count + passed_count);
fprintf(stderr, "Passed: %d\n", passed_count); fprintf(stderr, "Passed: %d\n", passed_count);
fprintf(stderr, "Failed: %d\n", failed_count); fprintf(stderr, "Failed: %d\n", failed_count);