]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 8 Apr 2025 19:52:11 +0000 (20:52 +0100)
(cherry picked from commit da2498352635921621a636014fee0547c53058b2)
(cherry picked from commit 88a0d3dfcb7f5769ac1b1add3d66d9699252dfe0)

test/networkd-test.py
test/test-network/systemd-networkd-tests.py

index 47a3ad79632f9343b011c97d296651e4b2d2442d..2a98aece09d3727103e54e67bff50493068583db 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 ee7f6ccd0aa2214b2d06c8a6168d74f73ff8e732..febdfcb436e1c903aafadcf58317013f01dfbf80 100755 (executable)
@@ -7936,6 +7936,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