chiark / gitweb /
[PATCH] add OPTION="last_rule" to skip any later rule
[elogind.git] / test / udev-test.pl
index 5f9c0cb9c503a46f56660e4d1082d61e0daf9a4f..52c5c8d481832ef12e6715ef2041f714bf974b4e 100644 (file)
@@ -192,6 +192,15 @@ EOF
 KERNEL="ttyUSB0", \\
 NAME="visor"
 
+EOF
+       },
+       {
+               desc            => "preserve backslashes, if they are not for a newline",
+               subsys          => "tty",
+               devpath         => "/class/tty/ttyUSB0",
+               exp_name        => "aaa",
+               conf            => <<EOF
+KERNEL="ttyUSB0", PROGRAM="/bin/echo -e \\101", RESULT="A", NAME="aaa"
 EOF
        },
        {
@@ -228,7 +237,7 @@ EOF
                devpath         => "/block/sda/sda3",
                exp_name        => "first_disk3" ,
                conf            => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="first_disk%n"
+BUS="scsi", ID="0:0:0:0", NAME="first_disk%n"
 EOF
        },
        {
@@ -237,7 +246,7 @@ EOF
                devpath         => "/block/sda/sda3",
                exp_name        => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
                conf            => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
+BUS="scsi", ID="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
 EOF
        },
        {
@@ -246,7 +255,7 @@ EOF
                devpath         => "/block/sda/sda3",
                exp_name        => "M8-m3-n3-b0:0-sIBM" ,
                conf            => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
+BUS="scsi", ID="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
 EOF
        },
        {
@@ -755,17 +764,6 @@ EOF
 BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1"
 BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2"
 BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0"
-EOF
-       },
-       {
-               desc            => "symlink name empty",
-               subsys          => "block",
-               devpath         => "/block/sda",
-               exp_name        => "",
-               exp_target      => "link",
-               exp_error       => "yes",
-               conf            => <<EOF
-BUS="scsi", KERNEL="sda", NAME="link", SYMLINK=""
 EOF
        },
        {
@@ -774,31 +772,10 @@ EOF
                devpath         => "/block/sda",
                exp_name        => ".",
                exp_target      => "link",
-               exp_error       => "yes",
+               exp_add_error   => "yes",
+               exp_rem_error   => "yes",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="."
-EOF
-       },
-       {
-               desc            => "symlink to empty name",
-               subsys          => "block",
-               devpath         => "/block/sda",
-               exp_name        => "symlink",
-               exp_target      => "",
-               exp_error       => "yes",
-               conf            => <<EOF
-BUS="scsi", KERNEL="sda", NAME="", SYMLINK="symlink"
-EOF
-       },
-       {
-               desc            => "symlink and name empty",
-               subsys          => "block",
-               devpath         => "/block/sda",
-               exp_name        => "",
-               exp_target      => "",
-               exp_error       => "yes",
-               conf            => <<EOF
-BUS="scsi", KERNEL="sda", NAME="", SYMLINK=""
 EOF
        },
        {
@@ -807,6 +784,8 @@ EOF
                devpath         => "/class/tty/tty0",
                exp_name        => "link",
                exp_target      => "link",
+               exp_rem_error   => "yes",
+               option          => "clear",
                conf            => <<EOF
 KERNEL="tty0", NAME="link", SYMLINK="link"
 EOF
@@ -1025,7 +1004,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda",
                exp_name        => "node",
-               exp_error       => "yes",
+               exp_add_error   => "yes",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore"
 EOF
@@ -1045,7 +1024,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda/sda1",
                exp_name        => "node6",
-               exp_error       => "yes",
+               exp_add_error   => "yes",
                conf            => <<EOF
 SUBSYSTEM="block", OPTIONS="all_partitions"
 BUS="scsi", KERNEL="sda", NAME="node"
@@ -1056,7 +1035,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda",
                exp_name        => "node",
-               exp_error       => "yes",
+               exp_rem_error   => "yes",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore_remove"
 EOF
@@ -1066,7 +1045,7 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda",
                exp_name        => "node14",
-               exp_error       => "yes",
+               exp_rem_error   => "yes",
                option          => "clear",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
@@ -1136,9 +1115,18 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda/sda1",
                exp_name        => "start-udev-root-end",
-               option          => "clean",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda1", NAME="start-%r-end"
+EOF
+       },
+       {
+               desc            => "last_rule option",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "last",
+               conf            => <<EOF
+BUS="scsi", KERNEL="sda1", SYMLINK="last", OPTIONS="last_rule"
+BUS="scsi", KERNEL="sda1", NAME="very-last"
 EOF
        },
 );
@@ -1225,7 +1213,7 @@ sub symlink_test {
                } else {
                        print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n";
                        print "created symlink from: \'$config->{exp_name}\' to \'$2\'\n";
-                       if ($config->{exp_error}) {
+                       if ($config->{exp_add_error}) {
                                print "as expected    ";
                        } else {
                                $error++;
@@ -1234,7 +1222,7 @@ sub symlink_test {
        } else {
                print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n";
                print "symlink: not created ";
-               if ($config->{exp_error}) {
+               if ($config->{exp_add_error}) {
                        print "as expected    ";
                } else {
                        $error++;
@@ -1273,7 +1261,7 @@ sub run_test {
                print "add: ok    ";
        } else {
                print "add: error ";
-               if ($config->{exp_error}) {
+               if ($config->{exp_add_error}) {
                        print "as expected    ";
                } else {
                        print "\n\n";
@@ -1292,7 +1280,7 @@ sub run_test {
        if ((-e "$PWD/$udev_root$config->{exp_name}") ||
            (-l "$PWD/$udev_root$config->{exp_name}")) {
                print "remove: error ";
-               if ($config->{exp_error}) {
+               if ($config->{exp_rem_error}) {
                        print "as expected\n\n";
                } else {
                        print "\n\n";