chiark / gitweb /
allow multiple values to be matched with KEY=="value1|value2"
[elogind.git] / test / udev-test.pl
index bf6b62f10ab18e6d6ddc6bd402f0a19071914fcb..e8cb7c48a9d8659061d9773cab4becf77f03026d 100755 (executable)
@@ -264,7 +264,7 @@ EOF
                devpath         => "/block/sda",
                exp_name        => "subdir/sys/node" ,
                rules           => <<EOF
-BUS=="scsi", IMPORT="test.all", NAME="subdir%E{SYSFSDIR}/node"
+BUS=="scsi", IMPORT{file}="test.all", NAME="subdir%E{SYSFSDIR}/node"
 KERNEL=="ttyUSB0", NAME="visor"
 EOF
        },
@@ -274,7 +274,7 @@ EOF
                devpath         => "/block/sda",
                exp_name        => "node12345678",
                rules           => <<EOF
-BUS=="scsi", IMPORT{exec}="/bin/echo -e \' TEST_KEY=12345678  \\n  TEST_key2=98765 \'", NAME="node\$env{TEST_KEY}"
+BUS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678  \\n  TEST_key2=98765 \'", NAME="node\$env{TEST_KEY}"
 KERNEL=="ttyUSB0", NAME="visor"
 EOF
        },
@@ -799,6 +799,17 @@ EOF
                exp_target      => "ttyUSB0",
                rules           => <<EOF
 KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
+EOF
+       },
+       {
+               desc            => "multiple symlinks with a lot of s p a c e s",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "one",
+               not_exp_name    => " ",
+               exp_target      => "ttyUSB0",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="  one     two        "
 EOF
        },
        {
@@ -1090,7 +1101,8 @@ EOF
                desc            => "ignore rule test",
                subsys          => "block",
                devpath         => "/block/sda",
-               exp_name        => "node",
+               exp_name        => "nothing",
+               not_exp_name    => "node",
                exp_add_error   => "yes",
                rules           => <<EOF
 BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore"
@@ -1415,6 +1427,50 @@ KERNEL=="ttyUSB[0-9]*", SYMLINK+="one"
 KERNEL=="ttyUSB[0-9]*", SYMLINK+="two"
 KERNEL=="ttyUSB[0-9]*", SYMLINK="three"
 KERNEL=="ttyUSB[0-9]*", NAME="node"
+EOF
+       },
+       {
+               desc            => "test empty NAME",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "node",
+               not_exp_name    => "wrong",
+               exp_add_error   => "yes",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME=""
+KERNEL=="ttyUSB[0-9]*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test empty NAME 2",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME="right"
+KERNEL=="ttyUSB[0-9]*", NAME=""
+KERNEL=="ttyUSB[0-9]*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test multi matches",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="ttyUSB*|nothing", NAME="right"
+KERNEL=="ttyUSB*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test multi matches 2",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="dontknow*|*nothing", NAME="nomatch"
+KERNEL=="dontknow*|ttyUSB*|nothing*", NAME="right"
+KERNEL=="ttyUSB*", NAME="wrong"
 EOF
        },
 );