summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2003-12-03 06:22:53 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:05 -0700
commit9f1da3613897346b6a45e1f7a706d2315bc0f420 (patch)
treefceae25269b8a8b2ffe19c74700a9166e0810197 /test
parent4865de442901cefebb7be889aa61233d8777b413 (diff)
[PATCH] pattern matching for namedev
As promised yesterday, here is a patch to implement a more advanced pattern matching instead of the simple '*'. We can remove the "tty"="tty" line from udev.rules now and replace "tty*" by "tty[0-9]*" to catch only the vc's. implement pattern matching in namedev '*' - to match zero or more chars '?' - to match exactly one char '[]' - character classes with ranges '[0-9]'and negation [!A]
Diffstat (limited to 'test')
-rw-r--r--test/udev-test.pl26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 8af09a027b..47190f6e5d 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -51,7 +51,7 @@ LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n"
EOF
},
{
- desc => "catch device by wildcard",
+ desc => "catch device by *",
subsys => "tty",
devpath => "class/tty/ttyUSB0",
expected => "visor/0" ,
@@ -60,6 +60,28 @@ REPLACE, KERNEL="ttyUSB*", NAME="visor/%n"
EOF
},
{
+ desc => "catch device by ?",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "visor/0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB??*", NAME="visor/%n-1"
+REPLACE, KERNEL="ttyUSB??", NAME="visor/%n-2"
+REPLACE, KERNEL="ttyUSB?", NAME="visor/%n"
+EOF
+ },
+ {
+ desc => "catch device by character class",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "visor/0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB[A-Z]*", NAME="visor/%n-1"
+REPLACE, KERNEL="ttyUSB?[0-9]", NAME="visor/%n-2"
+REPLACE, KERNEL="ttyUSB[0-9]*", NAME="visor/%n"
+EOF
+ },
+ {
desc => "replace kernel name",
subsys => "tty",
devpath => "class/tty/ttyUSB0",
@@ -96,7 +118,7 @@ TOPOLOGY, BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:b
EOF
},
{
- desc => "callout result substitution, only last should match",
+ desc => "callout result substitution",
subsys => "block",
devpath => "block/sda/sda3",
expected => "special-device-3" ,