chiark / gitweb /
fix tests and remove no longer useful stuff
[elogind.git] / test / udev-test.pl
old mode 100644 (file)
new mode 100755 (executable)
index 5d7c5e5..2549c7e
@@ -241,7 +241,7 @@ BUS=="scsi", ID=="0:0:0:0", NAME="first_disk%n"
 EOF
        },
        {
-               desc            => "test NAME substitution chars",
+               desc            => "test substitution chars",
                subsys          => "block",
                devpath         => "/block/sda/sda3",
                exp_name        => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
@@ -250,12 +250,32 @@ BUS=="scsi", ID=="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
 EOF
        },
        {
-               desc            => "test NAME substitution chars (with length limit)",
+               desc            => "test substitution chars (with length limit)",
                subsys          => "block",
                devpath         => "/block/sda/sda3",
                exp_name        => "M8-m3-n3-b0:0-sIBM" ,
                rules           => <<EOF
 BUS=="scsi", ID=="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
+EOF
+       },
+       {
+               desc            => "import of shell-value file",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "subdir/info/node" ,
+               rules           => <<EOF
+BUS=="scsi", IMPORT{file}="udev-test.conf", NAME="subdir/%E{udev_log}/node"
+KERNEL=="ttyUSB0", NAME="visor"
+EOF
+       },
+       {
+               desc            => "import of shell-value returned from program",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "node12345678",
+               rules           => <<EOF
+BUS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678  \\n  TEST_key2=98765 \'", NAME="node\$env{TEST_KEY}"
+KERNEL=="ttyUSB0", NAME="visor"
 EOF
        },
        {
@@ -360,6 +380,51 @@ EOF
                exp_name        => "my-foo8" ,
                rules           => <<EOF
 BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{6}"
+EOF
+       },
+       {
+               desc            => "test substitution by variable name",
+               subsys          => "block",
+               devpath         => "/block/sda/sda3",
+               exp_name        => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" ,
+               rules           => <<EOF
+BUS=="scsi", ID=="0:0:0:0", NAME="Major:\$major-minor:\$minor-kernelnumber:\$number-bus:\$id"
+EOF
+       },
+       {
+               desc            => "test substitution by variable name 2",
+               subsys          => "block",
+               devpath         => "/block/sda/sda3",
+               exp_name        => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" ,
+               rules           => <<EOF
+BUS=="scsi", ID=="0:0:0:0", DEVPATH="*/sda/*", NAME="Major:\$major-minor:%m-kernelnumber:\$number-bus:%b"
+EOF
+       },
+       {
+               desc            => "test substitution by variable name 3",
+               subsys          => "block",
+               devpath         => "/block/sda/sda3",
+               exp_name        => "830:0:0:03" ,
+               rules           => <<EOF
+BUS=="scsi", ID=="0:0:0:0", DEVPATH="*/sda/*", NAME="%M%m%b%n"
+EOF
+       },
+       {
+               desc            => "test substitution by variable name 4",
+               subsys          => "block",
+               devpath         => "/block/sda/sda3",
+               exp_name        => "833" ,
+               rules           => <<EOF
+BUS=="scsi", ID=="0:0:0:0", DEVPATH="*/sda/*", NAME="\$major\$minor\$number"
+EOF
+       },
+       {
+               desc            => "test substitution by variable name 5",
+               subsys          => "block",
+               devpath         => "/block/sda/sda3",
+               exp_name        => "8330:0:0:0" ,
+               rules           => <<EOF
+BUS=="scsi", ID=="0:0:0:0", DEVPATH="*/sda/*", NAME="\$major%m%n\$id"
 EOF
        },
        {
@@ -418,6 +483,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda",
                exp_name        => "boot_disk15" ,
+               exp_majorminor  => "8:15",
                rules           => <<EOF
 BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME{all_partitions}="boot_disk"
 EOF
@@ -733,6 +799,17 @@ EOF
                exp_target      => "ttyUSB0",
                rules           => <<EOF
 KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
+EOF
+       },
+       {
+               desc            => "multiple symlinks with a lot of s p a c e s",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "one",
+               not_exp_name    => " ",
+               exp_target      => "ttyUSB0",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="  one     two        "
 EOF
        },
        {
@@ -782,9 +859,9 @@ EOF
                exp_name        => "symlink-only2",
                exp_target      => "link",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda", SYMLINK="symlink-only1"
-BUS=="scsi", KERNEL=="sda", SYMLINK="symlink-only2"
-BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="symlink0"
+BUS=="scsi", KERNEL=="sda", SYMLINK+="symlink-only1"
+BUS=="scsi", KERNEL=="sda", SYMLINK+="symlink-only2"
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="symlink0"
 EOF
        },
        {
@@ -796,7 +873,7 @@ EOF
                exp_add_error   => "yes",
                exp_rem_error   => "yes",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="."
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="."
 EOF
        },
        {
@@ -806,9 +883,9 @@ EOF
                exp_name        => "link",
                exp_target      => "link",
                exp_rem_error   => "yes",
-               option          => "clear",
+               option          => "clean",
                rules           => <<EOF
-KERNEL=="tty0", NAME="link", SYMLINK="link"
+KERNEL=="tty0", NAME="link", SYMLINK+="link"
 EOF
        },
        {
@@ -818,7 +895,7 @@ EOF
                exp_name        => "symlink0",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink%n"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="symlink%n"
 EOF
        },
        {
@@ -828,7 +905,7 @@ EOF
                exp_name        => "symlink-ttyUSB0",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink-%k"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="symlink-%k"
 EOF
        },
        {
@@ -838,7 +915,7 @@ EOF
                exp_name        => "major-188:0",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="major-%M:%m"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="major-%M:%m"
 EOF
        },
        {
@@ -848,7 +925,7 @@ EOF
                exp_name        => "symlink-0:0:0:0",
                exp_target      => "node",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", SYMLINK="symlink-%b"
+BUS=="scsi", KERNEL=="sda", NAME="node", SYMLINK+="symlink-%b"
 EOF
        },
        {
@@ -858,7 +935,7 @@ EOF
                exp_name        => "test",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo test" NAME="ttyUSB%n", SYMLINK="%c"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo test" NAME="ttyUSB%n", SYMLINK+="%c"
 EOF
        },
        {
@@ -868,7 +945,7 @@ EOF
                exp_name        => "test",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2}"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK+="%c{2}"
 EOF
        },
        {
@@ -878,7 +955,7 @@ EOF
                exp_name        => "this",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2+}"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK+="%c{2+}"
 EOF
        },
        {
@@ -888,8 +965,8 @@ EOF
                exp_name        => "test",
                exp_target      => "link",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK="%c{2+}"
-BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="symlink0"
+BUS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK+="%c{2+}"
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="symlink0"
 EOF
        },
        {
@@ -899,7 +976,7 @@ EOF
                exp_name        => "188:0",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%s{dev}"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="%s{dev}"
 EOF
        },
        {
@@ -909,7 +986,7 @@ EOF
                exp_name        => "188",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%3s{dev}"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="%3s{dev}"
 EOF
        },
        {
@@ -919,7 +996,7 @@ EOF
                exp_name        => "percent%sign",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="percent%%sign"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="percent%%sign"
 EOF
        },
        {
@@ -929,7 +1006,7 @@ EOF
                exp_name        => "%ttyUSB0_name",
                exp_target      => "ttyUSB0",
                rules           => <<EOF
-KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%%%k_name"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK+="%%%k_name"
 EOF
        },
        {
@@ -939,7 +1016,7 @@ EOF
                exp_name        => "link1",
                exp_target      => "node",
                rules           => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", NAME="%c{1}", SYMLINK="%c{2} %c{3}"
+BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", NAME="%c{1}", SYMLINK+="%c{2} %c{3}"
 EOF
        },
        {
@@ -949,7 +1026,7 @@ EOF
                exp_name        => "link4",
                exp_target      => "node",
                rules           => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", NAME="%c{1}", SYMLINK="%c{2+}"
+BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", NAME="%c{1}", SYMLINK+="%c{2+}"
 EOF
        },
        {
@@ -1006,7 +1083,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda/sda4",
                exp_name        => "cdrom2",
-               option          => "clear",
+               option          => "clean",
                rules           => <<EOF
 KERNEL=="sda4", NAME="cdrom%e"
 EOF
@@ -1024,7 +1101,8 @@ EOF
                desc            => "ignore rule test",
                subsys          => "block",
                devpath         => "/block/sda",
-               exp_name        => "node",
+               exp_name        => "nothing",
+               not_exp_name    => "node",
                exp_add_error   => "yes",
                rules           => <<EOF
 BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore"
@@ -1067,7 +1145,7 @@ EOF
                devpath         => "/block/sda",
                exp_name        => "node14",
                exp_rem_error   => "yes",
-               option          => "clear",
+               option          => "clean",
                rules           => <<EOF
 BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
 EOF
@@ -1146,7 +1224,7 @@ EOF
                devpath         => "/block/sda/sda1",
                exp_name        => "last",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda1", SYMLINK="last", OPTIONS="last_rule"
+BUS=="scsi", KERNEL=="sda1", SYMLINK+="last", OPTIONS="last_rule"
 BUS=="scsi", KERNEL=="sda1", NAME="very-last"
 EOF
        },
@@ -1213,6 +1291,31 @@ BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong"
 BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="yes", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sdax1", NAME="no"
 BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sda1", NAME="true"
 BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad"
+EOF
+       },
+       {
+               desc            => "ENV{} test (assign)",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "true",
+               rules           => <<EOF
+BUS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
+BUS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="yes", NAME="no"
+BUS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="true", NAME="true"
+BUS=="scsi", KERNEL=="sda1", NAME="bad"
+EOF
+       },
+       {
+               desc            => "ENV{} test (assign2)",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "part",
+               rules           => <<EOF
+SUBSYSTEM=="block", KERNEL="*[0-9]", ENV{PARTITION}="true", ENV{MAINDEVICE}="false"
+SUBSYSTEM=="block", KERNEL="*[!0-9]", ENV{PARTITION}="false", ENV{MAINDEVICE}="true"
+ENV{MAINDEVICE}=="true", NAME="disk"
+ENV{PARTITION}=="true", NAME="part"
+NAME="bad"
 EOF
        },
        {
@@ -1221,7 +1324,230 @@ EOF
                devpath         => "/block/sda/sda1",
                exp_name        => "sane",
                rules           => <<EOF
-BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/sbin/badprogram)", RESULT="name_ _/sbin/badprogram_", NAME="sane"
+BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/sbin/badprogram)", RESULT=="name_ _/sbin/badprogram_", NAME="sane"
+EOF
+       },
+       {
+               desc            => "untrusted string sanitize (don't replace utf8)",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "uber",
+               rules           => <<EOF
+BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xc3\\xbcber" RESULT=="\xc3\xbcber", NAME="uber"
+EOF
+       },
+       {
+               desc            => "untrusted string sanitize (replace invalid utf8)",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "replaced",
+               rules           => <<EOF
+BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xef\\xe8garbage", RESULT=="__garbage", NAME="replaced"
+EOF
+       },
+       {
+               desc            => "read sysfs value from device down in the chain",
+               subsys          => "block",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "serial-0000:00:09.0",
+               rules           => <<EOF
+KERNEL=="ttyUSB*", NAME="serial-%s{serial}"
+EOF
+       },
+       {
+               desc            => "match against empty key string",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "ok",
+               rules           => <<EOF
+KERNEL=="sda", SYSFS{nothing}!="", NAME="not-1-ok"
+KERNEL=="sda", SYSFS{nothing}=="", NAME="not-2-ok"
+KERNEL=="sda", SYSFS{vendor}!="", NAME="ok"
+KERNEL=="sda", SYSFS{vendor}=="", NAME="not-3-ok"
+EOF
+       },
+       {
+               desc            => "check ACTION value",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "ok",
+               rules           => <<EOF
+ACTION=="unknown", KERNEL=="sda", NAME="unknown-not-ok"
+ACTION=="add", KERNEL=="sda", NAME="ok"
+EOF
+       },
+       {
+               desc            => "apply NAME only once",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "link",
+               exp_target      => "ok",
+               rules           => <<EOF
+KERNEL=="sda", NAME="ok"
+KERNEL=="sda", NAME="not-ok"
+KERNEL=="sda", SYMLINK+="link"
+EOF
+       },
+       {
+               desc            => "test RUN key",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "testsymlink",
+               exp_target      => "ok",
+               exp_rem_error   => "yes",
+               option          => "clean",
+               rules           => <<EOF
+KERNEL=="sda", NAME="ok", RUN+="/bin/ln -s ok %r/testsymlink"
+KERNEL=="sda", NAME="not-ok"
+EOF
+       },
+       {
+               desc            => "test RUN key and DEVNAME",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "testsymlink",
+               exp_target      => "ok",
+               exp_rem_error   => "yes",
+               option          => "clean",
+               rules           => <<EOF
+KERNEL=="sda", NAME="ok", RUN+="/bin/sh -c 'ln -s `basename \$\$DEVNAME` %r/testsymlink'"
+KERNEL=="sda", NAME="not-ok"
+EOF
+       },
+       {
+               desc            => "test RUN key remove",
+               subsys          => "block",
+               devpath         => "/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"
+KERNEL=="sda", NAME="not-ok2"
+EOF
+       },
+       {
+               desc            => "final assignment",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "ok",
+               exp_perms       => "root:nobody:0640",
+               rules           => <<EOF
+KERNEL=="sda", GROUP:="nobody"
+KERNEL=="sda", GROUP="not-ok", MODE="0640", NAME="ok"
+EOF
+       },
+       {
+               desc            => "final assignment",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "ok",
+               exp_perms       => "root:nobody:0640",
+               rules           => <<EOF
+KERNEL=="sda", GROUP:="nobody"
+SUBSYSTEM=="block", MODE:="640"
+KERNEL=="sda", GROUP="not-ok", MODE="0666", NAME="ok"
+EOF
+       },
+       {
+               desc            => "env substitution",
+               subsys          => "block",
+               devpath         => "/block/sda",
+               exp_name        => "node-add-me",
+               rules           => <<EOF
+KERNEL=="sda", MODE="0666", NAME="node-\$env{ACTION}-me"
+EOF
+       },
+       {
+               desc            => "reset list to current value",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "three",
+               not_exp_name    => "two",
+               exp_target      => "node",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", SYMLINK+="one"
+KERNEL=="ttyUSB[0-9]*", SYMLINK+="two"
+KERNEL=="ttyUSB[0-9]*", SYMLINK="three"
+KERNEL=="ttyUSB[0-9]*", NAME="node"
+EOF
+       },
+       {
+               desc            => "test empty NAME",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "node",
+               not_exp_name    => "wrong",
+               exp_add_error   => "yes",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME=""
+KERNEL=="ttyUSB[0-9]*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test empty NAME 2",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME="right"
+KERNEL=="ttyUSB[0-9]*", NAME=""
+KERNEL=="ttyUSB[0-9]*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test multi matches",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="ttyUSB*|nothing", NAME="right"
+KERNEL=="ttyUSB*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "test multi matches 2",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="dontknow*|*nothing", NAME="nomatch"
+KERNEL=="dontknow*|ttyUSB*|nothing*", NAME="right"
+KERNEL=="ttyUSB*", NAME="wrong"
+EOF
+       },
+       {
+               desc            => "IMPORT parent test sequence 1/2 (keep)",
+               subsys          => "block",
+               devpath         => "/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", NAME="parent"
+EOF
+       },
+       {
+               desc            => "IMPORT parent test sequence 2/2 (keep)",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "parentenv-parent_right",
+               option          => "clean",
+               rules           => <<EOF
+KERNEL=="sda1", IMPORT{parent}="PARENT*", NAME="parentenv-\$env{PARENT_KEY}\$env{WRONG_PARENT_KEY}"
+EOF
+       },
+       {
+               desc            => "GOTO test",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "right",
+               rules           => <<EOF
+KERNEL=="sda1", GOTO="TEST"
+KERNEL=="sda1", NAME="wrong"
+KERNEL=="sda1", NAME="", LABEL="NO"
+KERNEL=="sda1", NAME="right", LABEL="TEST"
+KERNEL=="sda1", NAME="wrong2"
 EOF
        },
 );
@@ -1361,6 +1687,13 @@ sub run_test {
                my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
                    $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}");
 
+               if (defined($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++
+                       }
+               }
                if (defined($rules->{exp_perms})) {
                        permissions_test($rules, $uid, $gid, $mode);
                }
@@ -1406,7 +1739,7 @@ sub run_test {
 
        print "\n";
 
-       if (defined($rules->{option}) && $rules->{option} eq "clear") {
+       if (defined($rules->{option}) && $rules->{option} eq "clean") {
                system("rm -rf $udev_db");
                system("rm -rf $udev_root");
                mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
@@ -1430,6 +1763,7 @@ open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
 print CONF "udev_root=\"$udev_root\"\n";
 print CONF "udev_db=\"$udev_db\"\n";
 print CONF "udev_rules=\"$udev_rules\"\n";
+print CONF "udev_log=\"info\"\n";
 close CONF;
 
 my $test_num = 1;