test: skip networkd tests if networkd/resolved are disabled at build time

This commit is contained in:
Luca Boccassi
2025-03-29 17:56:04 +00:00
committed by Daan De Meyer
parent 75b16ac59e
commit da24983526
2 changed files with 10 additions and 0 deletions

View File

@@ -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')

View File

@@ -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