# After creation and removal the result is checked against the
# expected value and the result is printed.
#
-# Kay Sievers <kay.sievers@vrfy.org>, 2003
-# Leann Ogasawara <ogasawara@osdl.org>, 2004
+# Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
+# Copyright (C) 2004 Leann Ogasawara <ogasawara@osdl.org>
use warnings;
use strict;
my @tests = (
{
+ desc => "label test of scsi disc (old key names)",
+ subsys => "block",
+ devpath => "/block/sda",
+ exp_name => "boot_disk" ,
+ rules => <<EOF
+SUBSYSTEMS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
+KERNEL=="ttyUSB0", NAME="visor"
+EOF
+ },
+ {
+ desc => "label test of scsi disc (old key names)",
+ subsys => "block",
+ devpath => "/block/sda",
+ exp_name => "boot_disk" ,
+ rules => <<EOF
+SUBSYSTEMS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
+KERNEL=="ttyUSB0", NAME="visor"
+EOF
+ },
+ {
desc => "label test of scsi disc",
subsys => "block",
devpath => "/block/sda",
exp_name => "boot_disk" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
devpath => "/block/sda/sda1",
exp_name => "boot_disk1" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "boot_disk1" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="?IBM-ESXS", NAME="boot_disk%n-1"
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS?", NAME="boot_disk%n-2"
-BUS=="scsi", SYSFS{vendor}=="IBM-ES??", NAME="boot_disk%n"
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXSS", NAME="boot_disk%n-3"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="?IBM-ESXS", NAME="boot_disk%n-1"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS?", NAME="boot_disk%n-2"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ES??", NAME="boot_disk%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXSS", NAME="boot_disk%n-3"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "boot_disk1" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW !#", NAME="boot_diskX%n"
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW !#", NAME="boot_disk%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", ATTRS{model}=="ST336605LW !#", NAME="boot_diskX%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", ATTRS{model}=="ST336605LW !#", NAME="boot_disk%n"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "boot_disk1" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW !#", SYSFS{scsi_level}=="4", SYSFS{rev}=="B245", SYSFS{type}=="0", SYSFS{queue_depth}=="32", NAME="boot_diskXX%n"
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", SYSFS{model}=="ST336605LW !#", SYSFS{scsi_level}=="4", SYSFS{rev}=="B245", SYSFS{type}=="0", NAME="boot_disk%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", ATTRS{model}=="ST336605LW !#", ATTRS{scsi_level}=="4", ATTRS{rev}=="B245", ATTRS{type}=="0", ATTRS{queue_depth}=="32", NAME="boot_diskXX%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", ATTRS{model}=="ST336605LW !#", ATTRS{scsi_level}=="4", ATTRS{rev}=="B245", ATTRS{type}=="0", NAME="boot_disk%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "first_disk3" ,
rules => <<EOF
-BUS=="scsi", ID=="0:0:0:0", NAME="first_disk%n"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="first_disk%n"
EOF
},
{
- desc => "test substitution chars",
+ desc => "test substitution chars (old key names)",
subsys => "block",
devpath => "/block/sda/sda3",
exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" ,
EOF
},
{
+ desc => "test substitution chars",
+ subsys => "block",
+ devpath => "/block/sda/sda3",
+ exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" ,
+ rules => <<EOF
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:id:%b"
+EOF
+ },
+ {
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}"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
EOF
},
{
devpath => "/block/sda",
exp_name => "subdir/info/node" ,
rules => <<EOF
-BUS=="scsi", IMPORT{file}="udev-test.conf", NAME="subdir/%E{udev_log}/node"
+SUBSYSTEMS=="scsi", IMPORT{file}="udev-test.conf", NAME="subdir/%E{udev_log}/node"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
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}"
+SUBSYSTEMS=="scsi", IMPORT="/bin/echo -e \' TEST_KEY=12345678 \\n TEST_key2=98765 \'", NAME="node\$env{TEST_KEY}"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
devpath => "/block/sda",
exp_name => "disk-IBM-ESXS-sda" ,
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="disk-%s{vendor}-%k"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME="disk-%s{vendor}-%k"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
devpath => "/block/sda/sda3",
exp_name => "special-device-3" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", NAME="%c-1-%n"
-BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special--*", NAME="%c-2-%n"
-BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-device-", NAME="%c-3-%n"
-BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-devic", NAME="%c-4-%n"
-BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", NAME="%c-%n"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", NAME="%c-1-%n"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special--*", NAME="%c-2-%n"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-device-", NAME="%c-3-%n"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-devic", NAME="%c-4-%n"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", NAME="%c-%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "newline_removed" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", NAME="newline_removed"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", NAME="newline_removed"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "test-0:0:0:0" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", NAME="%c"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", NAME="%c"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "escape-3" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n escape-%%n", KERNEL=="sda3", NAME="%c"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n escape-%%n", KERNEL=="sda3", NAME="%c"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "foo9" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="%c{7}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "bar9" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL=="sda3", NAME="%c{7}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL=="sda3", NAME="%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "foo7" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL=="sda3", NAME="%c{5}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL=="sda3", NAME="%c{5}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "my-foo9" ,
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{7}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
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}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{6}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0",
rules => <<EOF
-BUS=="scsi", ID=="0:0:0:0", NAME="Major:\$major-minor:\$minor-kernelnumber:\$number-id:\$id"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="Major:\$major-minor:\$minor-kernelnumber:\$number-id:\$id"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0",
rules => <<EOF
-BUS=="scsi", ID=="0:0:0:0", DEVPATH=="*/sda/*", NAME="Major:\$major-minor:%m-kernelnumber:\$number-id:\$id"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", NAME="Major:\$major-minor:%m-kernelnumber:\$number-id:\$id"
EOF
},
{
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"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", NAME="%M%m%b%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "833" ,
rules => <<EOF
-BUS=="scsi", ID=="0:0:0:0", DEVPATH=="*/sda/*", NAME="\$major\$minor\$number"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", NAME="\$major\$minor\$number"
EOF
},
{
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"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", NAME="\$major%m%n\$id"
EOF
},
{
- desc => "non matching BUS for device with no parent",
+ desc => "non matching SUBSYSTEMS for device with no parent",
subsys => "tty",
devpath => "/class/tty/console",
exp_name => "TTY",
rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo -n foo", RESULT=="foo", NAME="foo"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo", RESULT=="foo", NAME="foo"
KERNEL=="console", NAME="TTY"
EOF
},
{
- desc => "non matching BUS",
+ desc => "non matching SUBSYSTEMS",
subsys => "tty",
devpath => "/class/tty/console",
exp_name => "TTY" ,
rules => <<EOF
-BUS=="foo", SYSFS{dev}=="5:1", NAME="foo"
+SUBSYSTEMS=="foo", ATTRS{dev}=="5:1", NAME="foo"
KERNEL=="console", NAME="TTY"
EOF
},
{
- desc => "SYSFS match",
+ desc => "ATTRS match",
subsys => "tty",
devpath => "/class/tty/console",
exp_name => "foo" ,
rules => <<EOF
-SYSFS{dev}=="5:1", NAME="foo"
+ATTRS{dev}=="5:1", NAME="foo"
KERNEL=="console", NAME="TTY"
EOF
},
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0" ,
rules => <<EOF
-BUS=="usb", PROGRAM=="/bin/echo -n usb-%b", NAME="%c"
-BUS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", NAME="%c"
-BUS=="foo", PROGRAM=="/bin/echo -n foo-%b", NAME="%c"
+SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", NAME="%c"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", NAME="%c"
+SUBSYSTEMS=="foo", PROGRAM=="/bin/echo -n foo-%b", NAME="%c"
EOF
},
{
exp_name => "boot_disk15" ,
exp_majorminor => "8:15",
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME{all_partitions}="boot_disk"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME{all_partitions}="boot_disk"
EOF
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor" ,
rules => <<EOF
-SYSFS{idProduct}=="2008", NAME="visor"
+ATTRS{idProduct}=="2008", NAME="visor"
EOF
},
{
devpath => "/block/rd!c0d0",
exp_name => "rd/c0d0" ,
rules => <<EOF
-BUS=="scsi", NAME="%k"
+SUBSYSTEMS=="scsi", NAME="%k"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
devpath => "/block/cciss!c0d0/cciss!c0d0p1",
exp_name => "cciss/c0d0p1" ,
rules => <<EOF
-BUS=="scsi", NAME="%k"
+SUBSYSTEMS=="scsi", NAME="%k"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
- desc => "ID rule",
+ desc => "KERNELS rule",
subsys => "block",
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
rules => <<EOF
-BUS=="usb", ID=="0:0:0:0", NAME="not-scsi"
-BUS=="scsi", ID=="0:0:0:1", NAME="no-match"
-BUS=="scsi", ID==":0", NAME="short-id"
-BUS=="scsi", ID=="/0:0:0:0", NAME="no-match"
-BUS=="scsi", ID=="0:0:0:0", NAME="scsi-0:0:0:0"
+SUBSYSTEMS=="usb", KERNELS=="0:0:0:0", NAME="not-scsi"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:1", NAME="no-match"
+SUBSYSTEMS=="scsi", KERNELS==":0", NAME="short-id"
+SUBSYSTEMS=="scsi", KERNELS=="/0:0:0:0", NAME="no-match"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="scsi-0:0:0:0"
EOF
},
{
- desc => "ID wildcard all",
+ desc => "KERNELS wildcard all",
subsys => "block",
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
rules => <<EOF
-BUS=="scsi", ID=="*:1", NAME="no-match"
-BUS=="scsi", ID=="*:0:1", NAME="no-match"
-BUS=="scsi", ID=="*:0:0:1", NAME="no-match"
-BUS=="scsi", ID=="*", NAME="scsi-0:0:0:0"
-BUS=="scsi", ID=="0:0:0:0", NAME="bad"
+SUBSYSTEMS=="scsi", KERNELS=="*:1", NAME="no-match"
+SUBSYSTEMS=="scsi", KERNELS=="*:0:1", NAME="no-match"
+SUBSYSTEMS=="scsi", KERNELS=="*:0:0:1", NAME="no-match"
+SUBSYSTEMS=="scsi", KERNELS=="*", NAME="scsi-0:0:0:0"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="bad"
EOF
},
{
- desc => "ID wildcard partial",
+ desc => "KERNELS wildcard partial",
subsys => "block",
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
rules => <<EOF
-BUS=="scsi", ID=="*:0", NAME="scsi-0:0:0:0"
-BUS=="scsi", ID=="0:0:0:0", NAME="bad"
+SUBSYSTEMS=="scsi", KERNELS=="*:0", NAME="scsi-0:0:0:0"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="bad"
EOF
},
{
- desc => "ID wildcard partial 2",
+ desc => "KERNELS wildcard partial 2",
subsys => "block",
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
rules => <<EOF
-BUS=="scsi", ID=="*:0:0:0", NAME="scsi-0:0:0:0"
-BUS=="scsi", ID=="0:0:0:0", NAME="bad"
+SUBSYSTEMS=="scsi", KERNELS=="*:0:0:0", NAME="scsi-0:0:0:0"
+SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="bad"
EOF
},
{
- desc => "ignore SYSFS attribute whitespace",
+ desc => "ignore ATTRS attribute whitespace",
subsys => "block",
devpath => "/block/sda",
exp_name => "ignored",
rules => <<EOF
-BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE", NAME="ignored"
+SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE SPACE", NAME="ignored"
EOF
},
{
- desc => "do not ignore SYSFS attribute whitespace",
+ desc => "do not ignore ATTRS attribute whitespace",
subsys => "block",
devpath => "/block/sda",
exp_name => "matched-with-space",
rules => <<EOF
-BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE ", NAME="wrong-to-ignore"
-BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE ", NAME="matched-with-space"
+SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE SPACE ", NAME="wrong-to-ignore"
+SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE SPACE ", NAME="matched-with-space"
EOF
},
{
exp_name => "node",
exp_perms => "5000::0660",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000"
EOF
},
{
exp_name => "node",
exp_perms => ":100:0660",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", GROUP="100"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", GROUP="100"
EOF
},
{
exp_name => "node",
exp_perms => "nobody::0660",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="nobody"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OWNER="nobody"
EOF
},
{
exp_name => "node",
exp_perms => ":daemon:0660",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", GROUP="daemon"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", GROUP="daemon"
EOF
},
{
exp_name => "node",
exp_perms => "root:mail:0660",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="root", GROUP="mail"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OWNER="root", GROUP="mail"
EOF
},
{
exp_name => "node",
exp_perms => "::0777",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", MODE="0777"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", MODE="0777"
EOF
},
{
exp_name => "node",
exp_perms => "5000:100:0777",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000", GROUP="100", MODE="0777"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000", GROUP="100", MODE="0777"
EOF
},
{
exp_name => "node",
exp_majorminor => "8:0",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_name => "1/2/symlink" ,
exp_target => "a/b/node",
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink"
EOF
},
{
exp_name => "1/2/c/d/symlink" ,
exp_target => "../../a/b/node",
rules => <<EOF
-BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
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"
+SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="symlink-only1"
+SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="symlink-only2"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="symlink0"
EOF
},
{
exp_add_error => "yes",
exp_rem_error => "yes",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="."
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="."
EOF
},
{
exp_name => "symlink-0:0:0:0",
exp_target => "node",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", SYMLINK+="symlink-%b"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", SYMLINK+="symlink-%b"
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"
+SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK+="%c{2+}"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="link", SYMLINK+="symlink0"
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}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", NAME="%c{1}", SYMLINK+="%c{2} %c{3}"
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+}"
+SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", NAME="%c{1}", SYMLINK+="%c{2+}"
EOF
},
{
not_exp_name => "node",
exp_add_error => "yes",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore"
EOF
},
{
exp_name => "node6",
rules => <<EOF
SUBSYSTEM=="block", OPTIONS="all_partitions"
-BUS=="scsi", KERNEL=="sda", NAME="node"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_add_error => "yes",
rules => <<EOF
SUBSYSTEM=="block", OPTIONS="all_partitions"
-BUS=="scsi", KERNEL=="sda", NAME="node"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_name => "node",
exp_rem_error => "yes",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove"
EOF
},
{
exp_rem_error => "yes",
option => "clean",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="should_not_match", SUBSYSTEM=="vc"
-BUS=="scsi", KERNEL=="sda", NAME="node", SUBSYSTEM=="block"
-BUS=="scsi", KERNEL=="sda", NAME="should_not_match2", SUBSYSTEM=="vc"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="should_not_match", SUBSYSTEM=="vc"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", SUBSYSTEM=="block"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="should_not_match2", SUBSYSTEM=="vc"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="should_not_match", DRIVERS=="sd-wrong"
-BUS=="scsi", KERNEL=="sda", NAME="node", DRIVERS=="sd"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="should_not_match", DRIVERS=="sd-wrong"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="node", DRIVERS=="sd"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" NAME="node"
+SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" NAME="node"
EOF
},
{
devpath => "/block/sda",
exp_name => "sda",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo %p", RESULT=="/block/sda" NAME="%k"
+SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo %p", RESULT=="/block/sda" NAME="%k"
EOF
},
{
exp_name => "main_device",
option => "keep",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda", NAME="main_device"
+SUBSYSTEMS=="scsi", KERNEL=="sda", NAME="main_device"
EOF
},
{
exp_name => "main_device-part-1",
option => "clean",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", NAME="%P-part-1"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="%P-part-1"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "start-udev-root-end",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", NAME="start-%r-end"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="start-%r-end"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "last",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", SYMLINK+="last", OPTIONS="last_rule"
-BUS=="scsi", KERNEL=="sda1", NAME="very-last"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="last", OPTIONS="last_rule"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="very-last"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "match",
rules => <<EOF
-BUS=="scsi", KERNEL!="sda1", NAME="matches-but-is-negated"
-BUS=="scsi", KERNEL!="xsda1", NAME="match"
-BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+SUBSYSTEMS=="scsi", KERNEL!="sda1", NAME="matches-but-is-negated"
+SUBSYSTEMS=="scsi", KERNEL!="xsda1", NAME="match"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "not-anything",
rules => <<EOF
-BUS=="scsi", SUBSYSTEM=="block", KERNEL!="sda1", NAME="matches-but-is-negated"
-BUS=="scsi", SUBSYSTEM!="anything", NAME="not-anything"
-BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+SUBSYSTEMS=="scsi", SUBSYSTEM=="block", KERNEL!="sda1", NAME="matches-but-is-negated"
+SUBSYSTEMS=="scsi", SUBSYSTEM!="anything", NAME="not-anything"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
{
exp_name => "nonzero-program",
rules => <<EOF
KERNEL=="sda1", PROGRAM!="/bin/false", NAME="nonzero-program"
-BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
{
exp_name => "true",
rules => <<EOF
KERNEL == "sda1" , NAME = "true"
-BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "true",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong"
-BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", NAME="true"
-BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", NAME="true"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "true",
rules => <<EOF
-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"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="yes", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sdax1", NAME="no"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sda1", NAME="true"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad"
EOF
},
{
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"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="yes", NAME="no"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="true", NAME="true"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="bad"
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"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/sbin/badprogram)", RESULT=="name_ _/sbin/badprogram_", NAME="sane"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "uber",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xc3\\xbcber" RESULT=="\xc3\xbcber", NAME="uber"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xc3\\xbcber" RESULT=="\xc3\xbcber", NAME="uber"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "replaced",
rules => <<EOF
-BUS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xef\\xe8garbage", RESULT=="__garbage", NAME="replaced"
+SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xef\\xe8garbage", RESULT=="__garbage", NAME="replaced"
EOF
},
{
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"
+KERNEL=="sda", ATTRS{nothing}!="", NAME="not-1-ok"
+KERNEL=="sda", ATTRS{nothing}=="", NAME="not-2-ok"
+KERNEL=="sda", ATTRS{vendor}!="", NAME="ok"
+KERNEL=="sda", ATTRS{vendor}=="", NAME="not-3-ok"
EOF
},
{
$ENV{ENV_KEY_TEST} = "test";
$ENV{SYSFS_PATH} = $sysfs;
$ENV{UDEV_CONFIG_FILE} = $udev_conf;
-$ENV{UDEV_NO_DEVD} = "yes";
-$ENV{UDEV_NO_HOTPLUGD} = "yes";
-
sub udev {
my ($action, $subsys, $devpath, $rules) = @_;