]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
tests: skip tests requiring kernel features not present
authorVincent Bernat <vincent@bernat.ch>
Sun, 12 Jan 2020 20:23:43 +0000 (21:23 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sun, 12 Jan 2020 20:23:43 +0000 (21:23 +0100)
Notably, "team" is not available in GCP kernels...

tests/integration/fixtures/programs.py
tests/integration/test_interfaces.py

index a5de4836a911d4662eb322b002c2690979553f0b..08e860b91a35efc63ad74c47555465f2f92a877b 100644 (file)
@@ -449,6 +449,19 @@ def pytest_configure(config):
                                    re.search(r"^lldpd (.*)$",
                                              output, re.MULTILINE).group(1))
 
+    # Also retrieve some kernel capabilities
+    features = []
+    for feature in ["rtnl-link-team"]:
+        ret = subprocess.call(["/sbin/modprobe", "--quiet", "--dry-run",
+                               feature])
+        if ret == 0:
+            features.append(feature)
+    config.kernel = namedtuple('kernel',
+                               ['features',
+                                'version'])(
+                                    features,
+                                    os.uname().release)
+
 
 def pytest_report_header(config):
     """Report lldpd/lldpcli version and configuration."""
@@ -457,6 +470,8 @@ def pytest_report_header(config):
                                           config.lldpd.features)))
     print('lldpcli: {} {}'.format(config.lldpcli.version,
                                   ", ".join(config.lldpcli.outputs)))
+    print('kernel: {} {}'.format(config.kernel.version,
+                                 ", ".join(config.kernel.features)))
     print('{}: {} {} {}'.format(platform.system().lower(),
                                 platform.release(),
                                 platform.version(),
index 5247fd11da7094e3b694c41180759e11c1f255df..db73c39133a1d8ba59832a3494bad23f1e4f304a 100644 (file)
@@ -117,6 +117,8 @@ def test_bond(lldpd1, lldpd, lldpcli, namespaces, links, when):
 
 @pytest.mark.skipif("'Dot3' not in config.lldpd.features",
                     reason="Dot3 not supported")
+@pytest.mark.skipif("'rtnl-link-team' not in config.kernel.features",
+                    reason="No team support in kernel")
 @pytest.mark.parametrize('when', ['before', 'after'])
 def test_team(lldpd1, lldpd, lldpcli, namespaces, links, when):
     links(namespaces(3), namespaces(2))  # Another link to setup a bond