From a89989c11c3d227bea91e4c778208da61f1d2c56 Mon Sep 17 00:00:00 2001 From: italopaesano Date: Tue, 17 Nov 2026 14:04:59 +0100 Subject: [PATCH] test: load the harness defaults and the test options in one call test_config_backend_t::init() called load_configuration_options_from_string() twice: once for the defaults every test needs, once for the options of the individual test. The second call undoes part of the first one, because the function treats each string as the complete configuration -- it is the same path which reloads wayfire.ini -- and therefore ends by resetting every registered option which is absent from the string it was given. So every test which passes options of its own silently lost the defaults. The one that shows is xwayland = false, whose default is true: the resize, touch, keyboard-config, pointer-scroll-speed and native-buffer-size-scaling tests spawned 15 Xwayland servers between them, nine in the resize test alone, none of which they use. While probing for a free display those log "Failed to bind socket @/tmp/.X11-unix/X0: Address already in use" and compete for display numbers with each other and with the session running the suite. core/plugins fell back to the default list of 26 plugins, and autostart_wf_shell to true; those are harmless today only because the tests which do start plugins also set plugins themselves. None of this shows on CI, where wlroots is built without xwayland support, so core/xwayland has no effect and the two tests which use Xwayland are not built at all. Load the defaults and the options of the test in a single call, defaults first so that the test still takes precedence. The options of a test have to open their own section, which every test already does. Those five tests now spawn no Xwayland server, and the two tests which do use Xwayland still spawn exactly one each. Co-Authored-By: Claude --- test/support/headless-core-harness.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/support/headless-core-harness.cpp b/test/support/headless-core-harness.cpp index cd764bc83..689ca8b4d 100644 --- a/test/support/headless-core-harness.cpp +++ b/test/support/headless-core-harness.cpp @@ -52,7 +52,14 @@ class test_config_backend_t : public wf::config_backend_t config = wf::config::build_configuration(get_xml_dirs(), "/dev/null", "/dev/null"); - wf::config::load_configuration_options_from_string(config, + /* load_configuration_options_from_string() resets every registered + * option which is absent from the string it is given, so the defaults + * below and the options of the test have to be loaded in a single call: + * a second call would undo the defaults. The options of the test are + * appended, so they still take precedence, but they have to open their + * own section, and line numbers in parse errors refer to the result of + * the concatenation. */ + const std::string default_config = "[core]\n" "background_color = 0.0 0.0 0.0 1.0\n" "plugins = \n" @@ -64,14 +71,10 @@ class test_config_backend_t : public wf::config_backend_t "[workarounds]\n" "auto_reload_config = false\n" "enable_input_method_v2 = false\n" - "use_external_output_configuration = false\n", - "default-test-config"); + "use_external_output_configuration = false\n"; - if (!extra_config.empty()) - { - wf::config::load_configuration_options_from_string(config, - extra_config, "headless-core-harness-extra-config"); - } + wf::config::load_configuration_options_from_string(config, + default_config + extra_config, "harness defaults + test options"); } };