[Testing] Update ppc testing harness to run multiple test names

This commit is contained in:
Herman S.
2026-02-15 15:45:44 +09:00
parent a9075ecbb6
commit ece70899d1
+23 -5
View File
@@ -595,7 +595,7 @@ void ProtectedRunTest(TestSuite& test_suite, TestRunner& runner,
#endif // XE_COMPILER_MSVC
}
bool RunTests(const std::string_view test_name) {
bool RunTests(const std::vector<std::string>& test_names) {
int result_code = 1;
int failed_count = 0;
int passed_count = 0;
@@ -610,6 +610,10 @@ bool RunTests(const std::string_view test_name) {
XELOGI("Loaded skip list with {} test cases to skip.", skip_list.size());
}
// Build a set of requested test names for fast lookup
std::unordered_set<std::string> test_name_filter(test_names.begin(),
test_names.end());
auto test_path_root = cvars::test_path;
std::vector<std::filesystem::path> test_files;
if (!DiscoverTests(test_path_root, test_files)) {
@@ -626,7 +630,8 @@ bool RunTests(const std::string_view test_name) {
bool load_failed = false;
for (auto& test_path : test_files) {
TestSuite test_suite(test_path);
if (!test_name.empty() && test_suite.name() != test_name) {
if (!test_name_filter.empty() &&
test_name_filter.find(test_suite.name()) == test_name_filter.end()) {
continue;
}
if (!test_suite.Load()) {
@@ -724,12 +729,25 @@ bool RunTests(const std::string_view test_name) {
}
int main(const std::vector<std::string>& args) {
return RunTests(cvars::test_name) ? 0 : 1;
std::vector<std::string> test_names;
// Collect test names from all positional arguments.
// argv[0] is the program name, skip it. Also skip --flag arguments
// since those are handled by cvar parsing.
for (size_t i = 1; i < args.size(); ++i) {
if (!args[i].empty() && args[i][0] != '-') {
test_names.push_back(args[i]);
}
}
// Fall back to --test_name flag if no positional args given
if (test_names.empty() && !cvars::test_name.empty()) {
test_names.push_back(cvars::test_name);
}
return RunTests(test_names) ? 0 : 1;
}
} // namespace test
} // namespace cpu
} // namespace xe
XE_DEFINE_CONSOLE_APP("xenia-cpu-ppc-test", xe::cpu::test::main, "[test name]",
"test_name");
XE_DEFINE_CONSOLE_APP("xenia-cpu-ppc-test", xe::cpu::test::main,
"[test names...]", "test_name");