chiark / gitweb /
autogen.sh: add CFLAGS and print entire line, so that mouse copy/paste works
[elogind.git] / test / udev-test.pl
index 4322da5ecd202d0fbce2f2a6f998739b48c85a05..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,7 +439,6 @@ 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
@@ -494,7 +449,6 @@ 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
@@ -503,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
@@ -514,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",
@@ -524,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
@@ -537,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
@@ -550,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
@@ -560,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
@@ -570,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
@@ -579,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
@@ -588,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
@@ -597,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
@@ -607,7 +551,6 @@ EOF
        },
        {
                desc            => "permissions USER=bad GROUP=name",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/tty33",
                exp_name        => "tty33",
                exp_perms       => "0:0:0600",
@@ -617,7 +560,6 @@ 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::0600",
@@ -627,7 +569,6 @@ 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",
@@ -637,7 +578,6 @@ 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::0600",
@@ -647,7 +587,6 @@ 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",
@@ -657,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",
@@ -667,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",
@@ -677,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",
@@ -687,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::",
@@ -697,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",
@@ -707,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",
@@ -717,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",
@@ -727,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",
@@ -739,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",
@@ -753,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",
@@ -767,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",
@@ -777,7 +705,6 @@ EOF
        },
        {
                desc            => "big major number test",
-               subsys          => "misc",
                devpath         => "/devices/virtual/misc/misc-fake1",
                exp_name        => "node",
                exp_majorminor  => "4095:1",
@@ -787,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",
@@ -797,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
@@ -806,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    => " ",
@@ -816,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
@@ -856,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",
@@ -867,7 +766,6 @@ EOF
        },
        {
                desc            => "symlink node to itself",
-               subsys          => "tty",
                devpath         => "/devices/virtual/tty/tty0",
                exp_name        => "link",
                exp_add_error   => "yes",
@@ -879,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
@@ -888,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
@@ -897,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
@@ -906,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
@@ -925,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
@@ -934,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
@@ -943,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
@@ -952,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
@@ -961,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
@@ -970,7 +857,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        => "link4",
                rules           => <<EOF
@@ -979,7 +865,6 @@ 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
@@ -990,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
@@ -999,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
@@ -1008,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
@@ -1039,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
@@ -1049,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
@@ -1060,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
@@ -1071,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
@@ -1081,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
@@ -1091,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
@@ -1103,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
@@ -1116,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
@@ -1128,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
@@ -1141,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
@@ -1154,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
@@ -1172,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
@@ -1181,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
@@ -1190,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
@@ -1202,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",
@@ -1234,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",
@@ -1246,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
@@ -1255,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",
@@ -1267,7 +1105,6 @@ 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",
@@ -1279,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
@@ -1289,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
@@ -1300,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
@@ -1312,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
@@ -1325,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",
@@ -1346,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
@@ -1361,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
@@ -1372,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",
@@ -1384,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
@@ -1394,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
@@ -1403,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
@@ -1415,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
@@ -1424,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
@@ -1434,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
@@ -1443,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
@@ -1452,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
@@ -1461,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",
@@ -1472,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",
@@ -1484,7 +1302,6 @@ 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:0440",
@@ -1496,7 +1313,6 @@ 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:0600",
@@ -1504,30 +1320,34 @@ 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");
        }
 }
 
@@ -1596,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";
@@ -1642,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);
@@ -1672,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";
@@ -1694,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";
@@ -1733,6 +1511,7 @@ make_udev_root();
 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;