]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pytest: show curl features and protocols
authorViktor Szakats <commit@vsz.me>
Tue, 29 Oct 2024 23:24:45 +0000 (00:24 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 30 Oct 2024 08:32:29 +0000 (09:32 +0100)
For the Test Clutch matrix.

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

Closes #15452

tests/http/conftest.py
tests/http/testenv/env.py

index 563a8c92d984973779a343b8c1ae43cb6645a630..a4a4a172c85f1e946bc836479b8ffa80e8c51a33 100644 (file)
@@ -38,6 +38,8 @@ def pytest_report_header(config):
     env = Env()
     report = [
         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-proxy: {env.httpd_version()}, http:{env.proxy_port} https:{env.proxys_port}'
     ]
index 988b90a2f1256f59473c5ac25157bac3d6b8907e..aa40180046ce495c7107d732b17bc695fb1b50fc 100644 (file)
@@ -71,7 +71,9 @@ class EnvConfig:
             'version': '',
             'os': '',
             'fullname': '',
+            'features_string': '',
             'features': [],
+            'protocols_string': '',
             'protocols': [],
             'libs': [],
             'lib_versions': [],
@@ -98,10 +100,12 @@ class EnvConfig:
                         re.sub(r'/[a-z0-9.-]*', '', lib) for lib in self.curl_props['lib_versions']
                     ]
             if line.startswith('Features: '):
+                self.curl_props['features_string'] = line[10:]
                 self.curl_props['features'] = [
                     feat.lower() for feat in line[10:].split(' ')
                 ]
             if line.startswith('Protocols: '):
+                self.curl_props['protocols_string'] = line[11:]
                 self.curl_props['protocols'] = [
                     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 False
 
+    @staticmethod
+    def curl_features_string() -> str:
+        return Env.CONFIG.curl_props['features_string']
+
     @staticmethod
     def curl_has_feature(feature: str) -> bool:
         return feature.lower() in Env.CONFIG.curl_props['features']
 
+    @staticmethod
+    def curl_protocols_string() -> str:
+        return Env.CONFIG.curl_props['protocols_string']
+
     @staticmethod
     def curl_has_protocol(protocol: str) -> bool:
         return protocol.lower() in Env.CONFIG.curl_props['protocols']