From 527e791c5346846e2bc7d32f7597d70f9a274499 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 25 Apr 2024 04:54:53 +0200 Subject: Merging upstream version 255.5. Signed-off-by: Daniel Baumann --- test/units/testsuite-04.journal-corrupt.sh | 36 +++++++++++++++++++++++++ test/units/testsuite-04.journal.sh | 16 +++++++++--- test/units/testsuite-07.exec-context.sh | 2 ++ test/units/testsuite-29.sh | 13 +++++++++ test/units/testsuite-45.sh | 12 +++------ test/units/testsuite-50.sh | 2 +- test/units/testsuite-72.sh | 4 +-- test/units/testsuite-75.sh | 42 ++++++++++++++++-------------- 8 files changed, 92 insertions(+), 35 deletions(-) create mode 100755 test/units/testsuite-04.journal-corrupt.sh (limited to 'test/units') diff --git a/test/units/testsuite-04.journal-corrupt.sh b/test/units/testsuite-04.journal-corrupt.sh new file mode 100755 index 0000000..051d0ab --- /dev/null +++ b/test/units/testsuite-04.journal-corrupt.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux +set -o pipefail + +journalctl --rotate --vacuum-files=1 +# Nuke all archived journals, so we start with a clean slate +rm -f "/var/log/journal/$(/dev/null 2>&1; then +if [[ ! -e /dev/loop-control ]]; then echo "No loopback device support" SECTOR_SIZES="512" fi @@ -108,7 +108,7 @@ for sector_size in $SECTOR_SIZES ; do rm -f "$BACKING_FILE" truncate -s "$disk_size" "$BACKING_FILE" - if losetup --find >/dev/null 2>&1; then + if [[ -e /dev/loop-control ]]; then # shellcheck disable=SC2086 blockdev="$(losetup --find --show --sector-size $sector_size $BACKING_FILE)" else diff --git a/test/units/testsuite-75.sh b/test/units/testsuite-75.sh index 5423448..86d602d 100755 --- a/test/units/testsuite-75.sh +++ b/test/units/testsuite-75.sh @@ -46,7 +46,8 @@ monitor_check_rr() ( # displayed. We turn off pipefail for this, since we don't care about the # lhs of this pipe expression, we only care about the rhs' result to be # clean - timeout -v 30s journalctl -u resolvectl-monitor.service --since "$since" -f --full | grep -m1 "$match" + # v255-only: match against a syslog tag as well to work around systemd/systemd#30886 + timeout -v 30s journalctl --since "$since" -f --full _SYSTEMD_UNIT="resolvectl-monitor.service" + SYSLOG_IDENTIFIER="resolvectl-monitor" | grep -m1 "$match" ) restart_resolved() { @@ -251,8 +252,8 @@ resolvectl status resolvectl log-level debug # Start monitoring queries -systemd-run -u resolvectl-monitor.service -p Type=notify resolvectl monitor -systemd-run -u resolvectl-monitor-json.service -p Type=notify resolvectl monitor --json=short +systemd-run -u resolvectl-monitor.service -p SyslogIdentifier=resolvectl-monitor -p Type=notify resolvectl monitor +systemd-run -u resolvectl-monitor-json.service -p SyslogIdentifier=resolvectl-monitor-json -p Type=notify resolvectl monitor --json=short # Check if all the zones are valid (zone-check always returns 0, so let's check # if it produces any errors/warnings) @@ -280,16 +281,16 @@ knotc reload TIMESTAMP=$(date '+%F %T') # Issue: https://github.com/systemd/systemd/issues/23951 # With IPv6 enabled -run getent -s resolve hosts ns1.unsigned.test -grep -qE "^fd00:dead:beef:cafe::1\s+ns1\.unsigned\.test" "$RUN_OUT" +run getent -s resolve ahosts ns1.unsigned.test +grep -qE "^fd00:dead:beef:cafe::1\s+STREAM\s+ns1\.unsigned\.test" "$RUN_OUT" monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN AAAA fd00:dead:beef:cafe::1" # With IPv6 disabled # Issue: https://github.com/systemd/systemd/issues/23951 -# FIXME -#disable_ipv6 -#run getent -s resolve hosts ns1.unsigned.test -#grep -qE "^10\.0\.0\.1\s+ns1\.unsigned\.test" "$RUN_OUT" -#monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN A 10.0.0.1" +disable_ipv6 +run getent -s resolve ahosts ns1.unsigned.test +grep -qE "^10\.0\.0\.1\s+STREAM\s+ns1\.unsigned\.test" "$RUN_OUT" +(! grep -qE "fd00:dead:beef:cafe::1" "$RUN_OUT") +monitor_check_rr "$TIMESTAMP" "ns1.unsigned.test IN A 10.0.0.1" enable_ipv6 # Issue: https://github.com/systemd/systemd/issues/18812 @@ -297,16 +298,17 @@ enable_ipv6 # Follow-up issue: https://github.com/systemd/systemd/issues/23152 # Follow-up PR: https://github.com/systemd/systemd/pull/23161 # With IPv6 enabled -run getent -s resolve hosts localhost -grep -qE "^::1\s+localhost" "$RUN_OUT" -run getent -s myhostname hosts localhost -grep -qE "^::1\s+localhost" "$RUN_OUT" +run getent -s resolve ahosts localhost +grep -qE "^::1\s+STREAM\s+localhost" "$RUN_OUT" +run getent -s myhostname ahosts localhost +grep -qE "^::1\s+STREAM\s+localhost" "$RUN_OUT" # With IPv6 disabled disable_ipv6 -run getent -s resolve hosts localhost -grep -qE "^127\.0\.0\.1\s+localhost" "$RUN_OUT" -run getent -s myhostname hosts localhost -grep -qE "^127\.0\.0\.1\s+localhost" "$RUN_OUT" +run getent -s resolve ahosts localhost +grep -qE "^127\.0\.0\.1\s+STREAM\s+localhost" "$RUN_OUT" +(! grep -qE "::1" "$RUN_OUT") +run getent -s myhostname ahosts localhost +grep -qE "^127\.0\.0\.1\s+STREAM\s+localhost" "$RUN_OUT" enable_ipv6 # Issue: https://github.com/systemd/systemd/issues/25088 @@ -557,10 +559,10 @@ systemctl stop resolvectl-monitor-json.service # Issue: https://github.com/systemd/systemd/issues/29580 (part #2) # # Check for any warnings regarding malformed messages -(! journalctl -u resolvectl-monitor.service -u reseolvectl-monitor-json.service -p warning --grep malformed) +(! journalctl -p warning --grep malformed _SYSTEMD_UNIT="resolvectl-monitor-json.service" + SYSLOG_IDENTIFIER="resolvectl-monitor-json") # Verify that all queries recorded by `resolvectl monitor --json` produced a valid JSON # with expected fields -journalctl -p info -o cat _SYSTEMD_UNIT="resolvectl-monitor-json.service" | while read -r line; do +journalctl -p info -o cat _SYSTEMD_UNIT="resolvectl-monitor-json.service" + SYSLOG_IDENTIFIER="resolvectl-monitor-json" | while read -r line; do # Check that both "question" and "answer" fields are arrays # # The expression is slightly more complicated due to the fact that the "answer" field is optional, -- cgit v1.2.3