mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
Merge pull request #20758 from yuwata/test-17-udev-cleanups
test: several cleanups for TEST-17-UDEV
This commit is contained in:
commit
1dcd91ad11
@ -6,7 +6,7 @@ mkdir -p /run/udev/rules.d/
|
||||
|
||||
rm -f /run/udev/rules.d/50-testsuite.rules
|
||||
udevadm control --reload
|
||||
udevadm trigger /dev/sda
|
||||
udevadm trigger --settle /dev/sda
|
||||
|
||||
while : ; do
|
||||
(
|
||||
@ -24,7 +24,7 @@ SUBSYSTEM=="block", KERNEL=="sda", OPTIONS="log_level=debug"
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="foobar.service"
|
||||
EOF
|
||||
udevadm control --reload
|
||||
udevadm trigger /dev/sda
|
||||
udevadm trigger --settle /dev/sda
|
||||
|
||||
while : ; do
|
||||
(
|
||||
@ -42,7 +42,7 @@ SUBSYSTEM=="block", KERNEL=="sda", OPTIONS="log_level=debug"
|
||||
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="sda", ENV{SYSTEMD_WANTS}="waldo.service"
|
||||
EOF
|
||||
udevadm control --reload
|
||||
udevadm trigger /dev/sda
|
||||
udevadm trigger --settle /dev/sda
|
||||
|
||||
while : ; do
|
||||
(
|
||||
@ -58,7 +58,7 @@ done
|
||||
rm /run/udev/rules.d/50-testsuite.rules
|
||||
|
||||
udevadm control --reload
|
||||
udevadm trigger /dev/sda
|
||||
udevadm trigger --settle /dev/sda
|
||||
|
||||
while : ; do
|
||||
(
|
||||
|
@ -8,10 +8,10 @@ setup() {
|
||||
mkdir -p "${test_rule%/*}"
|
||||
cp -f /etc/udev/udev.conf /etc/udev/udev.conf.bckp
|
||||
cat >"${test_rule}" <<EOF
|
||||
SUBSYSTEM=="net", KERNEL=="lo", OPTIONS="log_level=debug"
|
||||
SUBSYSTEM=="net", KERNEL=="lo", PROGRAM=="/bin/sleep 60"
|
||||
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
|
||||
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", PROGRAM=="/bin/sleep 60"
|
||||
EOF
|
||||
echo "event_timeout=30" >>/etc/udev/udev.conf
|
||||
echo "event_timeout=10" >>/etc/udev/udev.conf
|
||||
echo "timeout_signal=SIGABRT" >>/etc/udev/udev.conf
|
||||
|
||||
systemctl restart systemd-udevd.service
|
||||
@ -28,13 +28,13 @@ teardown() {
|
||||
run_test() {
|
||||
since="$(date +%T)"
|
||||
|
||||
echo add >/sys/class/net/lo/uevent
|
||||
udevadm trigger -w --action add /dev/null
|
||||
|
||||
for _ in {1..20}; do
|
||||
sleep 5
|
||||
if coredumpctl --since "$since" --no-legend --no-pager | grep /bin/udevadm ; then
|
||||
return 0
|
||||
fi
|
||||
sleep .5
|
||||
done
|
||||
|
||||
return 1
|
||||
|
@ -15,42 +15,34 @@ ACTION=="change", SUBSYSTEM=="mem", KERNEL=="null", TAG+="changed"
|
||||
EOF
|
||||
|
||||
udevadm control --reload
|
||||
udevadm trigger -c add /dev/null
|
||||
udevadm trigger --settle --action add /dev/null
|
||||
|
||||
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
|
||||
sleep .5
|
||||
done
|
||||
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; }
|
||||
|
||||
udevadm trigger --settle --action change /dev/null
|
||||
|
||||
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:.*'
|
||||
|
||||
udevadm trigger --settle --action add /dev/null
|
||||
|
||||
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
|
||||
udevadm control --reload
|
||||
udevadm trigger -c change /dev/null
|
||||
|
||||
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
|
||||
sleep .5
|
||||
done
|
||||
|
||||
udevadm control --reload
|
||||
udevadm trigger -c add /dev/null
|
||||
|
||||
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
|
||||
sleep .5
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@ -10,15 +10,13 @@ ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", IMPORT{program}="/bin/echo -e H
|
||||
EOF
|
||||
|
||||
udevadm control --reload
|
||||
udevadm trigger -c add /dev/null
|
||||
udevadm trigger --settle --action add /dev/null
|
||||
|
||||
while : ; do
|
||||
test -f /run/udev/data/c1:3 &&
|
||||
udevadm info /dev/null | grep -q 'E: HOGE=aa\\x20\\x20\\x20bb' &&
|
||||
udevadm info /dev/null | grep -q 'E: FOO=\\x20aaa\\x20' &&
|
||||
break
|
||||
test -f /run/udev/data/c1:3
|
||||
udevadm info /dev/null | grep -q 'E: HOGE=aa\\x20\\x20\\x20bb'
|
||||
udevadm info /dev/null | grep -q 'E: FOO=\\x20aaa\\x20'
|
||||
|
||||
sleep .5
|
||||
done
|
||||
rm /run/udev/rules.d/50-testsuite.rules
|
||||
udevadm control --reload
|
||||
|
||||
exit 0
|
||||
|
@ -21,20 +21,15 @@ function check() {
|
||||
systemctl restart systemd-udevd.service
|
||||
udevadm control --ping
|
||||
udevadm settle
|
||||
sleep 1
|
||||
check_validity
|
||||
|
||||
for ((j=0;j<2;j++)); do
|
||||
udevadm trigger -w --action add --subsystem-match=block
|
||||
udevadm settle
|
||||
sleep 1
|
||||
check_validity
|
||||
done
|
||||
|
||||
for ((j=0;j<2;j++)); do
|
||||
udevadm trigger -w --action change --subsystem-match=block
|
||||
udevadm settle
|
||||
sleep 1
|
||||
check_validity
|
||||
done
|
||||
done
|
||||
@ -70,6 +65,5 @@ rm /run/udev/rules.d/00-debug.rules
|
||||
rm /run/udev/rules.d/50-testsuite.rules
|
||||
|
||||
udevadm control --reload
|
||||
udevadm trigger -w --action add --subsystem-match=block
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user