From 78e9bb837c258ac0ec7712b3d612cc2f407e731e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:42 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- .../delegated-cgroup-filtering.service | 9 +++++++++ .../TEST-04-JOURNAL.units/forever-print-hola.service | 7 +++++++ .../TEST-04-JOURNAL.units/logs-filtering.service | 11 +++++++++++ .../TEST-04-JOURNAL.units/silent-success.service | 11 +++++++++++ .../TEST-04-JOURNAL.units/verbose-success.service | 13 +++++++++++++ test/TEST-04-JOURNAL/meson.build | 12 ++++++++++++ test/TEST-04-JOURNAL/test.sh | 5 +---- 7 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/delegated-cgroup-filtering.service create mode 100644 test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/forever-print-hola.service create mode 100644 test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering.service create mode 100644 test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/silent-success.service create mode 100644 test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/verbose-success.service create mode 100644 test/TEST-04-JOURNAL/meson.build (limited to 'test/TEST-04-JOURNAL') diff --git a/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/delegated-cgroup-filtering.service b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/delegated-cgroup-filtering.service new file mode 100644 index 0000000..7ecd358 --- /dev/null +++ b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/delegated-cgroup-filtering.service @@ -0,0 +1,9 @@ +[Unit] +Description=Test service for delegated logs filtering + +[Service] +Type=oneshot +ExecStart=/usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload.sh +Delegate=yes +SyslogLevel=notice +LogLevelMax=info diff --git a/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/forever-print-hola.service b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/forever-print-hola.service new file mode 100644 index 0000000..9273d6d --- /dev/null +++ b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/forever-print-hola.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=ForeverPrintHola service + +[Service] +Type=exec +ExecStart=sh -x -c 'while :; do printf "Hola\n" || touch /tmp/i-lose-my-logs; sleep 1; done' diff --git a/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering.service b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering.service new file mode 100644 index 0000000..4c43005 --- /dev/null +++ b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/logs-filtering.service @@ -0,0 +1,11 @@ +[Unit] +Description=Log filtering unit + +[Service] +Type=oneshot +ExecStart=sh -c 'echo "Logging from the service, and ~more~ foo bar"' +# If the service finishes extremely fast, journald cannot find the source of the +# stream. Hence, we need to call 'journalctl --sync' before service finishes. +ExecStart=journalctl --sync +SyslogLevel=notice +LogLevelMax=info diff --git a/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/silent-success.service b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/silent-success.service new file mode 100644 index 0000000..d4541af --- /dev/null +++ b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/silent-success.service @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Silent successful service + +[Service] +Type=oneshot +LogLevelMax=notice +ExecStart=/bin/true +# If the service finishes extremely fast, journald cannot find the source of the +# stream. Hence, we need to call 'journalctl --sync' before service finishes. +ExecStart=journalctl --sync diff --git a/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/verbose-success.service b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/verbose-success.service new file mode 100644 index 0000000..004693b --- /dev/null +++ b/test/TEST-04-JOURNAL/TEST-04-JOURNAL.units/verbose-success.service @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Verbose successful service + +[Service] +Type=oneshot +ExecStart=echo success +# If the service finishes extremely fast, journald cannot find the source of the +# stream. Hence, we need to call 'journalctl --sync' before service finishes. +ExecStart=journalctl --sync +# Suppress debugging logs from PID1 or sd-executor. Otherwise, the client context +# may be outdated when the stream from 'echo' command in the above comes. +LogLevelMax=info diff --git a/test/TEST-04-JOURNAL/meson.build b/test/TEST-04-JOURNAL/meson.build new file mode 100644 index 0000000..5a0b073 --- /dev/null +++ b/test/TEST-04-JOURNAL/meson.build @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +# SPDX-License-Identifier: LGPL-2.1-or-later + +integration_tests += [ + integration_test_template + { + 'name' : fs.name(meson.current_source_dir()), + 'storage' : 'persistent', + }, +] + +testdata_subdirs += [meson.current_source_dir() / 'TEST-04-JOURNAL.units'] diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh index 42574ce..a7aa71f 100755 --- a/test/TEST-04-JOURNAL/test.sh +++ b/test/TEST-04-JOURNAL/test.sh @@ -11,9 +11,6 @@ test_append_files() { local workspace="${1:?}" local dropin_dir - mkdir -p "$workspace/test-journals/" - cp -av "${TEST_BASE_DIR:?}/test-journals/"* "$workspace/test-journals/" - image_install curl setterm unzstd image_install -o openssl # Necessary for RH-based systems, otherwise MHD fails with: @@ -23,7 +20,7 @@ test_append_files() { # 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/" + dropin_dir="${workspace:?}/etc/systemd/system/TEST-04-JOURNAL.service.d/" mkdir -p "$dropin_dir" printf '[Service]\nStandardOutput=journal+console\nStandardError=journal+console' >"$dropin_dir/99-stdout.conf" fi -- cgit v1.2.3