]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd-test.py: generate debugging logs of networkd
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 21 Jan 2025 00:43:43 +0000 (09:43 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Jan 2025 08:48:17 +0000 (09:48 +0100)
test/networkd-test.py

index 120c29562b197abb14da3fb61bbd4ea15849b2b8..b806bb7fb87b2e70b3d4d376853198f3786f7610 100755 (executable)
@@ -63,6 +63,13 @@ def setUpModule():
         else:
             stopped_units.append(u)
 
+    # Generate debugging logs.
+    os.makedirs('/run/systemd/system/systemd-networkd.service.d', exist_ok=True)
+    with open(f'/run/systemd/system/systemd-networkd.service.d/00-debug.conf', mode='w', encoding='utf-8') as f:
+        f.write('[Service]\nEnvironment=SYSTEMD_LOG_LEVEL=debug\n')
+
+    subprocess.call(['systemctl', 'daemon-reload'])
+
     # create static systemd-network user for networkd-test-router.service (it
     # needs to do some stuff as root and can't start as user; but networkd
     # still insists on the user)
@@ -946,6 +953,9 @@ EOF
 # Hence, 'networkctl persistent-storage yes' cannot be used.
 export SYSTEMD_NETWORK_PERSISTENT_STORAGE_READY=1
 
+# Generate debugging logs.
+export SYSTEMD_LOG_LEVEL=debug
+
 # run networkd as in systemd-networkd.service
 exec $(systemctl cat systemd-networkd.service | sed -n '/^ExecStart=/ {{ s/^.*=//; s/^[@+-]//; s/^!*//; p}}')
 '''.format(ifr=self.if_router,