pytest: show curl features and protocols

For the Test Clutch matrix.

https://testclutch.curl.se/static/reports/feature-matrix.html

Closes #15452
This commit is contained in:
Viktor Szakats 2024-10-30 00:24:45 +01:00
parent e4aa07b526
commit bc6212004a
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 14 additions and 0 deletions

View File

@ -38,6 +38,8 @@ def pytest_report_header(config):
env = Env() env = Env()
report = [ report = [
f'Testing curl {env.curl_version()}', f'Testing curl {env.curl_version()}',
f' curl: Features: {env.curl_features_string()}',
f' curl: Protocols: {env.curl_protocols_string()}',
f' httpd: {env.httpd_version()}, http:{env.http_port} https:{env.https_port}', f' httpd: {env.httpd_version()}, http:{env.http_port} https:{env.https_port}',
f' httpd-proxy: {env.httpd_version()}, http:{env.proxy_port} https:{env.proxys_port}' f' httpd-proxy: {env.httpd_version()}, http:{env.proxy_port} https:{env.proxys_port}'
] ]

View File

@ -71,7 +71,9 @@ class EnvConfig:
'version': '', 'version': '',
'os': '', 'os': '',
'fullname': '', 'fullname': '',
'features_string': '',
'features': [], 'features': [],
'protocols_string': '',
'protocols': [], 'protocols': [],
'libs': [], 'libs': [],
'lib_versions': [], 'lib_versions': [],
@ -98,10 +100,12 @@ class EnvConfig:
re.sub(r'/[a-z0-9.-]*', '', lib) for lib in self.curl_props['lib_versions'] re.sub(r'/[a-z0-9.-]*', '', lib) for lib in self.curl_props['lib_versions']
] ]
if line.startswith('Features: '): if line.startswith('Features: '):
self.curl_props['features_string'] = line[10:]
self.curl_props['features'] = [ self.curl_props['features'] = [
feat.lower() for feat in line[10:].split(' ') feat.lower() for feat in line[10:].split(' ')
] ]
if line.startswith('Protocols: '): if line.startswith('Protocols: '):
self.curl_props['protocols_string'] = line[11:]
self.curl_props['protocols'] = [ self.curl_props['protocols'] = [
prot.lower() for prot in line[11:].split(' ') prot.lower() for prot in line[11:].split(' ')
] ]
@ -323,10 +327,18 @@ class Env:
return not Env.curl_uses_lib('ngtcp2') and Env.curl_uses_lib('nghttp3') return not Env.curl_uses_lib('ngtcp2') and Env.curl_uses_lib('nghttp3')
return False return False
@staticmethod
def curl_features_string() -> str:
return Env.CONFIG.curl_props['features_string']
@staticmethod @staticmethod
def curl_has_feature(feature: str) -> bool: def curl_has_feature(feature: str) -> bool:
return feature.lower() in Env.CONFIG.curl_props['features'] return feature.lower() in Env.CONFIG.curl_props['features']
@staticmethod
def curl_protocols_string() -> str:
return Env.CONFIG.curl_props['protocols_string']
@staticmethod @staticmethod
def curl_has_protocol(protocol: str) -> bool: def curl_has_protocol(protocol: str) -> bool:
return protocol.lower() in Env.CONFIG.curl_props['protocols'] return protocol.lower() in Env.CONFIG.curl_props['protocols']