diff --git a/pcsx2-gsrunner/Main.cpp b/pcsx2-gsrunner/Main.cpp index 88d67bc806..3c91473460 100644 --- a/pcsx2-gsrunner/Main.cpp +++ b/pcsx2-gsrunner/Main.cpp @@ -60,7 +60,9 @@ namespace GSRunner { + static void InitializeConsole(); static bool InitializeConfig(); + static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& params); static bool CreatePlatformWindow(); static void DestroyPlatformWindow(); @@ -77,6 +79,7 @@ alignas(16) static SysMtgsThread s_mtgs_thread; static std::string s_output_prefix; static s32 s_loop_count = 1; static std::optional s_use_window; +static bool s_no_console = false; // Owned by the GS thread. static u32 s_dump_frame_number = 0; @@ -112,7 +115,7 @@ bool GSRunner::InitializeConfig() si.SetBoolValue("EmuCore", "EnablePerGameSettings", false); // force logging - si.SetBoolValue("Logging", "EnableSystemConsole", true); + si.SetBoolValue("Logging", "EnableSystemConsole", !s_no_console); si.SetBoolValue("Logging", "EnableTimestamps", true); si.SetBoolValue("Logging", "EnableVerbose", true); @@ -453,7 +456,15 @@ static void PrintCommandLineHelp(const char* progname) std::fprintf(stderr, "\n"); } -static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& params) +void GSRunner::InitializeConsole() +{ + const char* var = std::getenv("PCSX2_NOCONSOLE"); + s_no_console = (var && StringUtil::FromChars(var).value_or(false)); + if (!s_no_console) + CommonHost::InitializeEarlyConsole(); +} + +bool GSRunner::ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& params) { bool no_more_args = false; for (int i = 1; i < argc; i++) @@ -650,7 +661,7 @@ static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& param int main(int argc, char* argv[]) { - CommonHost::InitializeEarlyConsole(); + GSRunner::InitializeConsole(); if (!GSRunner::InitializeConfig()) { @@ -659,7 +670,7 @@ int main(int argc, char* argv[]) } VMBootParameters params; - if (!ParseCommandLineArgs(argc, argv, params)) + if (!GSRunner::ParseCommandLineArgs(argc, argv, params)) return EXIT_FAILURE; PerformanceMetrics::SetCPUThread(Threading::ThreadHandle::GetForCallingThread()); diff --git a/pcsx2-gsrunner/test_run_dumps.py b/pcsx2-gsrunner/test_run_dumps.py index 8a5864f0da..29b5d0da22 100644 --- a/pcsx2-gsrunner/test_run_dumps.py +++ b/pcsx2-gsrunner/test_run_dumps.py @@ -46,11 +46,15 @@ def run_regression_test(runner, dumpdir, renderer, upscale, renderhacks, paralle if parallel > 1: args.append("-noshadercache") + # disable output console entirely + environ = os.environ.copy() + environ["PCSX2_NOCONSOLE"] = "1" + args.append("--") args.append(gspath) - print("Running '%s'" % (" ".join(args))) - subprocess.run(args) + #print("Running '%s'" % (" ".join(args))) + subprocess.run(args, env=environ, stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) def run_regression_tests(runner, gsdir, dumpdir, renderer, upscale, renderhacks, parallel=1): @@ -69,7 +73,10 @@ def run_regression_tests(runner, gsdir, dumpdir, renderer, upscale, renderhacks, print("Processing %u games on %u processors" % (len(gamepaths), parallel)) func = partial(run_regression_test, runner, dumpdir, renderer, upscale, renderhacks, parallel) pool = multiprocessing.Pool(parallel) - pool.map(func, gamepaths) + completed = 0 + for _ in pool.imap_unordered(func, gamepaths, chunksize=1): + completed += 1 + print("Processed %u of %u GS dumps (%u%%)" % (completed, len(gamepaths), (completed * 100) // len(gamepaths))) pool.close()