summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@strace.io>2023-03-20 08:00:00 +0000
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-03-21 09:34:50 +0900
commitf0a16c9ae8cc9fd7719e58cc3b858ced64bd67da (patch)
tree661d37eb1ca60f461a58776e02b99d86b6e1c863 /test
parent92035969e0d75295eece85b4371f460ec7d60e4f (diff)
downloadsystemd-f0a16c9ae8cc9fd7719e58cc3b858ced64bd67da.tar.gz
udev-rules: add another check for conflicting expressions
Log an error when a rule line contains the following kind of conflicting match expressions: KEY=="foo", KEY=="bar"
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/testsuite-17.11.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/units/testsuite-17.11.sh b/test/units/testsuite-17.11.sh
index 5f067f02b2..88172acde6 100755
--- a/test/units/testsuite-17.11.sh
+++ b/test/units/testsuite-17.11.sh
@@ -278,6 +278,7 @@ test_syntax_error 'a="b"' "Invalid key 'a'"
test_syntax_error 'KERNEL=="", KERNEL=="?*", NAME="a"' 'conflicting match expressions, the line takes no effect'
test_syntax_error 'KERNEL=="abc", KERNEL!="abc", NAME="b"' 'conflicting match expressions, the line takes no effect'
test_syntax_error 'KERNEL=="|a|b", KERNEL!="b|a|", NAME="c"' 'conflicting match expressions, the line takes no effect'
+test_syntax_error 'KERNEL=="a|b", KERNEL=="c|d|e", NAME="f"' 'conflicting match expressions, the line takes no effect'
# shellcheck disable=SC2016
test_syntax_error 'ENV{DISKSEQ}=="?*", ENV{DEVTYPE}!="partition", ENV{DISKSEQ}!="?*" ENV{ID_IGNORE_DISKSEQ}!="1", SYMLINK+="disk/by-diskseq/$env{DISKSEQ}"' \
'conflicting match expressions, the line takes no effect'
@@ -290,6 +291,8 @@ test_syntax_error 'ENV{DISKSEQ}=="?*", ENV{DEVTYPE}!="partition", ENV{DISKSEQ}==
cat >"${rules}" <<'EOF'
KERNEL=="a|b", KERNEL=="a|c", NAME="d"
KERNEL=="a|b", KERNEL!="a|c", NAME="d"
+KERNEL!="a", KERNEL!="b", NAME="c"
+KERNEL=="|a", KERNEL=="|b", NAME="c"
EOF
assert_0 "${rules}"