summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-06-03 10:43:43 +0200
committerLuca Boccassi <bluca@debian.org>2024-06-03 19:41:26 +0200
commit6fec5982900efb4fcd5a6f8eca68e274f557442d (patch)
tree507adcf975d8235b8c09d486c6dfacb173519f3a
parenttest-network: generate debugging logs of networkd-persistent-storage.service (diff)
downloadsystemd-6fec5982900efb4fcd5a6f8eca68e274f557442d.tar.xz
systemd-6fec5982900efb4fcd5a6f8eca68e274f557442d.zip
test-network: flush stream buffer and journals before/after running test
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index b294621de9..64fb5fce13 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -923,7 +923,11 @@ def udevadm_trigger(*args, action='add'):
udevadm('trigger', '--settle', f'--action={action}', *args)
def setup_common():
+ # We usually show something in each test. So, let's break line to make the title of a test and output
+ # from the test mixed. Then, flush stream buffer and journals.
print()
+ sys.stdout.flush()
+ check_output('journalctl --sync')
def tear_down_common():
# 1. stop DHCP/RA servers
@@ -956,6 +960,10 @@ def tear_down_common():
flush_routing_policy_rules()
flush_routes()
+ # 8. flush stream buffer and journals to make not any output from the test with the next one
+ sys.stdout.flush()
+ check_output('journalctl --sync')
+
def setUpModule():
rm_rf(networkd_ci_temp_dir)
cp_r(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_temp_dir)
@@ -989,6 +997,10 @@ def tearDownModule():
clear_system_units()
restore_active_units()
+ # Flush stream buffer and journals before showing the test summary.
+ sys.stdout.flush()
+ check_output('journalctl --sync')
+
class Utilities():
# pylint: disable=no-member