Skip to content

Commit 2c9e1ae

Browse files
mrc0mmandbluca
authored andcommitted
test: redirect stdout/stderr of TEST-04-JOURNAL to console as well
This effectively reverts fa6f37c 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 fa6f37c won't bite us back in this case. Follow-up for: fa6f37c Reverts: 8f7c876 (cherry picked from commit b3ed080)
1 parent 73b49bd commit 2c9e1ae

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/TEST-04-JOURNAL/test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TEST_DESCRIPTION="Journal-related tests"
99

1010
test_append_files() {
1111
local workspace="${1:?}"
12+
local dropin_dir
1213

1314
mkdir -p "$workspace/test-journals/"
1415
cp -av "${TEST_BASE_DIR:?}/test-journals/"* "$workspace/test-journals/"
@@ -18,6 +19,14 @@ test_append_files() {
1819
# Necessary for RH-based systems, otherwise MHD fails with:
1920
# microhttpd: Failed to initialise TLS session.
2021
image_install -o /etc/crypto-policies/back-ends/gnutls.config
22+
23+
# Since we nuke the journal repeatedly during this test, let's redirect
24+
# stdout/stderr to the console as well to make the test a bit more debug-able.
25+
if ! get_bool "${INTERACTIVE_DEBUG:-}"; then
26+
dropin_dir="${workspace:?}/etc/systemd/system/testsuite-04.service.d/"
27+
mkdir -p "$dropin_dir"
28+
printf '[Service]\nStandardOutput=journal+console\nStandardError=journal+console' >"$dropin_dir/99-stdout.conf"
29+
fi
2130
}
2231

2332
do_test "$@"

test/units/testsuite-04.bsod.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ at_exit() {
2222
journalctl --flush
2323
fi
2424

25-
rm -f /run/systemd/journald.conf.d/99-forward-to-console.conf
26-
systemctl restart systemd-journald
27-
2825
return 0
2926
}
3027

@@ -52,12 +49,7 @@ vcs_dump_and_check() {
5249
# current boot, let's temporarily overmount /var/log/journal with a tmpfs,
5350
# as we're going to wipe it multiple times, but we need to keep the original
5451
# journal intact for the other tests to work correctly.
55-
#
56-
# Also, since we'll eventually lose the journal from this test, let's temporarily
57-
# forward everything to console, to make potential fails debug-able.
5852
trap at_exit EXIT
59-
mkdir -p /run/systemd/journald.conf.d/
60-
echo -ne '[Journal]\nForwardToConsole=yes' >/run/systemd/journald.conf.d/99-forward-to-console.conf
6153
mount -t tmpfs tmpfs /var/log/journal
6254
systemctl restart systemd-journald
6355

0 commit comments

Comments
 (0)