summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2021-11-17 08:39:32 +0000
committerGitHub <noreply@github.com>2021-11-17 08:39:32 +0000
commitfabf79b0dfb24d668a82b2fd70e73fcb8f575180 (patch)
treef3450dc94d35ecab3328d834c2d5dbd56df7b0c1
parentb2174e2922aaeff32c1d842cc9285508d3fe370e (diff)
parentb36caceb889b2614b09bb96d839b216ee60dc3f7 (diff)
downloadsystemd-fabf79b0dfb24d668a82b2fd70e73fcb8f575180.tar.gz
Merge pull request #21406 from yuwata/test-network-debug-udev
test-network: check alternative name
-rw-r--r--test/test-network/conf/00-debug-net.rules2
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/test/test-network/conf/00-debug-net.rules b/test/test-network/conf/00-debug-net.rules
new file mode 100644
index 0000000000..5146b90c4d
--- /dev/null
+++ b/test/test-network/conf/00-debug-net.rules
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+SUBSYSTEM=="net", OPTIONS="log_level=debug"
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 58ca5b5446..9f3d1dce38 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -23,6 +23,8 @@ networkd_ci_path='/run/networkd-ci'
network_sysctl_ipv6_path='/proc/sys/net/ipv6/conf'
network_sysctl_ipv4_path='/proc/sys/net/ipv4/conf'
+udev_rules_dir='/run/udev/rules.d'
+
dnsmasq_pid_file='/run/networkd-ci/test-dnsmasq.pid'
dnsmasq_log_file='/run/networkd-ci/test-dnsmasq.log'
dnsmasq_lease_file='/run/networkd-ci/test-dnsmasq.lease'
@@ -170,10 +172,16 @@ def expectedFailureIfRTA_VIAIsNotSupported():
def expectedFailureIfAlternativeNameIsNotAvailable():
def f(func):
+ supported = False
call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
rc = call('ip link prop add dev dummy98 altname hogehogehogehogehoge', stderr=subprocess.DEVNULL)
- call('ip link del dummy98', stderr=subprocess.DEVNULL)
if rc == 0:
+ rc = call('ip link show dev hogehogehogehogehoge', stderr=subprocess.DEVNULL)
+ if rc == 0:
+ supported = True
+
+ call('ip link del dummy98', stderr=subprocess.DEVNULL)
+ if supported:
return func
else:
return unittest.expectedFailure(func)
@@ -273,10 +281,13 @@ def setUpModule():
os.makedirs(network_unit_file_path, exist_ok=True)
os.makedirs(networkd_conf_dropin_path, exist_ok=True)
os.makedirs(networkd_ci_path, exist_ok=True)
+ os.makedirs(udev_rules_dir, exist_ok=True)
shutil.rmtree(networkd_ci_path)
copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_path)
+ shutil.copy(os.path.join(networkd_ci_path, '00-debug-net.rules'), udev_rules_dir)
+
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service',
'systemd-udevd-kernel.socket', 'systemd-udevd-control.socket', 'systemd-udevd.service',
'firewalld.service']:
@@ -372,6 +383,7 @@ def tearDownModule():
global running_units
shutil.rmtree(networkd_ci_path)
+ os.remove(os.path.join(udev_rules_dir, '00-debug-net.rules'))
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service']:
check_output(f'systemctl stop {u}')