2021-03-05 12:36:04 +03:00
#!/bin/bash
set -ex
set -o pipefail
mkdir -p /run/udev/rules.d/
2021-04-08 11:57:40 +03:00
test ! -f /run/udev/tags/added/c1:3
test ! -f /run/udev/tags/changed/c1:3
udevadm info /dev/null | grep -E 'E: (TAGS|CURRENT_TAGS)=.*:(added|changed):' && exit 1
2021-03-05 12:36:04 +03:00
2021-04-08 01:09:55 +03:00
cat >/run/udev/rules.d/50-testsuite.rules <<EOF
2021-03-07 08:18:07 +03:00
SUBSYSTEM = = "mem" , KERNEL = = "null" , OPTIONS = "log_level=debug"
2021-03-05 12:36:04 +03:00
ACTION = = "add" , SUBSYSTEM = = "mem" , KERNEL = = "null" , TAG += "added"
ACTION = = "change" , SUBSYSTEM = = "mem" , KERNEL = = "null" , TAG += "changed"
EOF
udevadm control --reload
udevadm trigger -c add /dev/null
2021-04-08 11:57:40 +03:00
while test ! -f /run/udev/tags/added/c1:3 ||
test -f /run/udev/tags/changed/c1:3 ||
! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
do
2021-03-05 12:36:04 +03:00
sleep .5
done
udevadm control --reload
udevadm trigger -c change /dev/null
2021-04-08 11:57:40 +03:00
while test ! -f /run/udev/tags/added/c1:3 ||
test ! -f /run/udev/tags/changed/c1:3 ||
! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
! udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
do
2021-03-05 12:36:04 +03:00
sleep .5
done
udevadm control --reload
udevadm trigger -c add /dev/null
2021-04-08 11:57:40 +03:00
while test ! -f /run/udev/tags/added/c1:3 ||
test ! -f /run/udev/tags/changed/c1:3 ||
! udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' ||
! udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:added:.*' ||
! udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' ||
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
do
2021-03-05 12:36:04 +03:00
sleep .5
done
exit 0