mirror of
https://github.com/apache/httpd.git
synced 2025-08-16 16:17:23 +00:00
* 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
This commit is contained in:
@ -1,8 +1,10 @@
|
|||||||
import pytest
|
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:
|
class TestLoadGet:
|
||||||
|
|
||||||
@pytest.fixture(autouse=True, scope='class')
|
@pytest.fixture(autouse=True, scope='class')
|
||||||
|
@ -182,7 +182,11 @@ class HttpdTestEnv:
|
|||||||
|
|
||||||
self._curl = self.config.get('global', 'curl_bin')
|
self._curl = self.config.get('global', 'curl_bin')
|
||||||
self._nghttp = self.config.get('global', 'nghttp')
|
self._nghttp = self.config.get('global', 'nghttp')
|
||||||
|
if self._nghttp is None:
|
||||||
|
self._nghttp = 'nghttp'
|
||||||
self._h2load = self.config.get('global', 'h2load')
|
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._http_port = int(self.config.get('test', 'http_port'))
|
||||||
self._https_port = int(self.config.get('test', 'https_port'))
|
self._https_port = int(self.config.get('test', 'https_port'))
|
||||||
@ -382,6 +386,19 @@ class HttpdTestEnv:
|
|||||||
def has_h2load(self):
|
def has_h2load(self):
|
||||||
return self._h2load != ""
|
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):
|
def has_nghttp(self):
|
||||||
return self._nghttp != ""
|
return self._nghttp != ""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user