chiark / gitweb /
accept relative path for TEST
[elogind.git] / test / udev-test.pl
index 54c33783928ac570a1216d80a2a03c9ada159476..fe1c6da4f9391ee4c0459081b1a5a87bb3ea9ec6 100755 (executable)
@@ -22,7 +22,7 @@ use strict;
 
 my $PWD                = $ENV{PWD};
 my $sysfs      = "sys/";
-my $udev_bin   = "../udev";
+my $udev_bin   = "../test-udev";
 my $udev_root  = "udev-root/"; # !!! directory will be removed !!!
 my $udev_conf  = "udev-test.conf";
 my $udev_rules = "udev-test.rules";
@@ -302,7 +302,7 @@ EOF
                devpath         => "/block/sda",
                exp_name        => "node12345678",
                rules           => <<EOF
-SUBSYSTEMS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678  \\n  TEST_key2=98765 \'", NAME="node\$env{TEST_KEY}"
+SUBSYSTEMS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678\\n  TEST_key2=98765\'", NAME="node\$env{TEST_KEY}"
 KERNEL=="ttyUSB0", NAME="visor"
 EOF
        },
@@ -1015,26 +1015,6 @@ EOF
                exp_target      => "ttyUSB0",
                rules           => <<EOF
 KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="%3s{dev}"
-EOF
-       },
-       {
-               desc            => "symlink with '%' in name",
-               subsys          => "tty",
-               devpath         => "/class/tty/ttyUSB0",
-               exp_name        => "percent%sign",
-               exp_target      => "ttyUSB0",
-               rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="percent%%sign"
-EOF
-       },
-       {
-               desc            => "symlink with '%' in name",
-               subsys          => "tty",
-               devpath         => "/class/tty/ttyUSB0",
-               exp_name        => "%ttyUSB0_name",
-               exp_target      => "ttyUSB0",
-               rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="%%%k_name"
 EOF
        },
        {
@@ -1556,8 +1536,17 @@ EOF
                devpath         => "/block/sda/sda1",
                exp_name        => "yes",
                rules           => <<EOF
-KERNEL="sda1", NAME=="no"
+KERNEL="sda1", NAME="no"
 KERNEL=="sda1", NAME="yes"
+EOF
+       },
+       {
+               desc            => "operator chars in attribute",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "yes",
+               rules           => <<EOF
+KERNEL=="sda", ATTR{test:colon+plus}=="?*", NAME="yes"
 EOF
        },
        {
@@ -1570,6 +1559,43 @@ EOF
    # 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
 KERNEL="sda1", NAME=="no"
 KERNEL=="sda1", NAME="yes"
+EOF
+       },
+       {
+               desc            => "magic subsys/kernel lookup",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "00:e0:00:fb:04:e1",
+               rules           => <<EOF
+KERNEL=="sda", NAME="\$attr{[net/eth0]address}"
+EOF
+       },
+       {
+               desc            => "TEST absolute path",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "there",
+               rules           => <<EOF
+TEST=="/etc/hosts", NAME="there"
+NAME="notthere"
+EOF
+       },
+       {
+               desc            => "TEST subsys/kernel lookup",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "yes",
+               rules           => <<EOF
+KERNEL=="sda", TEST=="[net/eth0]", NAME="yes"
+EOF
+       },
+       {
+               desc            => "TEST relative path",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "relative",
+               rules           => <<EOF
+KERNEL=="sda", TEST=="size", NAME="relative"
 EOF
        },
 );