mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
test: add tests for worker error code
This commit is contained in:
parent
6467bda59d
commit
10176f0011
@ -3,6 +3,7 @@
|
||||
set -ex
|
||||
|
||||
test_rule="/run/udev/rules.d/49-test.rules"
|
||||
KILL_PID=
|
||||
|
||||
setup() {
|
||||
mkdir -p "${test_rule%/*}"
|
||||
@ -22,18 +23,37 @@ EOF
|
||||
teardown() {
|
||||
set +e
|
||||
|
||||
if [[ -n "$KILL_PID" ]]; then
|
||||
kill "$KILL_PID"
|
||||
fi
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
mv -f /etc/udev/udev.conf.bckp /etc/udev/udev.conf
|
||||
rm -f "$test_rule"
|
||||
systemctl restart systemd-udevd.service
|
||||
}
|
||||
|
||||
run_test() {
|
||||
local since
|
||||
|
||||
since="$(date '+%F %T')"
|
||||
|
||||
SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --settle --action add /dev/null
|
||||
TMPDIR=$(mktemp -d -p /tmp udev-tests.XXXXXX)
|
||||
udevadm monitor --udev --property --subsystem-match=mem >"$TMPDIR"/monitor.txt &
|
||||
KILL_PID="$!"
|
||||
|
||||
for _ in {1..20}; do
|
||||
SYSTEMD_LOG_LEVEL=debug udevadm trigger --verbose --action add /dev/null
|
||||
|
||||
for _ in {1..40}; do
|
||||
if coredumpctl --since "$since" --no-legend --no-pager | grep /bin/udevadm ; then
|
||||
kill "$KILL_PID"
|
||||
KILL_PID=
|
||||
|
||||
cat "$TMPDIR"/monitor.txt
|
||||
grep -q 'UDEV_WORKER_FAILED=1' "$TMPDIR"/monitor.txt
|
||||
grep -q 'UDEV_WORKER_SIGNAL=6' "$TMPDIR"/monitor.txt
|
||||
grep -q 'UDEV_WORKER_SIGNAL_NAME=ABRT' "$TMPDIR"/monitor.txt
|
||||
return 0
|
||||
fi
|
||||
sleep .5
|
||||
|
Loading…
Reference in New Issue
Block a user