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 --- test/testsuite-80.units/fdstore-nopin.service | 6 --- test/testsuite-80.units/fdstore-pin.service | 6 --- test/testsuite-80.units/fdstore-pin.sh | 47 -------------------- test/testsuite-80.units/fdstore-pin.target | 3 -- test/testsuite-80.units/notify.service | 4 -- test/testsuite-80.units/test.sh | 63 --------------------------- 6 files changed, 129 deletions(-) delete mode 100644 test/testsuite-80.units/fdstore-nopin.service delete mode 100644 test/testsuite-80.units/fdstore-pin.service delete mode 100755 test/testsuite-80.units/fdstore-pin.sh delete mode 100644 test/testsuite-80.units/fdstore-pin.target delete mode 100644 test/testsuite-80.units/notify.service delete mode 100755 test/testsuite-80.units/test.sh (limited to 'test/testsuite-80.units') diff --git a/test/testsuite-80.units/fdstore-nopin.service b/test/testsuite-80.units/fdstore-nopin.service deleted file mode 100644 index 29ffd23..0000000 --- a/test/testsuite-80.units/fdstore-nopin.service +++ /dev/null @@ -1,6 +0,0 @@ -[Service] -Type=notify -NotifyAccess=all -FileDescriptorStoreMax=10 -FileDescriptorStorePreserve=restart -ExecStart=/usr/lib/systemd/tests/testdata/testsuite-80.units/fdstore-pin.sh 0 diff --git a/test/testsuite-80.units/fdstore-pin.service b/test/testsuite-80.units/fdstore-pin.service deleted file mode 100644 index 913daa2..0000000 --- a/test/testsuite-80.units/fdstore-pin.service +++ /dev/null @@ -1,6 +0,0 @@ -[Service] -Type=notify -NotifyAccess=all -FileDescriptorStoreMax=10 -FileDescriptorStorePreserve=yes -ExecStart=/usr/lib/systemd/tests/testdata/testsuite-80.units/fdstore-pin.sh 1 diff --git a/test/testsuite-80.units/fdstore-pin.sh b/test/testsuite-80.units/fdstore-pin.sh deleted file mode 100755 index 4cb041a..0000000 --- a/test/testsuite-80.units/fdstore-pin.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later -set -eux -set -o pipefail - -PINNED="$1" -COUNTER="/tmp/fdstore-invoked.$PINNED" -FILE="/tmp/fdstore-data.$PINNED" - -# This script is called six times: thrice from a service unit where the fdstore -# is pinned, and thrice where it isn't. The second iteration of each series is -# a restart, the third a stop followed by a start - -if [ -e "$COUNTER" ] ; then - read -r N < "$COUNTER" -else - N=0 -fi - -echo "Invocation #$N with PINNED=$PINNED." - -if [ "$N" -eq 0 ] ; then - # First iteration - test "${LISTEN_FDS:-0}" -eq 0 - test ! -e "$FILE" - echo waldi > "$FILE" - systemd-notify --fd=3 --fdname="fd-$N-$PINNED" 3< "$FILE" -elif [ "$N" -eq 1 ] || { [ "$N" -eq 2 ] && [ "$PINNED" -eq 1 ]; } ; then - # Second iteration, or iteration with pinning on - test "${LISTEN_FDS:-0}" -eq 1 - # We reopen fd #3 here, so that the read offset is at zero each time (hence no <&3 hereā€¦) - read -r word < /proc/self/fd/3 - test "$word" = "waldi" -else - test "${LISTEN_FDS:-0}" -eq 0 - test -e "$FILE" -fi - -if [ "$N" -ge 2 ] ; then - rm "$COUNTER" "$FILE" -else - echo $((N + 1)) > "$COUNTER" -fi - -systemd-notify --ready --status="Ready" - -exec sleep infinity diff --git a/test/testsuite-80.units/fdstore-pin.target b/test/testsuite-80.units/fdstore-pin.target deleted file mode 100644 index 319b7e1..0000000 --- a/test/testsuite-80.units/fdstore-pin.target +++ /dev/null @@ -1,3 +0,0 @@ -[Unit] -After=fdstore-pin.service fdstore-nopin.service -Wants=fdstore-pin.service fdstore-nopin.service diff --git a/test/testsuite-80.units/notify.service b/test/testsuite-80.units/notify.service deleted file mode 100644 index 196b076..0000000 --- a/test/testsuite-80.units/notify.service +++ /dev/null @@ -1,4 +0,0 @@ -[Service] -Type=notify -NotifyAccess=all -ExecStart=/usr/lib/systemd/tests/testdata/testsuite-80.units/test.sh diff --git a/test/testsuite-80.units/test.sh b/test/testsuite-80.units/test.sh deleted file mode 100755 index 565ed8d..0000000 --- a/test/testsuite-80.units/test.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: LGPL-2.1-or-later -# shellcheck disable=SC2016 -set -eux -set -o pipefail - -sync_in() { - read -r x < /tmp/syncfifo2 - test "$x" = "$1" -} - -sync_out() { - echo "$1" > /tmp/syncfifo1 -} - -export SYSTEMD_LOG_LEVEL=debug - -echo "toplevel PID: $BASHPID" - -systemd-notify --status="Test starts" -sync_out a -sync_in b -( - echo "subshell PID: $BASHPID" - - # Make us main process - systemd-notify --pid="$BASHPID" - - # Lock down access to just us - systemd-notify "NOTIFYACCESS=main" - - # This should still work - systemd-notify --status="Sending READY=1 in an unprivileged process" - - # Send as subprocess of the subshell, this should not work - systemd-notify --ready --pid=self --status "BOGUS1" - - sync_out c - sync_in d - - # Move main process back to toplevel - systemd-notify --pid=parent "MAINPID=$$" - - # Should be dropped again - systemd-notify --status="BOGUS2" --pid=parent - - # Apparently, bash will automatically invoke the last command in a subshell - # via a simple execve() rather than fork()ing first. But we want that the - # previous command uses the subshell's PID, hence let's insert a final, - # bogus redundant command as last command to run in the subshell, so that - # bash can't optimize things like that. - echo "bye" -) - -echo "toplevel again: $BASHPID" - -systemd-notify --ready --status="OK" -systemd-notify "NOTIFYACCESS=none" -systemd-notify --status="BOGUS3" - -sync_out e - -exec sleep infinity -- cgit v1.2.3