+ desc => "subdirectory handling",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ exp_name => "sub/direct/ory/visor" ,
+ conf => <<EOF
+KERNEL="ttyUSB0", NAME="sub/direct/ory/visor"
+EOF
+ },
+ {
+ desc => "place on bus of scsi partition",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "first_disk3" ,
+ conf => <<EOF
+BUS="scsi", PLACE="0:0:0:0", NAME="first_disk%n"
+EOF
+ },
+ {
+ desc => "test NAME substitution chars",
+ subsys => "block",
+ 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"
+EOF
+ },
+ {
+ desc => "test NAME substitution chars (with length limit)",
+ subsys => "block",
+ 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}"
+EOF
+ },
+ {
+ desc => "old style SYSFS_ attribute",
+ subsys => "block",
+ devpath => "block/sda",
+ exp_name => "good" ,
+ conf => <<EOF
+BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="good"
+EOF
+ },
+ {
+ desc => "sustitution of sysfs value (%s{file})",
+ subsys => "block",
+ devpath => "block/sda",
+ exp_name => "disk-IBM-ESXS-sda" ,
+ conf => <<EOF
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="disk-%s{vendor}-%k"
+KERNEL="ttyUSB0", NAME="visor"
+EOF
+ },
+ {
+ desc => "program result substitution",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "special-device-3" ,
+ conf => <<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"
+EOF
+ },
+ {
+ desc => "program result substitution",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "test-0:0:0:0" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-0:0*", NAME="%c"
+EOF
+ },
+ {
+ desc => "program with escaped format char (tricky: callout returns format char!)",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "escape-3" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n escape-%%n", KERNEL="sda3", NAME="%c"
+EOF
+ },
+ {
+ desc => "program with lots of arguments",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "foo9" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="%c{7}"
+EOF
+ },
+ {
+ desc => "program with subshell",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "bar9" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL="sda3", NAME="%c{7}"
+EOF
+ },
+ {
+ desc => "program arguments combined with apostrophes",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "foo7" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL="sda3", NAME="%c{5}"
+EOF
+ },
+ {
+ desc => "characters before the %c{N} substitution",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "my-foo9" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{7}"
+EOF
+ },
+ {
+ desc => "substitute the second to last argument",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "my-foo8" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{6}"
+EOF
+ },
+ {
+ desc => "program result substitution (numbered part of)",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "link1" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", RESULT="node *", NAME="%c{1}", SYMLINK="%c{2} %c{3}"
+EOF
+ },
+ {
+ desc => "program result substitution (numbered part of+)",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ exp_name => "link3" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n node link1 link2 link3 link4", RESULT="node *", NAME="%c{1}", SYMLINK="%c{2+}"
+EOF
+ },
+ {
+ desc => "invalid program for device with no bus",
+ subsys => "tty",
+ devpath => "class/tty/console",
+ exp_name => "TTY" ,
+ conf => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo", RESULT="foo", NAME="foo"
+KERNEL="console", NAME="TTY"
+EOF
+ },
+ {
+ desc => "valid program for device with no bus",
+ subsys => "tty",
+ devpath => "class/tty/console",
+ exp_name => "foo" ,
+ conf => <<EOF
+PROGRAM="/bin/echo -n foo", RESULT="foo", NAME="foo"
+KERNEL="console", NAME="TTY"
+EOF
+ },
+ {
+ desc => "invalid label for device with no bus",
+ subsys => "tty",
+ devpath => "class/tty/console",
+ exp_name => "TTY" ,
+ conf => <<EOF
+BUS="foo", SYSFS{dev}="5:1", NAME="foo"
+KERNEL="console", NAME="TTY"
+EOF
+ },
+ {
+ desc => "valid label for device with no bus",
+ subsys => "tty",
+ devpath => "class/tty/console",
+ exp_name => "foo" ,
+ conf => <<EOF
+SYSFS{dev}="5:1", NAME="foo"
+KERNEL="console", NAME="TTY"
+EOF
+ },
+ {
+ desc => "program and bus type match",
+ subsys => "block",
+ devpath => "block/sda",
+ exp_name => "scsi-0:0:0:0" ,
+ conf => <<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"
+EOF
+ },
+ {
+ desc => "symlink creation (same directory)",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ exp_name => "visor0" ,
+ conf => <<EOF
+KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="visor%n"