From 10176f00111d19ad91d8e81111624c2de16790cb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 29 Mar 2022 14:58:58 +0900 Subject: test: add tests for worker error code --- test/units/testsuite-17.03.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/units/testsuite-17.03.sh b/test/units/testsuite-17.03.sh index 4c2a0410da..318afdcb5a 100755 --- a/test/units/testsuite-17.03.sh +++ b/test/units/testsuite-17.03.sh @@ -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 -- cgit v1.2.3