chiark / gitweb /
remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys
[elogind.git] / test / udev-test.pl
index 4633d6be25a96a28997b7bcd5f4658f5c1e005e4..f93859c78c4979b14be4b1c1a47cf6ee59613db7 100755 (executable)
@@ -14,7 +14,7 @@
 # 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;
@@ -292,7 +292,7 @@ EOF
                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
        },
@@ -610,7 +610,7 @@ EOF
                subsys          => "tty",
                devpath         => "/devices/virtual/tty/tty33",
                exp_name        => "tty33",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0600",
                rules           => <<EOF
 KERNEL=="tty33", SYMLINK+="tty33", OWNER="bad", GROUP="name"
 EOF
@@ -620,7 +620,7 @@ EOF
                subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
-               exp_perms       => "5000::0660",
+               exp_perms       => "5000::0600",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OWNER="5000"
 EOF
@@ -640,7 +640,7 @@ EOF
                subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "node",
-               exp_perms       => "nobody::0660",
+               exp_perms       => "nobody::0600",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OWNER="nobody"
 EOF
@@ -975,16 +975,6 @@ EOF
                exp_name        => "link4",
                rules           => <<EOF
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", SYMLINK+="%c{2+}"
-EOF
-       },
-       {
-               desc            => "ignore remove event test",
-               subsys          => "block",
-               devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
-               exp_name        => "node",
-               exp_rem_error   => "yes",
-               rules           => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="node", OPTIONS="ignore_remove"
 EOF
        },
        {
@@ -1273,17 +1263,6 @@ EOF
 KERNEL=="ttyACM[0-9]*", SYMLINK+="one"
 KERNEL=="ttyACM[0-9]*", SYMLINK+="two"
 KERNEL=="ttyACM[0-9]*", SYMLINK="three"
-EOF
-       },
-       {
-               desc            => "test empty NAME",
-               subsys          => "tty",
-               devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
-               exp_name        => "<none>",
-               not_exp_name    => "ttyACM0",
-               exp_add_error   => "yes",
-               rules           => <<EOF
-KERNEL=="ttyACM[0-9]*", NAME=""
 EOF
        },
        {
@@ -1351,7 +1330,7 @@ EOF
                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
        },
@@ -1508,7 +1487,7 @@ EOF
                subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0440",
                exp_rem_error   => "yes",
                rules           => <<EOF
 KERNEL=="sda", MODE="440"
@@ -1520,11 +1499,21 @@ EOF
                subsys          => "block",
                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                exp_name        => "sda-8741C4G-end",
-               exp_perms       => "0:0:0660",
+               exp_perms       => "0:0:0600",
                rules           => <<EOF
 KERNEL=="sda", PROGRAM="/bin/true create-envp"
 KERNEL=="sda", ENV{TESTENV}="change-envp"
 KERNEL=="sda", SYMLINK+="%k-%s{[dmi/id]product_name}-end", RUN+="socket:@/org/kernel/udev/monitor"
+EOF
+       },
+       {
+               desc            => "builtin path_id",
+               subsys          => "block",
+               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
        },
 );
@@ -1753,6 +1742,7 @@ make_udev_root();
 # create config file
 open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
 print CONF "udev_root=\"$udev_root\"\n";
+print CONF "udev_run=\"$udev_root/.udev\"\n";
 print CONF "udev_rules=\"$PWD\"\n";
 print CONF "udev_log=\"err\"\n";
 close CONF;