From 442981086b92fd6850651ae245e99c6e416f12a2 Mon Sep 17 00:00:00 2001 From: Paul Lodge Date: Tue, 29 Sep 2026 17:46:16 +0200 Subject: [PATCH] H2ws creation refector: moved function to build binary, so that it's built only if websockets tests are run --- test/modules/http2/test_800_websockets.py | 11 +++++++++++ test/pyhttpd/env.py | 15 --------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/test/modules/http2/test_800_websockets.py b/test/modules/http2/test_800_websockets.py index 5c49ded6565..c6532e1ffaa 100644 --- a/test/modules/http2/test_800_websockets.py +++ b/test/modules/http2/test_800_websockets.py @@ -90,8 +90,19 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None, reason=f'websockets is {ws_version}, need at least {ws_version_min}') class TestWebSockets: + def _build_clients(self, env): + clients_dir = os.path.join(os.path.dirname(env.clients_dir), 'clients') + p = subprocess.run(['make'], capture_output=True, cwd=clients_dir) + rv = p.returncode + if rv != 0: + log.error(f"compiling test clients failed: {p.stderr}") + raise Exception(f"compiling test clients failed: {p.stderr}") + @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): + # create the H2ws binary needed in some of the tests + self._build_clients(env) + # Apache config that CONNECT proxies a WebSocket server for paths starting # with '/ws/' # The WebSocket server is started in pytest fixture 'ws_server' below. diff --git a/test/pyhttpd/env.py b/test/pyhttpd/env.py index 521c16124d7..2cd4d8400bb 100644 --- a/test/pyhttpd/env.py +++ b/test/pyhttpd/env.py @@ -110,7 +110,6 @@ def make(self): self._make_htdocs() self._add_aptest() - self._build_clients() self.env.clear_curl_headerfiles() def _make_dirs(self): @@ -256,20 +255,6 @@ def _add_aptest(self): with open(modules_conf, 'a') as fd: # load our test module fd.write(f"LoadModule aptest_module \"{module_dir}/mod_aptest.so\"\n") - - def _build_clients(self): - if self.env.test_modules_dir: - return - clients_dir = os.path.join( - os.path.dirname(os.path.dirname(inspect.getfile(HttpdTestSetup))), - 'clients') - p = subprocess.run(['make'], capture_output=True, cwd=clients_dir) - rv = p.returncode - if rv != 0: - log.error(f"compiling test clients failed: {p.stderr}") - raise Exception(f"compiling test clients failed: {p.stderr}") - - class HttpdTestEnv: LIBEXEC_DIR = None