chiark / gitweb /
[PATCH] add silly script that names cdrom drives based on the cd in them.
[elogind.git] / test / udev-test.pl
index 4773954b9cef9ce9a6b81e1fcf47b1bfaeac8d8b..97c009492124005ae641c5c38fe4bf56b4df56f1 100644 (file)
@@ -212,6 +212,46 @@ EOF
                expected => "link1" ,
                conf     => <<EOF
 CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
+EOF
+       },
+       {
+               desc     => "invalid callout for device with no bus",
+               subsys   => "tty",
+               devpath  => "class/tty/console",
+               expected => "TTY" ,
+               conf     => <<EOF
+CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n foo", ID="foo", NAME="foo"
+REPLACE, KERNEL="console", NAME="TTY"
+EOF
+       },
+       {
+               desc     => "valid callout for device with no bus",
+               subsys   => "tty",
+               devpath  => "class/tty/console",
+               expected => "foo" ,
+               conf     => <<EOF
+CALLOUT, PROGRAM="/bin/echo -n foo", ID="foo", NAME="foo"
+REPLACE, KERNEL="console", NAME="TTY"
+EOF
+       },
+       {
+               desc     => "invalid label for device with no bus",
+               subsys   => "tty",
+               devpath  => "class/tty/console",
+               expected => "TTY" ,
+               conf     => <<EOF
+LABEL, BUS="foo", SYSFS_dev="5:1", NAME="foo"
+REPLACE, KERNEL="console", NAME="TTY"
+EOF
+       },
+       {
+               desc     => "valid label for device with no bus",
+               subsys   => "tty",
+               devpath  => "class/tty/console",
+               expected => "foo" ,
+               conf     => <<EOF
+LABEL, SYSFS_dev="5:1", NAME="foo"
+REPLACE, KERNEL="console", NAME="TTY"
 EOF
        },
        {
@@ -328,7 +368,7 @@ print CONF "udev_permissions=\"$perm\"\n";
 close CONF;
 
 foreach my $config (@tests) {
-       $config->{conf} =~ m/^([A-Z]*).*/;
+       $config->{conf} =~ m/([A-Z]+)\s*,/;
        my $method  = $1;
 
        print "TEST: $config->{desc}\n";