chiark / gitweb /
autogen.sh: add CFLAGS and print entire line, so that mouse copy/paste works
[elogind.git] / test / udev-test.pl
index aeca9486f7c9c2041c3d72b89d060cad1ee14138..999c1f76e300043bf0da1751fa4164f5f09ee853 100755 (executable)
 # After creation and removal the result is checked against the
 # expected value and the result is printed.
 #
-# Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
+# Copyright (C) 2004-2011 Kay Sievers <kay.sievers@vrfy.org>
 # Copyright (C) 2004 Leann Ogasawara <ogasawara@osdl.org>
 
 use warnings;
 use strict;
 
 my $PWD                        = $ENV{PWD};
-my $sysfs              = "test/sys/";
-my $udev_bin           = "udev/test-udev";
+my $sysfs              = "test/sys";
+my $udev_bin           = "src/test-udev";
 my $valgrind           = 0;
 my $udev_bin_valgrind  = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin";
-my $udev_root          = "udev-root/";
+my $udev_root          = "udev-root";
 my $udev_conf          = "udev-test.conf";
 my $udev_rules         = "udev-test.rules";
 
 my @tests = (
        {
                desc            => "no rules",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda" ,
                exp_rem_error   => "yes",
@@ -42,7 +41,6 @@ EOF
        },
        {
                desc            => "label test of scsi disc",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "boot_disk" ,
                rules           => <<EOF
@@ -52,7 +50,6 @@ EOF
        },
        {
                desc            => "label test of scsi disc",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "boot_disk" ,
                rules           => <<EOF
@@ -62,7 +59,6 @@ EOF
        },
        {
                desc            => "label test of scsi disc",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "boot_disk" ,
                rules           => <<EOF
@@ -72,7 +68,6 @@ EOF
        },
        {
                desc            => "label test of scsi partition",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "boot_disk1" ,
                rules           => <<EOF
@@ -81,7 +76,6 @@ EOF
        },
        {
                desc            => "label test of pattern match",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "boot_disk1" ,
                rules           => <<EOF
@@ -93,7 +87,6 @@ EOF
        },
        {
                desc            => "label test of multiple sysfs files",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "boot_disk1" ,
                rules           => <<EOF
@@ -103,7 +96,6 @@ EOF
        },
        {
                desc            => "label test of max sysfs files (skip invalid rule)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "boot_disk1" ,
                rules           => <<EOF
@@ -113,7 +105,6 @@ EOF
        },
        {
                desc            => "catch device by *",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem/0" ,
                rules           => <<EOF
@@ -122,7 +113,6 @@ EOF
        },
        {
                desc            => "catch device by * - take 2",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem/0" ,
                rules           => <<EOF
@@ -132,7 +122,6 @@ EOF
        },
        {
                desc            => "catch device by ?",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem/0" ,
                rules           => <<EOF
@@ -143,7 +132,6 @@ EOF
        },
        {
                desc            => "catch device by character class",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem/0" ,
                rules           => <<EOF
@@ -154,7 +142,6 @@ EOF
        },
        {
                desc            => "replace kernel name",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -163,7 +150,6 @@ EOF
        },
        {
                desc            => "Handle comment lines in config file (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -174,34 +160,31 @@ EOF
        },
        {
                desc            => "Handle comment lines in config file with whitespace (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
- # this is a comment with whitespace before the comment 
+ # this is a comment with whitespace before the comment
 KERNEL=="ttyACM0", SYMLINK+="modem"
 
 EOF
        },
        {
                desc            => "Handle whitespace only lines (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "whitespace" ,
                rules           => <<EOF
 
 
- # this is a comment with whitespace before the comment 
+
+ # this is a comment with whitespace before the comment
 KERNEL=="ttyACM0", SYMLINK+="whitespace"
 
+
 
 EOF
        },
        {
                desc            => "Handle empty lines in config file (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -212,7 +195,6 @@ EOF
        },
        {
                desc            => "Handle backslashed multi lines in config file (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -223,7 +205,6 @@ EOF
        },
        {
                desc            => "preserve backslashes, if they are not for a newline",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "aaa",
                rules           => <<EOF
@@ -232,7 +213,6 @@ EOF
        },
        {
                desc            => "Handle stupid backslashed multi lines in config file (and replace kernel name)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -251,7 +231,6 @@ EOF
        },
        {
                desc            => "subdirectory handling",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "sub/direct/ory/modem" ,
                rules           => <<EOF
@@ -260,7 +239,6 @@ EOF
        },
        {
                desc            => "parent device name match of scsi partition",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "first_disk5" ,
                rules           => <<EOF
@@ -269,7 +247,6 @@ EOF
        },
        {
                desc            => "test substitution chars",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" ,
                rules           => <<EOF
@@ -278,7 +255,6 @@ EOF
        },
        {
                desc            => "import of shell-value file",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "subdir/err/node" ,
                rules           => <<EOF
@@ -288,17 +264,15 @@ EOF
        },
        {
                desc            => "import of shell-value returned from program",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node12345678",
                rules           => <<EOF
-SUBSYSTEMS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678\\n  TEST_key2=98765\'", SYMLINK+="node\$env{TEST_KEY}"
+SUBSYSTEMS=="scsi", IMPORT{program}="/bin/echo -e \' TEST_KEY=12345678\\n  TEST_key2=98765\'", SYMLINK+="node\$env{TEST_KEY}"
 KERNEL=="ttyACM0", SYMLINK+="modem"
 EOF
        },
        {
                desc            => "sustitution of sysfs value (%s{file})",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "disk-ATA-sda" ,
                rules           => <<EOF
@@ -308,7 +282,6 @@ EOF
        },
        {
                desc            => "program result substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "special-device-5" ,
                not_exp_name    => "not" ,
@@ -319,7 +292,6 @@ EOF
        },
        {
                desc            => "program result substitution (newline removal)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "newline_removed" ,
                rules           => <<EOF
@@ -328,7 +300,6 @@ EOF
        },
        {
                desc            => "program result substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "test-0:0:0:0" ,
                rules           => <<EOF
@@ -337,7 +308,6 @@ EOF
        },
        {
                desc            => "program with lots of arguments",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "foo9" ,
                rules           => <<EOF
@@ -346,7 +316,6 @@ EOF
        },
        {
                desc            => "program with subshell",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "bar9" ,
                rules           => <<EOF
@@ -355,7 +324,6 @@ EOF
        },
        {
                desc            => "program arguments combined with apostrophes",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "foo7" ,
                rules           => <<EOF
@@ -364,7 +332,6 @@ EOF
        },
        {
                desc            => "characters before the %c{N} substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "my-foo9" ,
                rules           => <<EOF
@@ -373,7 +340,6 @@ EOF
        },
        {
                desc            => "substitute the second to last argument",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "my-foo8" ,
                rules           => <<EOF
@@ -382,7 +348,6 @@ EOF
        },
        {
                desc            => "test substitution by variable name",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
                rules           => <<EOF
@@ -391,7 +356,6 @@ EOF
        },
        {
                desc            => "test substitution by variable name 2",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
                rules           => <<EOF
@@ -400,7 +364,6 @@ EOF
        },
        {
                desc            => "test substitution by variable name 3",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "850:0:0:05" ,
                rules           => <<EOF
@@ -409,7 +372,6 @@ EOF
        },
        {
                desc            => "test substitution by variable name 4",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "855" ,
                rules           => <<EOF
@@ -418,7 +380,6 @@ EOF
        },
        {
                desc            => "test substitution by variable name 5",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "8550:0:0:0" ,
                rules           => <<EOF
@@ -427,7 +388,6 @@ EOF
        },
        {
                desc            => "non matching SUBSYSTEMS for device with no parent",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/console",
                exp_name        => "TTY",
                rules           => <<EOF
@@ -437,7 +397,6 @@ EOF
        },
        {
                desc            => "non matching SUBSYSTEMS",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/console",
                exp_name        => "TTY" ,
                rules           => <<EOF
@@ -447,7 +406,6 @@ EOF
        },
        {
                desc            => "ATTRS match",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/console",
                exp_name        => "foo" ,
                rules           => <<EOF
@@ -457,7 +415,6 @@ EOF
        },
        {
                desc            => "ATTR (empty file)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "empty" ,
                rules           => <<EOF
@@ -469,7 +426,6 @@ EOF
        },
        {
                desc            => "ATTR (non-existent file)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "non-existent" ,
                rules           => <<EOF
@@ -483,28 +439,16 @@ EOF
        },
        {
                desc            => "program and bus type match",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "scsi-0:0:0:0" ,
                rules           => <<EOF
 SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", SYMLINK+="%c"
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", SYMLINK+="%c"
 SUBSYSTEMS=="foo", PROGRAM=="/bin/echo -n foo-%b", SYMLINK+="%c"
-EOF
-       },
-       {
-               desc            => "create all possible partitions",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "sda15" ,
-               exp_majorminor  => "8:15",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", OPTIONS="all_partitions"
 EOF
        },
        {
                desc            => "sysfs parent hierarchy",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem" ,
                rules           => <<EOF
@@ -513,7 +457,6 @@ EOF
        },
        {
                desc            => "name test with ! in the name",
-               subsys          => "block",
                devpath         => "/devices/virtual/block/fake!blockdev0",
                exp_name        => "is/a/fake/blockdev0" ,
                rules           => <<EOF
@@ -524,7 +467,6 @@ EOF
        },
        {
                desc            => "name test with ! in the name, but no matching rule",
-               subsys          => "block",
                devpath         => "/devices/virtual/block/fake!blockdev0",
                exp_name        => "fake/blockdev0" ,
                exp_rem_error   => "yes",
@@ -534,7 +476,6 @@ EOF
        },
        {
                desc            => "KERNELS rule",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "scsi-0:0:0:0",
                rules           => <<EOF
@@ -547,7 +488,6 @@ EOF
        },
        {
                desc            => "KERNELS wildcard all",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "scsi-0:0:0:0",
                rules           => <<EOF
@@ -560,7 +500,6 @@ EOF
        },
        {
                desc            => "KERNELS wildcard partial",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "scsi-0:0:0:0",
                rules           => <<EOF
@@ -570,7 +509,6 @@ EOF
        },
        {
                desc            => "KERNELS wildcard partial 2",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "scsi-0:0:0:0",
                rules           => <<EOF
@@ -580,7 +518,6 @@ EOF
        },
        {
                desc            => "substitute attr with link target value (first match)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "driver-is-sd",
                rules           => <<EOF
@@ -589,7 +526,6 @@ EOF
        },
        {
                desc            => "substitute attr with link target value (currently selected device)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "driver-is-ahci",
                rules           => <<EOF
@@ -598,7 +534,6 @@ EOF
        },
        {
                desc            => "ignore ATTRS attribute whitespace",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "ignored",
                rules           => <<EOF
@@ -607,7 +542,6 @@ EOF
        },
        {
                desc            => "do not ignore ATTRS attribute whitespace",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "matched-with-space",
                rules           => <<EOF
@@ -617,27 +551,24 @@ EOF
        },
        {
                desc            => "permissions USER=bad GROUP=name",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/tty33",
                exp_name        => "tty33",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0600",
                rules           => <<EOF
 KERNEL=="tty33", SYMLINK+="tty33", OWNER="bad", GROUP="name"
 EOF
        },
        {
                desc            => "permissions OWNER=5000",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
-               exp_perms       => "5000::0660",
+               exp_perms       => "5000::0600",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OWNER="5000"
 EOF
        },
        {
                desc            => "permissions GROUP=100",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_perms       => ":100:0660",
@@ -647,17 +578,15 @@ EOF
        },
        {
                desc            => "textual user id",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
-               exp_perms       => "nobody::0660",
+               exp_perms       => "nobody::0600",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OWNER="nobody"
 EOF
        },
        {
                desc            => "textual group id",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_perms       => ":daemon:0660",
@@ -667,7 +596,6 @@ EOF
        },
        {
                desc            => "textual user/group id",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_perms       => "root:mail:0660",
@@ -677,7 +605,6 @@ EOF
        },
        {
                desc            => "permissions MODE=0777",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_perms       => "::0777",
@@ -687,7 +614,6 @@ EOF
        },
        {
                desc            => "permissions OWNER=5000 GROUP=100 MODE=0777",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_perms       => "5000:100:0777",
@@ -697,7 +623,6 @@ EOF
        },
        {
                desc            => "permissions OWNER to 5000",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "5000::",
@@ -707,7 +632,6 @@ EOF
        },
        {
                desc            => "permissions GROUP to 100",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => ":100:0660",
@@ -717,7 +641,6 @@ EOF
        },
        {
                desc            => "permissions MODE to 0060",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "::0060",
@@ -727,7 +650,6 @@ EOF
        },
        {
                desc            => "permissions OWNER, GROUP, MODE",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "5000:100:0777",
@@ -737,7 +659,6 @@ EOF
        },
        {
                desc            => "permissions only rule",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "5000:100:0777",
@@ -749,7 +670,6 @@ EOF
        },
        {
                desc            => "multiple permissions only rule",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "3000:4000:0777",
@@ -763,7 +683,6 @@ EOF
        },
        {
                desc            => "permissions only rule with override at SYMLINK+ rule",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "ttyACM0",
                exp_perms       => "3000:8000:0777",
@@ -777,7 +696,6 @@ EOF
        },
        {
                desc            => "major/minor number test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                exp_majorminor  => "8:0",
@@ -787,7 +705,6 @@ EOF
        },
        {
                desc            => "big major number test",
-               subsys          => "misc",
                devpath         => "/devices/virtual/misc/misc-fake1",
                exp_name        => "node",
                exp_majorminor  => "4095:1",
@@ -797,7 +714,6 @@ EOF
        },
        {
                desc            => "big major and big minor number test",
-               subsys          => "misc",
                devpath         => "/devices/virtual/misc/misc-fake89999",
                exp_name        => "node",
                exp_majorminor  => "4095:89999",
@@ -807,7 +723,6 @@ EOF
        },
        {
                desc            => "multiple symlinks with format char",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "symlink2-ttyACM0",
                rules           => <<EOF
@@ -816,7 +731,6 @@ EOF
        },
        {
                desc            => "multiple symlinks with a lot of s p a c e s",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "one",
                not_exp_name    => " ",
@@ -826,38 +740,14 @@ EOF
        },
        {
                desc            => "symlink creation (same directory)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "modem0",
                rules           => <<EOF
 KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK="modem%n"
-EOF
-       },
-       {
-               desc            => "symlink creation (relative link forward)",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6",
-               exp_name        => "1/2/symlink" ,
-               exp_target      => "a/b/node",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", NAME="1/2/a/b/node", SYMLINK+="1/2/symlink"
-EOF
-       },
-       {
-               desc            => "symlink creation (relative link back and forward)",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6",
-               exp_name        => "1/2/c/d/symlink" ,
-               exp_target      => "../../a/b/node",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", NAME="1/2/a/b/node", SYMLINK+="1/2/c/d/symlink"
 EOF
        },
        {
                desc            => "multiple symlinks",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "second-0" ,
                rules           => <<EOF
@@ -866,7 +756,6 @@ EOF
        },
        {
                desc            => "symlink name '.'",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => ".",
                exp_add_error   => "yes",
@@ -877,7 +766,6 @@ EOF
        },
        {
                desc            => "symlink node to itself",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/tty0",
                exp_name        => "link",
                exp_add_error   => "yes",
@@ -889,7 +777,6 @@ EOF
        },
        {
                desc            => "symlink %n substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "symlink0",
                rules           => <<EOF
@@ -898,7 +785,6 @@ EOF
        },
        {
                desc            => "symlink %k substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "symlink-ttyACM0",
                rules           => <<EOF
@@ -907,7 +793,6 @@ EOF
        },
        {
                desc            => "symlink %M:%m substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "major-166:0",
                rules           => <<EOF
@@ -916,17 +801,14 @@ EOF
        },
        {
                desc            => "symlink %b substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "symlink-0:0:0:0",
-               exp_target      => "node",
                rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", SYMLINK+="symlink-%b"
+SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="symlink-%b"
 EOF
        },
        {
                desc            => "symlink %c substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "test",
                rules           => <<EOF
@@ -935,7 +817,6 @@ EOF
        },
        {
                desc            => "symlink %c{N} substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "test",
                rules           => <<EOF
@@ -944,7 +825,6 @@ EOF
        },
        {
                desc            => "symlink %c{N+} substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "this",
                rules           => <<EOF
@@ -953,7 +833,6 @@ EOF
        },
        {
                desc            => "symlink only rule with %c{N+}",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "test",
                rules           => <<EOF
@@ -962,7 +841,6 @@ EOF
        },
        {
                desc            => "symlink %s{filename} substitution",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "166:0",
                rules           => <<EOF
@@ -971,7 +849,6 @@ EOF
        },
        {
                desc            => "program result substitution (numbered part of)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "link1",
                rules           => <<EOF
@@ -980,59 +857,14 @@ EOF
        },
        {
                desc            => "program result substitution (numbered part of+)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
                exp_name        => "link4",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", SYMLINK+="%c{2+}"
-EOF
-       },
-       {
-               desc            => "all_partitions, option-only rule",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "node6",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEM=="block", OPTIONS="all_partitions"
-SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node"
-EOF
-       },
-       {
-               desc            => "all_partitions, option-only rule (fail on partition)",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
-               exp_name        => "node6",
-               exp_add_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEM=="block", OPTIONS="all_partitions"
-SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node"
-EOF
-       },
-       {
-               desc            => "ignore remove event test",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "node",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OPTIONS="ignore_remove"
-EOF
-       },
-       {
-               desc            => "ignore remove event test (with all partitions)",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "sda14",
-               exp_rem_error   => "yes",
-               option          => "clean",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda", OPTIONS="ignore_remove, all_partitions"
 EOF
        },
        {
                desc            => "SUBSYSTEM match test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                rules           => <<EOF
@@ -1043,7 +875,6 @@ EOF
        },
        {
                desc            => "DRIVERS match test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                rules           => <<EOF
@@ -1052,8 +883,7 @@ SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", DRIVERS=="sd"
 EOF
        },
        {
-               desc            => "temporary node creation test",
-               subsys          => "block",
+               desc            => "devnode substitution test",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
                rules           => <<EOF
@@ -1061,29 +891,15 @@ SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" SYMLINK+="node
 EOF
        },
        {
-               desc            => "parent node name substitution test sequence 1/2 (keep)",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "main_device",
-               option          => "keep",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="main_device"
-EOF
-       },
-       {
-               desc            => "parent node name substitution test sequence 2/2 (clean)",
-               subsys          => "block",
+               desc            => "parent node name substitution test",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
-               exp_name        => "main_device-part-1",
-               option          => "clean",
+               exp_name        => "sda-part-1",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="%P-part-1"
 EOF
        },
        {
                desc            => "udev_root substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "start-udev-root-end",
                rules           => <<EOF
@@ -1092,7 +908,6 @@ EOF
        },
        {
                desc            => "last_rule option",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "last",
                rules           => <<EOF
@@ -1102,7 +917,6 @@ EOF
        },
        {
                desc            => "negation KERNEL!=",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "match",
                rules           => <<EOF
@@ -1113,7 +927,6 @@ EOF
        },
        {
                desc            => "negation SUBSYSTEM!=",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "not-anything",
                rules           => <<EOF
@@ -1124,7 +937,6 @@ EOF
        },
        {
                desc            => "negation PROGRAM!= exit code",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "nonzero-program",
                rules           => <<EOF
@@ -1134,7 +946,6 @@ EOF
        },
        {
                desc            => "test for whitespace between the operator",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "true",
                rules           => <<EOF
@@ -1144,7 +955,6 @@ EOF
        },
        {
                desc            => "ENV{} test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "true",
                rules           => <<EOF
@@ -1156,7 +966,6 @@ EOF
        },
        {
                desc            => "ENV{} test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "true",
                rules           => <<EOF
@@ -1169,7 +978,6 @@ EOF
        },
        {
                desc            => "ENV{} test (assign)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "true",
                rules           => <<EOF
@@ -1181,7 +989,6 @@ EOF
        },
        {
                desc            => "ENV{} test (assign 2 times)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "true",
                rules           => <<EOF
@@ -1194,7 +1001,6 @@ EOF
        },
        {
                desc            => "ENV{} test (assign2)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "part",
                rules           => <<EOF
@@ -1207,16 +1013,14 @@ EOF
        },
        {
                desc            => "untrusted string sanitize",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "sane",
                rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/sbin/badprogram)", RESULT=="name_ _/sbin/badprogram_", SYMLINK+="sane"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/usr/bin/badprogram)", RESULT=="name_ _/usr/bin/badprogram_", SYMLINK+="sane"
 EOF
        },
        {
                desc            => "untrusted string sanitize (don't replace utf8)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "uber",
                rules           => <<EOF
@@ -1225,7 +1029,6 @@ EOF
        },
        {
                desc            => "untrusted string sanitize (replace invalid utf8)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "replaced",
                rules           => <<EOF
@@ -1234,7 +1037,6 @@ EOF
        },
        {
                desc            => "read sysfs value from parent device",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "serial-354172020305000",
                rules           => <<EOF
@@ -1243,7 +1045,6 @@ EOF
        },
        {
                desc            => "match against empty key string",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "ok",
                rules           => <<EOF
@@ -1255,28 +1056,15 @@ EOF
        },
        {
                desc            => "check ACTION value",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "ok",
                rules           => <<EOF
 ACTION=="unknown", KERNEL=="sda", SYMLINK+="unknown-not-ok"
 ACTION=="add", KERNEL=="sda", SYMLINK+="ok"
-EOF
-       },
-       {
-               desc            => "test RUN key remove",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "testsymlink2",
-               exp_target      => "ok2",
-               rules           => <<EOF
-KERNEL=="sda", NAME="ok2", RUN+="/bin/ln -s ok2 %r/testsymlink2"
-KERNEL=="sda", ACTION=="remove", RUN+="/bin/rm -f %r/testsymlink2"
 EOF
        },
        {
                desc            => "final assignment",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "ok",
                exp_perms       => "root:tty:0640",
@@ -1287,7 +1075,6 @@ EOF
        },
        {
                desc            => "final assignment 2",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "ok",
                exp_perms       => "root:tty:0640",
@@ -1299,7 +1086,6 @@ EOF
        },
        {
                desc            => "env substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node-add-me",
                rules           => <<EOF
@@ -1308,7 +1094,6 @@ EOF
        },
        {
                desc            => "reset list to current value",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "three",
                not_exp_name    => "two",
@@ -1316,22 +1101,10 @@ EOF
 KERNEL=="ttyACM[0-9]*", SYMLINK+="one"
 KERNEL=="ttyACM[0-9]*", SYMLINK+="two"
 KERNEL=="ttyACM[0-9]*", SYMLINK="three"
-EOF
-       },
-       {
-               desc            => "test empty NAME",
-               subsys          => "tty",
-               devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
-               exp_name        => "<none>",
-               not_exp_name    => "ttyACM0",
-               exp_add_error   => "yes",
-               rules           => <<EOF
-KERNEL=="ttyACM[0-9]*", NAME=""
 EOF
        },
        {
                desc            => "test empty SYMLINK+ (empty override)",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "right",
                not_exp_name    => "wrong",
@@ -1343,7 +1116,6 @@ EOF
        },
        {
                desc            => "test multi matches",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "right",
                rules           => <<EOF
@@ -1353,7 +1125,6 @@ EOF
        },
        {
                desc            => "test multi matches 2",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "right",
                rules           => <<EOF
@@ -1364,7 +1135,6 @@ EOF
        },
        {
                desc            => "test multi matches 3",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "right",
                rules           => <<EOF
@@ -1376,7 +1146,6 @@ EOF
        },
        {
                desc            => "test multi matches 4",
-               subsys          => "tty",
                devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                exp_name        => "right",
                rules           => <<EOF
@@ -1389,18 +1158,16 @@ EOF
        },
        {
                desc            => "IMPORT parent test sequence 1/2 (keep)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "parent",
                option          => "keep",
                rules           => <<EOF
-KERNEL=="sda", IMPORT="/bin/echo -e \'PARENT_KEY=parent_right\\nWRONG_PARENT_KEY=parent_wrong'"
+KERNEL=="sda", IMPORT{program}="/bin/echo -e \'PARENT_KEY=parent_right\\nWRONG_PARENT_KEY=parent_wrong'"
 KERNEL=="sda", SYMLINK+="parent"
 EOF
        },
        {
                desc            => "IMPORT parent test sequence 2/2 (keep)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "parentenv-parent_right",
                option          => "clean",
@@ -1410,7 +1177,6 @@ EOF
        },
        {
                desc            => "GOTO test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "right",
                rules           => <<EOF
@@ -1425,7 +1191,6 @@ EOF
        },
        {
                desc            => "GOTO label does not exist",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "right",
                rules           => <<EOF
@@ -1436,7 +1201,6 @@ EOF
        },
        {
                desc            => "SYMLINK+ compare test",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "right",
                not_exp_name    => "wrong",
@@ -1448,7 +1212,6 @@ EOF
        },
        {
                desc            => "invalid key operation",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "yes",
                rules           => <<EOF
@@ -1458,7 +1221,6 @@ EOF
        },
        {
                desc            => "operator chars in attribute",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "yes",
                rules           => <<EOF
@@ -1467,7 +1229,6 @@ EOF
        },
        {
                desc            => "overlong comment line",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
                exp_name        => "yes",
                rules           => <<EOF
@@ -1479,7 +1240,6 @@ EOF
        },
        {
                desc            => "magic subsys/kernel lookup",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "00:16:41:e2:8d:ff",
                rules           => <<EOF
@@ -1488,7 +1248,6 @@ EOF
        },
        {
                desc            => "TEST absolute path",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "there",
                rules           => <<EOF
@@ -1498,7 +1257,6 @@ EOF
        },
        {
                desc            => "TEST subsys/kernel lookup",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "yes",
                rules           => <<EOF
@@ -1507,7 +1265,6 @@ EOF
        },
        {
                desc            => "TEST relative path",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "relative",
                rules           => <<EOF
@@ -1516,7 +1273,6 @@ EOF
        },
        {
                desc            => "TEST wildcard substitution (find queue/nr_requests)",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "found-subdir",
                rules           => <<EOF
@@ -1525,7 +1281,6 @@ EOF
        },
        {
                desc            => "TEST MODE=0000",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda",
                exp_perms       => "0:0:0000",
@@ -1536,7 +1291,6 @@ EOF
        },
        {
                desc            => "TEST PROGRAM feeds OWNER, GROUP, MODE",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda",
                exp_perms       => "5000:100:0400",
@@ -1548,10 +1302,9 @@ EOF
        },
        {
                desc            => "TEST PROGRAM feeds MODE with overflow",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0440",
                exp_rem_error   => "yes",
                rules           => <<EOF
 KERNEL=="sda", MODE="440"
@@ -1560,38 +1313,41 @@ EOF
        },
        {
                desc            => "magic [subsys/sysname] attribute substitution",
-               subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda-8741C4G-end",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0600",
                rules           => <<EOF
 KERNEL=="sda", PROGRAM="/bin/true create-envp"
 KERNEL=="sda", ENV{TESTENV}="change-envp"
 KERNEL=="sda", SYMLINK+="%k-%s{[dmi/id]product_name}-end", RUN+="socket:@/org/kernel/udev/monitor"
+EOF
+       },
+       {
+               desc            => "builtin path_id",
+               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
+               exp_name        => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0",
+               rules           => <<EOF
+KERNEL=="sda", IMPORT{builtin}="path_id"
+KERNEL=="sda", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/\$env{ID_PATH}"
 EOF
        },
 );
 
 # set env
-$ENV{SYSFS_PATH} = $sysfs;
 $ENV{UDEV_CONFIG_FILE} = $udev_conf;
 
 sub udev {
-       my ($action, $subsys, $devpath, $rules) = @_;
-
-       $ENV{DEVPATH} = $devpath;
+       my ($action, $devpath, $rules) = @_;
 
        # create temporary rules
        open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules";
        print CONF $$rules;
        close CONF;
 
-       $ENV{ACTION} = $action;
-       $ENV{SUBSYSTEM} = $subsys;
        if ($valgrind > 0) {
-               system("$udev_bin_valgrind");
+               system("$udev_bin_valgrind $action $devpath");
        } else {
-               system("$udev_bin");
+               system("$udev_bin $action $devpath");
        }
 }
 
@@ -1660,39 +1416,6 @@ sub major_minor_test {
        }
 }
 
-sub symlink_test {
-       my ($rules) = @_;
-
-       my $output = `ls -l $PWD/$udev_root$rules->{exp_name}`;
-
-       if ($output =~ m/(.*)-> (.*)/) {
-               if ($2 eq $rules->{exp_target}) {
-                       print "symlink:     ok\n";
-               } else {
-                       print "  expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n";
-                       print "  created symlink from: \'$rules->{exp_name}\' to \'$2\'\n";
-                       print "symlink: error";
-                       if ($rules->{exp_add_error}) {
-                               print " as expected\n";
-                       } else {
-                               print "\n";
-                               $error++;
-                               sleep(1);
-                       }
-               }
-       } else {
-               print "  expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n";
-               print "symlink:     not created";
-               if ($rules->{exp_add_error}) {
-                       print " as expected\n";
-               } else {
-                       print "\n";
-                       $error++;
-                       sleep(1);
-               }
-       }
-}
-
 sub make_udev_root {
        system("rm -rf $udev_root");
        mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
@@ -1706,29 +1429,23 @@ sub run_test {
        my ($rules, $number) = @_;
 
        print "TEST $number: $rules->{desc}\n";
+       print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n";
 
-       if ($rules->{exp_target}) {
-               print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n";
-       } else {
-               print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n";
-       }
-
-
-       udev("add", $rules->{subsys}, $rules->{devpath}, \$rules->{rules});
+       udev("add", $rules->{devpath}, \$rules->{rules});
        if (defined($rules->{not_exp_name})) {
-               if ((-e "$PWD/$udev_root$rules->{not_exp_name}") ||
-                   (-l "$PWD/$udev_root$rules->{not_exp_name}")) {
+               if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") ||
+                   (-l "$PWD/$udev_root/$rules->{not_exp_name}")) {
                        print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n";
                        $error++;
                        sleep(1);
                }
        }
 
-       if ((-e "$PWD/$udev_root$rules->{exp_name}") ||
-           (-l "$PWD/$udev_root$rules->{exp_name}")) {
+       if ((-e "$PWD/$udev_root/$rules->{exp_name}") ||
+           (-l "$PWD/$udev_root/$rules->{exp_name}")) {
 
                my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
-                   $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}");
+                   $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}");
 
                if (defined($rules->{exp_perms})) {
                        permissions_test($rules, $uid, $gid, $mode);
@@ -1736,9 +1453,6 @@ sub run_test {
                if (defined($rules->{exp_majorminor})) {
                        major_minor_test($rules, $rdev);
                }
-               if (defined($rules->{exp_target})) {
-                       symlink_test($rules);
-               }
                print "add:         ok\n";
        } else {
                print "add:         error";
@@ -1758,9 +1472,9 @@ sub run_test {
                return;
        }
 
-       udev("remove", $rules->{subsys}, $rules->{devpath}, \$rules->{rules});
-       if ((-e "$PWD/$udev_root$rules->{exp_name}") ||
-           (-l "$PWD/$udev_root$rules->{exp_name}")) {
+       udev("remove", $rules->{devpath}, \$rules->{rules});
+       if ((-e "$PWD/$udev_root/$rules->{exp_name}") ||
+           (-l "$PWD/$udev_root/$rules->{exp_name}")) {
                print "remove:      error";
                if ($rules->{exp_rem_error}) {
                        print " as expected\n";
@@ -1796,6 +1510,8 @@ make_udev_root();
 # create config file
 open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
 print CONF "udev_root=\"$udev_root\"\n";
+print CONF "udev_run=\"$udev_root/.udev\"\n";
+print CONF "udev_sys=\"$sysfs\"\n";
 print CONF "udev_rules=\"$PWD\"\n";
 print CONF "udev_log=\"err\"\n";
 close CONF;