1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

test-network: re-enable test_macsec

The outstanding kernel panic should be already fixed in recent enough
kernels by [0]. To make the test safe to run anywhere, let's implement
a simple kernel version check and run the test only if we're running
with at least kernel 6.x. The patch might be in some 5.x kernels as
well, but let's be on the safe side and use 6.x as a baseline here
(which is currently the case for Arch and Fedora Rawhide anyway).

[0] https://lore.kernel.org/netdev/7b3fd03e1a46047e5ffe2a389fe74501f0a93206.1656519221.git.sd@queasysnail.net/T/#u
This commit is contained in:
Frantisek Sumsal 2022-10-30 20:27:55 +01:00
parent dcebf1d87e
commit b3de9d7bda

View File

@ -243,6 +243,21 @@ def expectedFailureIfNetdevsimWithSRIOVIsNotAvailable():
return f
# pylint: disable=C0415
def compare_kernel_version(min_kernel_version):
try:
import platform
from packaging import version
except ImportError:
print('Failed to import either platform or packaging module, assuming the comparison failed')
return False
# Get only the actual kernel version without any build/distro/arch stuff
# e.g. '5.18.5-200.fc36.x86_64' -> '5.18.5'
kver = platform.release().split('-')[0]
return version.parse(kver) >= version.parse(min_kernel_version)
def udev_reload():
check_output(*udevadm_cmd, 'control', '--reload')
@ -2051,7 +2066,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertIn('inet6 2002:da8:1:0:1034:56ff:fe78:9abc/64 scope global dynamic', output)
@unittest.skip(reason="Causes kernel panic on recent kernels: https://bugzilla.kernel.org/show_bug.cgi?id=208315")
@unittest.skipUnless(compare_kernel_version("6"), reason="Causes kernel panic on unpatched kernels: https://bugzilla.kernel.org/show_bug.cgi?id=208315")
def test_macsec(self):
copy_network_unit('25-macsec.netdev', '25-macsec.network', '25-macsec.key',
'26-macsec.network', '12-dummy.netdev')