2021-03-05 12:36:04 +03:00
#!/bin/bash
2021-10-17 19:13:06 +03:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2021-03-05 12:36:04 +03:00
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
2021-10-13 06:58:24 +03:00
SYSTEMD_LOG_LEVEL = debug udevadm trigger --verbose --settle --action add /dev/null
2021-03-05 12:36:04 +03:00
2021-09-16 00:34:45 +03:00
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:.*' && { echo 'unexpected TAGS=' ; exit 1; }
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*' && { echo 'unexpected CURRENT_TAGS=' ; exit 1; }
2021-10-13 06:58:24 +03:00
SYSTEMD_LOG_LEVEL = debug udevadm trigger --verbose --settle --action change /dev/null
2021-09-16 00:34:45 +03:00
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:.*' && { echo 'unexpected CURRENT_TAGS=' ; exit 1; }
udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*'
udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*'
2021-10-13 06:58:24 +03:00
SYSTEMD_LOG_LEVEL = debug udevadm trigger --verbose --settle --action add /dev/null
2021-09-16 00:34:45 +03:00
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:.*' && { echo 'unexpected CURRENT_TAGS=' ; exit 1; }
rm /run/udev/rules.d/50-testsuite.rules
2021-03-05 12:36:04 +03:00
udevadm control --reload
exit 0