]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: redirect stdout/stderr of TEST-04-JOURNAL to console as well 30604/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 23 Dec 2023 14:35:26 +0000 (15:35 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 23 Dec 2023 14:54:51 +0000 (15:54 +0100)
This effectively reverts fa6f37c043 just for TEST-04, as we nuke the
journal repeatedly in this test which makes it particularly hard to
debug. Let's hope the issue behind fa6f37c043 won't bite us back in this
case.

Follow-up for: fa6f37c043
Reverts: 8f7c876bdc

test/TEST-04-JOURNAL/test.sh
test/units/testsuite-04.bsod.sh

index 7f1c460d471d98cd579a02624197bb0605712c81..42574ce8ea7cfecf782f179132f0359efa1c95df 100755 (executable)
@@ -9,6 +9,7 @@ TEST_DESCRIPTION="Journal-related tests"
 
 test_append_files() {
     local workspace="${1:?}"
+    local dropin_dir
 
     mkdir -p "$workspace/test-journals/"
     cp -av "${TEST_BASE_DIR:?}/test-journals/"* "$workspace/test-journals/"
@@ -18,6 +19,14 @@ test_append_files() {
     # Necessary for RH-based systems, otherwise MHD fails with:
     #   microhttpd: Failed to initialise TLS session.
     image_install -o /etc/crypto-policies/back-ends/gnutls.config
+
+    # Since we nuke the journal repeatedly during this test, let's redirect
+    # stdout/stderr to the console as well to make the test a bit more debug-able.
+    if ! get_bool "${INTERACTIVE_DEBUG:-}"; then
+        dropin_dir="${workspace:?}/etc/systemd/system/testsuite-04.service.d/"
+        mkdir -p "$dropin_dir"
+        printf '[Service]\nStandardOutput=journal+console\nStandardError=journal+console' >"$dropin_dir/99-stdout.conf"
+    fi
 }
 
 do_test "$@"
index 1d4ad7ec6a21a48761b8ab93c90d05af068d6edc..30f0cb0bd4813751cc6d903dd7a411e789b88537 100755 (executable)
@@ -22,9 +22,6 @@ at_exit() {
         journalctl --flush
     fi
 
-    rm -f /run/systemd/journald.conf.d/99-forward-to-console.conf
-    systemctl restart systemd-journald
-
     return 0
 }
 
@@ -52,12 +49,7 @@ vcs_dump_and_check() {
 # current boot, let's temporarily overmount /var/log/journal with a tmpfs,
 # as we're going to wipe it multiple times, but we need to keep the original
 # journal intact for the other tests to work correctly.
-#
-# Also, since we'll eventually lose the journal from this test, let's temporarily
-# forward everything to console, to make potential fails debug-able.
 trap at_exit EXIT
-mkdir -p /run/systemd/journald.conf.d/
-echo -ne '[Journal]\nForwardToConsole=yes' >/run/systemd/journald.conf.d/99-forward-to-console.conf
 mount -t tmpfs tmpfs /var/log/journal
 systemctl restart systemd-journald