From 7f189f21fe8615d74aa7d347ba4b38767bf4c7a5 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Fri, 13 Feb 2026 11:33:48 +0900 Subject: [PATCH] [Testing] Update ppc testing harness to run multiple test names --- src/xenia/cpu/ppc/testing/ppc_testing_main.cc | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/xenia/cpu/ppc/testing/ppc_testing_main.cc b/src/xenia/cpu/ppc/testing/ppc_testing_main.cc index 29e9b26d9..e293fd8ff 100644 --- a/src/xenia/cpu/ppc/testing/ppc_testing_main.cc +++ b/src/xenia/cpu/ppc/testing/ppc_testing_main.cc @@ -603,7 +603,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& test_names) { int result_code = 1; int failed_count = 0; int passed_count = 0; @@ -618,6 +618,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 test_name_filter(test_names.begin(), + test_names.end()); + auto test_path_root = cvars::test_path; std::vector test_files; if (!DiscoverTests(test_path_root, test_files)) { @@ -634,7 +638,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()) { @@ -690,12 +695,25 @@ bool RunTests(const std::string_view test_name) { } int main(const std::vector& args) { - return RunTests(cvars::test_name) ? 0 : 1; + std::vector 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");