TEST-80: synchronize explicitly instead of by time
This removes "sleep" invocations, and makes the notify access testcase a lot more robust to runtime jitter. We use a pair of fifos in the fs to sync instead. Also various other improvoements, including comments. (Also removes the unnecessary "no-qemu" restriction)
This commit is contained in:
committed by
Yu Watanabe
parent
49e8342965
commit
09ba6d1a14
@@ -9,17 +9,35 @@ set -o pipefail
|
||||
|
||||
: >/failed
|
||||
|
||||
mkfifo /tmp/syncfifo1 /tmp/syncfifo2
|
||||
|
||||
sync_in() {
|
||||
read -r x < /tmp/syncfifo1
|
||||
test "$x" = "$1"
|
||||
}
|
||||
|
||||
sync_out() {
|
||||
echo "$1" > /tmp/syncfifo2
|
||||
}
|
||||
|
||||
export SYSTEMD_LOG_LEVEL=debug
|
||||
|
||||
systemctl --no-block start notify.service
|
||||
sleep 2
|
||||
|
||||
sync_in a
|
||||
|
||||
assert_eq "$(systemctl show notify.service -p StatusText --value)" "Test starts, waiting for 5 seconds"
|
||||
assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "all"
|
||||
sleep 5
|
||||
assert_eq "$(systemctl show notify.service -p StatusText --value)" "Test starts"
|
||||
|
||||
sync_out b
|
||||
sync_in c
|
||||
|
||||
assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "main"
|
||||
assert_eq "$(systemctl show notify.service -p StatusText --value)" "Sending READY=1 in an unpriviledged process"
|
||||
assert_eq "$(systemctl show notify.service -p StatusText --value)" "Sending READY=1 in an unprivileged process"
|
||||
assert_rc 3 systemctl --quiet is-active notify.service
|
||||
sleep 10
|
||||
|
||||
sync_out d
|
||||
sync_in e
|
||||
|
||||
systemctl --quiet is-active notify.service
|
||||
assert_eq "$(systemctl show notify.service -p StatusText --value)" "OK"
|
||||
@@ -28,5 +46,7 @@ assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "none"
|
||||
systemctl stop notify.service
|
||||
assert_eq "$(systemctl show notify.service -p NotifyAccess --value)" "all"
|
||||
|
||||
rm /tmp/syncfifo1 /tmp/syncfifo2
|
||||
|
||||
touch /testok
|
||||
rm /failed
|
||||
|
||||
Reference in New Issue
Block a user