mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
9228ecaf8c
It should faster to be processed. So, we can shorten the timeout. Also, this makes the test use `udevadm trigger`.
49 lines
976 B
Bash
Executable File
49 lines
976 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
test_rule="/run/udev/rules.d/49-test.rules"
|
|
|
|
setup() {
|
|
mkdir -p "${test_rule%/*}"
|
|
cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
|
|
cat >"${test_rule}" <<EOF
|
|
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
|
|
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", PROGRAM=="/bin/sleep 60"
|
|
EOF
|
|
echo "event_timeout=10" >>/etc/udev/udev.conf
|
|
echo "timeout_signal=SIGABRT" >>/etc/udev/udev.conf
|
|
|
|
systemctl restart systemd-udevd.service
|
|
}
|
|
|
|
teardown() {
|
|
set +e
|
|
|
|
mv -f /etc/udev/udev.conf.bckp /etc/udev/udev.conf
|
|
rm -f "$test_rule"
|
|
systemctl restart systemd-udevd.service
|
|
}
|
|
|
|
run_test() {
|
|
since="$(date +%T)"
|
|
|
|
udevadm trigger -w --action add /dev/null
|
|
|
|
for _ in {1..20}; do
|
|
if coredumpctl --since "$since" --no-legend --no-pager | grep /bin/udevadm ; then
|
|
return 0
|
|
fi
|
|
sleep .5
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
trap teardown EXIT
|
|
|
|
setup
|
|
run_test
|
|
|
|
exit 0
|