+EOF
+ },
+ {
+ desc => "callout program substitution (numbered part of)",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ 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
+ },
+ {
+ desc => "devfs disk naming substitution",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "lun0/disc" ,
+ conf => <<EOF
+LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="lun0/%D"
+EOF
+ },
+ {
+ desc => "devfs disk naming substitution",
+ subsys => "block",
+ devpath => "block/sda/sda2",
+ expected => "lun0/part2" ,
+ conf => <<EOF
+LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="lun0/%D"
+EOF
+ },
+ {
+ desc => "callout bus type",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "scsi-0:0:0:0" ,
+ conf => <<EOF
+CALLOUT, BUS="usb", PROGRAM="/bin/echo -n usb-%b", ID="*", NAME="%c"
+CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n scsi-%b", ID="*", NAME="%c"
+CALLOUT, BUS="foo", PROGRAM="/bin/echo -n foo-%b", ID="*", NAME="%c"
+EOF
+ },
+ {
+ desc => "symlink creation (same directory)",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "visor0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="visor%n"
+EOF
+ },
+ {
+ desc => "symlink creation (relative link back)",
+ subsys => "block",
+ devpath => "block/sda/sda2",
+ expected => "1/2/a/b/symlink" ,
+ conf => <<EOF
+LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/node", SYMLINK="1/2/a/b/symlink"
+EOF
+ },
+ {
+ desc => "symlink creation (relative link forward)",
+ subsys => "block",
+ devpath => "block/sda/sda2",
+ expected => "1/2/symlink" ,
+ conf => <<EOF
+LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink"
+EOF
+ },
+ {
+ desc => "symlink creation (relative link back and forward)",
+ subsys => "block",
+ devpath => "block/sda/sda2",
+ expected => "1/2/c/d/symlink" ,
+ conf => <<EOF
+LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
+EOF
+ },
+ {
+ desc => "multiple symlinks",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "second-0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n"