8d419f
From fdd32f48af7993305f65989162dedd75a929966a Mon Sep 17 00:00:00 2001
8d419f
From: Evgeny Vereshchagin <evvers@ya.ru>
8d419f
Date: Tue, 15 Feb 2022 01:13:10 +0000
8d419f
Subject: [PATCH] tests: allow running all the services with SYSTEMD_LOG_LEVEL
8d419f
8d419f
It should make it easier to figure out what exactly services do there.
8d419f
For example, with SYSTEMD_LOG_LEVEL=debug userdbd (v249) prints
8d419f
```
8d419f
varlink-5: New incoming message: {"method":"io.systemd.UserDatabase.GetUserRecord","parameters":{}}
8d419f
```
8d419f
before it crashes and systemd-resolved prints
8d419f
```
8d419f
varlink-21: New incoming message: {"method":"io.systemd.Resolve.ResolveAddress","parameters":{"address":[127,0,0,1],"flags":0,"ifindex":1000000,"family":0}}
8d419f
```
8d419f
and those messages are helpful (especially when scripts causing them
8d419f
aren't clever enough to keep track of random stuff they send to systemd
8d419f
:-))
8d419f
8d419f
(cherry picked from commit bf6ef6b6a9156e5f52ee69ce0c529a246f103e54)
8d419f
8d419f
Related: #2017035
8d419f
---
8d419f
 test/test-functions | 3 +++
8d419f
 1 file changed, 3 insertions(+)
8d419f
8d419f
diff --git a/test/test-functions b/test/test-functions
8d419f
index dcc893733c..a299f5ff1f 100644
8d419f
--- a/test/test-functions
8d419f
+++ b/test/test-functions
8d419f
@@ -1142,6 +1142,9 @@ install_systemd() {
8d419f
 
8d419f
     # enable debug logging in PID1
8d419f
     echo LogLevel=debug >>"$initdir/etc/systemd/system.conf"
8d419f
+    if [[ -n "$TEST_SYSTEMD_LOG_LEVEL" ]]; then
8d419f
+        echo DefaultEnvironment=SYSTEMD_LOG_LEVEL="$TEST_SYSTEMD_LOG_LEVEL" >>"$initdir/etc/systemd/system.conf"
8d419f
+    fi
8d419f
     # store coredumps in journal
8d419f
     echo Storage=journal >>"$initdir/etc/systemd/coredump.conf"
8d419f
     # Propagate SYSTEMD_UNIT_PATH to user systemd managers