diff mbox series

gcc-testsuite: define the SSH control path in one place

Message ID 20261202083713.2946536-1-Harish.Sadineni@windriver.com
State Under Review
Headers show
Series gcc-testsuite: define the SSH control path in one place | expand

Commit Message

Sadineni, Harish Dec. 2, 2026, 8:37 a.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

The SSH ControlPath used for connection multiplexing was computed
separately in gcc-testsuite.inc and in the gcc selftest. Both copies
had to hash the same build directory to produce the same socket path,
and any mismatch would leave the master connection unclosed.

Define the path once in the recipe as TOOLCHAIN_TEST_SSH_CONTROLPATH
and have the selftest read that variable instead of recomputing it.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/lib/oeqa/selftest/cases/gcc.py         | 3 +--
 meta/recipes-devtools/gcc/gcc-testsuite.inc | 6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/gcc.py b/meta/lib/oeqa/selftest/cases/gcc.py
index efae5bedf4..d651db5272 100644
--- a/meta/lib/oeqa/selftest/cases/gcc.py
+++ b/meta/lib/oeqa/selftest/cases/gcc.py
@@ -3,7 +3,6 @@ 
 #
 # SPDX-License-Identifier: MIT
 #
-import hashlib
 import subprocess
 import os
 import time
@@ -96,7 +95,7 @@  class GccSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
 
             # With ControlPersist=yes, never times out on its own, so close it
             # explicitly once all test shards have finished.
-            controlpath = "/tmp/oe-gcc-ssh-" + hashlib.sha1(get_bb_var("B", "gcc-runtime").encode()).hexdigest()[:12]
+            controlpath = get_bb_var("TOOLCHAIN_TEST_SSH_CONTROLPATH", "gcc-runtime")
             try:
                 return self.run_check(*args, ssh=qemu.ip, **kwargs)
             finally:
diff --git a/meta/recipes-devtools/gcc/gcc-testsuite.inc b/meta/recipes-devtools/gcc/gcc-testsuite.inc
index db08a01f3d..19dffb9ea5 100644
--- a/meta/recipes-devtools/gcc/gcc-testsuite.inc
+++ b/meta/recipes-devtools/gcc/gcc-testsuite.inc
@@ -5,6 +5,8 @@  TOOLCHAIN_TEST_HOST ??= "localhost"
 TOOLCHAIN_TEST_HOST_USER ??= "root"
 TOOLCHAIN_TEST_HOST_PORT ??= "2222"
 
+TOOLCHAIN_TEST_SSH_CONTROLPATH ??= "/tmp/oe-gcc-ssh-${@__import__('hashlib').sha1(d.getVar('B').encode()).hexdigest()[:12]}"
+
 MAKE_CHECK_BOARDFLAGS ??= ""
 MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}"
 
@@ -80,7 +82,7 @@  python check_prepare() {
         return "\n".join(content)
 
     def generate_remote_ssh_linux_config(d):
-        import hashlib, os
+        import os
         content = []
         content.append('load_generic_config "unix"')
         content.append('process_multilib_options ""')
@@ -92,7 +94,7 @@  python check_prepare() {
         # Use SSH multiplexing to share one master connection across GCC tests.
         # Keep the master alive until the selftest explicitly closes it.
         # Use a per-build ControlPath to avoid conflicts between builds.
-        controlpath = "/tmp/oe-gcc-ssh-" + hashlib.sha1(d.getVar("B").encode()).hexdigest()[:12]
+        controlpath = d.getVar("TOOLCHAIN_TEST_SSH_CONTROLPATH")
         # remove stale socket left by a previous stopped run of this build
         if os.path.exists(controlpath):
             os.remove(controlpath)