From: Yu Watanabe Date: Mon, 3 Jun 2024 08:49:26 +0000 (+0900) Subject: test-network: show PID and Invocation ID of networkd X-Git-Tag: v256-rc4~26^2~1 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=653c38b3ebc6607bc3bfe51fa1539228eb6c899e;p=systemd%2F.git test-network: show PID and Invocation ID of networkd Then, we can easily find relevant journal entry on failure. This is especially useful when the test is running with --no-journal. --- diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 64fb5fce13..a0ca54c790 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -845,6 +845,9 @@ def radvd_check_config(config_file): def networkd_invocation_id(): return check_output('systemctl show --value -p InvocationID systemd-networkd.service') +def networkd_pid(): + return check_output('systemctl show --value -p MainPID systemd-networkd.service') + def read_networkd_log(invocation_id=None, since=None): if not invocation_id: invocation_id = networkd_invocation_id() @@ -876,6 +879,9 @@ def stop_networkd(show_logs=True): def start_networkd(): check_output('systemctl start systemd-networkd') + invocation_id = networkd_invocation_id() + pid = networkd_pid() + print(f'Started systemd-networkd.service: PID={pid}, Invocation ID={invocation_id}') def restart_networkd(show_logs=True): global show_journal @@ -886,6 +892,10 @@ def restart_networkd(show_logs=True): if show_logs: print(read_networkd_log(invocation_id)) + invocation_id = networkd_invocation_id() + pid = networkd_pid() + print(f'Restarted systemd-networkd.service: PID={pid}, Invocation ID={invocation_id}') + def networkd_pid(): return int(check_output('systemctl show --value -p MainPID systemd-networkd.service'))