]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip networkd tests if networkd/resolved are disabled at build time
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 29 Mar 2025 17:56:04 +0000 (17:56 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 30 Mar 2025 08:18:18 +0000 (10:18 +0200)
test/networkd-test.py
test/test-network/systemd-networkd-tests.py

index 1fa5d566dbf4f9405e3647444431cdbdbaaf35d1..5f2477fccb989e8742255b90929a68db39676ff5 100755 (executable)
@@ -47,6 +47,12 @@ def setUpModule():
     global tmpmounts
 
     """Initialize the environment, and perform sanity checks on it."""
+
+    if shutil.which('networkctl') is None:
+        raise unittest.SkipTest('networkd not installed')
+    if shutil.which('resolvectl') is None:
+        raise unittest.SkipTest('resolved not installed')
+
     if NETWORKD_WAIT_ONLINE is None:
         raise OSError(errno.ENOENT, 'systemd-networkd-wait-online not found')
 
index a91d45e99521eae65cc0586c23e99ee898bcfb1f..fe1c61b8fb7ab4774edd26e0fcbcd4725c4379eb 100755 (executable)
@@ -8958,6 +8958,10 @@ if __name__ == '__main__':
     else:
         source_dir = None
 
+    if networkd_bin is None or resolved_bin is None or timesyncd_bin is None:
+        print("networkd tests require networkd/resolved/timesyncd to be enabled")
+        sys.exit(77)
+
     use_valgrind = ns.use_valgrind
     enable_debug = ns.enable_debug
     asan_options = ns.asan_options