diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-11 08:34:13 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-14 14:04:53 +0900 |
commit | 8d80f275303385eb9e2452f97f9c11be5c196862 (patch) | |
tree | bea32045f40beec4b6fabe99b090dab6cbe9aad2 /test | |
parent | ba9385d91f4724dd55a655da153f3a89e7943b4e (diff) | |
download | systemd-8d80f275303385eb9e2452f97f9c11be5c196862.tar.gz |
sd-device: make TAGS= property prefixed and suffixed with ":"
The commit 6f3ac0d51766b0b9101676cefe5c4ba81feba436 drops the prefix and
suffix in TAGS= property. But there exists several rules that have like
`TAGS=="*:tag:*"`. So, the property must be always prefixed and suffixed
with ":".
Fixes #17930.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-55.sh | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/test/units/testsuite-55.sh b/test/units/testsuite-55.sh index 19f5683f57..ffceefb6a5 100755 --- a/test/units/testsuite-55.sh +++ b/test/units/testsuite-55.sh @@ -2,26 +2,14 @@ set -ex set -o pipefail -function has_tag_internal() { - udevadm info /dev/null | sed -n '/E: '$1'=/ {s/E: '$1'=/:/; s/$/:/; p}' | grep -q ":$2:" -} - -function has_tag() { - has_tag_internal TAGS $1 -} - -function has_current_tag() { - has_tag_internal CURRENT_TAGS $1 -} - mkdir -p /run/udev/rules.d/ ! test -f /run/udev/tags/added/c1:3 && ! test -f /run/udev/tags/changed/c1:3 && - ! has_tag added && - ! has_current_tag added && - ! has_tag changed && - ! has_current_tag changed + udevadm info /dev/null | grep -q -v 'E: TAGS=.*:added:.*' && + udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:added:.*' && + udevadm info /dev/null | grep -q -v 'E: TAGS=.*:changed:.*' && + udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:changed:.*' cat > /run/udev/rules.d/50-testsuite.rules <<EOF ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", TAG+="added" @@ -34,10 +22,10 @@ udevadm trigger -c add /dev/null while : ; do test -f /run/udev/tags/added/c1:3 && ! test -f /run/udev/tags/changed/c1:3 && - has_tag added && - has_current_tag added && - ! has_tag changed && - ! has_current_tag changed && + 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 -v 'E: TAGS=.*:changed:.*' && + udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:changed:.*' && break sleep .5 @@ -49,10 +37,10 @@ udevadm trigger -c change /dev/null while : ; do test -f /run/udev/tags/added/c1:3 && test -f /run/udev/tags/changed/c1:3 && - has_tag added && - ! has_current_tag added && - has_tag changed && - has_current_tag changed && + udevadm info /dev/null | grep -q 'E: TAGS=.*:added:.*' && + udevadm info /dev/null | grep -q -v 'E: CURRENT_TAGS=.*:added:.*' && + udevadm info /dev/null | grep -q 'E: TAGS=.*:changed:.*' && + udevadm info /dev/null | grep -q 'E: CURRENT_TAGS=.*:changed:.*' && break sleep .5 @@ -64,10 +52,10 @@ udevadm trigger -c add /dev/null while : ; do test -f /run/udev/tags/added/c1:3 && test -f /run/udev/tags/changed/c1:3 && - has_tag added && - has_current_tag added && - has_tag changed && - ! has_current_tag changed && + 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 -v 'E: CURRENT_TAGS=.*:changed:.*' && break sleep .5 |