exp_name => "Major:8:minor:5:kernelnumber:5: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 => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "M8-m5-n5-b0:0-xAT" ,
- rules => <<EOF
-SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-x%2s{vendor}"
EOF
},
{
EOF
},
{
- desc => "program with escaped format char (tricky: callout returns format char!)",
+ desc => "program with escaped format char (callout returns format char!)",
subsys => "block",
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
exp_name => "escape-5" ,
rules => <<EOF
KERNEL=="console", NAME="TTY"
ATTRS{dev}=="5:1", NAME="foo"
+EOF
+ },
+ {
+ desc => "ATTR (empty file)",
+ subsys => "tty",
+ devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
+ exp_name => "empty" ,
+ rules => <<EOF
+KERNEL=="sda", ATTR{test_empty_file}=="?*", NAME:="something"
+KERNEL=="sda", ATTR{test_empty_file}!="", NAME:="not-empty"
+KERNEL=="sda", ATTR{test_empty_file}=="", NAME:="empty"
+KERNEL=="sda", ATTR{test_empty_file}!="?*", NAME:="not-something"
+KERNEL=="sda", NAME="wrong"
+EOF
+ },
+ {
+ desc => "ATTR (non-existent file)",
+ subsys => "tty",
+ devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
+ exp_name => "non-existent" ,
+ rules => <<EOF
+KERNEL=="sda", ATTR{nofile}=="?*", NAME:="something"
+KERNEL=="sda", ATTR{nofile}!="", NAME:="not-empty"
+KERNEL=="sda", ATTR{nofile}=="", NAME:="empty"
+KERNEL=="sda", ATTR{nofile}!="?*", NAME:="not-something"
+KERNEL=="sda", TEST!="nofile", NAME:="non-existent"
+KERNEL=="sda", NAME="wrong"
EOF
},
{
exp_target => "ttyACM0",
rules => <<EOF
KERNEL=="ttyACM[0-9]*", NAME="ttyACM%n", SYMLINK+="%s{dev}"
-EOF
- },
- {
- desc => "symlink %Ns{filename} substitution",
- subsys => "tty",
- devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "166",
- exp_target => "ttyACM0",
- rules => <<EOF
-KERNEL=="ttyACM[0-9]*", NAME="ttyACM%n", SYMLINK+="%3s{dev}"
EOF
},
{
KERNEL=="sda1", NAME="", LABEL="NO"
KERNEL=="sda1", NAME="right", LABEL="TEST"
KERNEL=="sda1", LABEL="BAD"
+EOF
+ },
+ {
+ desc => "GOTO label does not exist",
+ subsys => "block",
+ devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
+ exp_name => "right",
+ rules => <<EOF
+KERNEL=="sda1", GOTO="does-not-exist"
+KERNEL=="sda1", NAME="right",
+LABEL="exists"
EOF
},
{