From 0d3b3abf47028804d53d7130fc1490aac4efe226 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 30 Nov 2021 17:10:13 +0000 Subject: [PATCH] * test: check the h2load version for test suite making use of its --connect-to feature (available since 1.41.0). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895434 13f79535-47bb-0310-9956-ffa450edef68 --- test/modules/http2/test_700_load_get.py | 4 +++- test/pyhttpd/env.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/test/modules/http2/test_700_load_get.py b/test/modules/http2/test_700_load_get.py index 69430c33f6..77b85f2fc8 100644 --- a/test/modules/http2/test_700_load_get.py +++ b/test/modules/http2/test_700_load_get.py @@ -1,8 +1,10 @@ import pytest -from .env import H2Conf +from .env import H2Conf, H2TestEnv +@pytest.mark.skipif(not H2TestEnv().h2load_is_at_least('1.41.0'), + reason="h2load misses --connect-to option") class TestLoadGet: @pytest.fixture(autouse=True, scope='class') diff --git a/test/pyhttpd/env.py b/test/pyhttpd/env.py index be28e99790..97d2272097 100644 --- a/test/pyhttpd/env.py +++ b/test/pyhttpd/env.py @@ -182,7 +182,11 @@ class HttpdTestEnv: self._curl = self.config.get('global', 'curl_bin') self._nghttp = self.config.get('global', 'nghttp') + if self._nghttp is None: + self._nghttp = 'nghttp' self._h2load = self.config.get('global', 'h2load') + if self._h2load is None: + self._h2load = 'h2load' self._http_port = int(self.config.get('test', 'http_port')) self._https_port = int(self.config.get('test', 'https_port')) @@ -382,6 +386,19 @@ class HttpdTestEnv: def has_h2load(self): return self._h2load != "" + def h2load_is_at_least(self, minv): + if not self.has_h2load(): + return False + p = subprocess.run([self._h2load, '--version'], capture_output=True, text=True) + if p.returncode != 0: + return False + s = p.stdout.strip() + m = re.match(r'h2load nghttp2/(\S+)', s) + if m: + hv = self._versiontuple(m.group(1)) + return hv >= self._versiontuple(minv) + return False + def has_nghttp(self): return self._nghttp != ""