From c273a148ab80fdd5fd4381a54c120f77639de43c Mon Sep 17 00:00:00 2001 From: dayfine Date: Wed, 11 Nov 2026 22:16:41 -0800 Subject: [PATCH] Command-line test mode: return before console settings and devices Tests need no console, serial port or camera. Loading the console settings and polling serial ports and cameras before the test-mode check let a test run touch devices another running instance holds. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- SerialPrograms/Source/CommonFramework/Main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SerialPrograms/Source/CommonFramework/Main.cpp b/SerialPrograms/Source/CommonFramework/Main.cpp index ef6742e2eb..7040c78e0d 100644 --- a/SerialPrograms/Source/CommonFramework/Main.cpp +++ b/SerialPrograms/Source/CommonFramework/Main.cpp @@ -208,13 +208,6 @@ int run_program(int argc, char *argv[]){ logger.log(error.message(), COLOR_RED); } - // Load the Switch framework settings now, not only when their panel is opened. - OptionsPanelWrapper().make_panel()->load_json_from_global(); - - // Preload a bunch of stuff now so they are ready later. - SerialPortPoller::instance().ports(); - get_all_cameras(); - // Force all the Qt thread pools to be constructed now on the main thread. GlobalThreadPools::qt_worker_threadpool(); GlobalThreadPools::qt_event_threadpool(); @@ -246,10 +239,19 @@ int run_program(int argc, char *argv[]){ return 1; } + // Tests need no console, serial port or camera. Return before touching + // them, so tests can run while another instance holds the devices. if (GlobalSettings::instance().COMMAND_LINE_TEST_MODE){ return run_command_line_tests(augment_test_color_distortions, test_substring); } + // Load the Switch framework settings now, not only when their panel is opened. + OptionsPanelWrapper().make_panel()->load_json_from_global(); + + // Preload a bunch of stuff now so they are ready later. + SerialPortPoller::instance().ports(); + get_all_cameras(); + // Check whether the hardware is powerful enough to run this program. if (!check_hardware()){ return 1;