Debian Codegraph @

test/units/TEST-78-SIGQUEUE.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -ex
4 set -o pipefail
5
6 if ! envscip-shell system . . env. --block-signal=SIGUSR1 true 2> /dev/nullscip-shell filesystem . . `/dev/null`. ; then
7 echoscip-shell system . . echo. "env tool too old, can't block signals, skipping test." >&2
8 echoscip-shell system . . echo. OK >/testokscip-shell filesystem . . `/testok`.
9 exit 0
10 fi
11
12 UNIT="test-sigqueue-$RANDOM.service"
13
14 systemd-run -u "$UNIT" -p Type=notify -p DynamicUser=1 -- env --block-signal=SIGRTMIN+7 systemd-notify --exec --ready \; sleep infinity
15
16 systemctl kill --kill-whom=main --kill-value=4 --signal=SIGRTMIN+7 "$UNIT"
17 systemctl kill --kill-whom=main --kill-value=4 --signal=SIGRTMIN+7 "$UNIT"
18 systemctl kill --kill-whom=main --kill-value=7 --signal=SIGRTMIN+7 "$UNIT"
19 systemctl kill --kill-whom=main --kill-value=16 --signal=SIGRTMIN+7 "$UNIT"
20 systemctl kill --kill-whom=main --kill-value=32 --signal=SIGRTMIN+7 "$UNIT"
21 systemctl kill --kill-whom=main --kill-value=16 --signal=SIGRTMIN+7 "$UNIT"
22
23 # We simply check that six signals are queued now. There's no easy way to check
24 # from shell which ones those are, hence we don't check that.
25 P=$(systemctl show -P MainPID "$UNIT")
26
27 testscip-shell system . . test. "$(grepscip-shell system . . grep. SigQ: /proc/"$P"/status | cutscip-shell system . . cut. -d: -f2 | cutscip-shell system . . cut. -d/ -f1)" -eq 6
28
29 systemctl stop $UNIT
30
31 touchscip-shell system . . touch. /testokscip-shell filesystem . . `/testok`.