]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* test: check the h2load version for test suite making use
authorStefan Eissing <icing@apache.org>
Tue, 30 Nov 2021 17:10:13 +0000 (17:10 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 30 Nov 2021 17:10:13 +0000 (17:10 +0000)
   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
test/pyhttpd/env.py

index 69430c33f697bbca445acac5cb16c5822ec1bdd6..77b85f2fc81456863de39fed7815ed6aac428312 100644 (file)
@@ -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')
index be28e9979054ae1eddb1791005e3d228bcbe3570..97d2272097934814f17741195c5797e9407b54eb 100644 (file)
@@ -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 != ""