aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-02-05 12:40:15 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-02-05 12:40:15 +0100
commita402404fb23195839a9e008dbbe5edb5349c05b0 (patch)
tree8307501c8e60a476de46c60e5e1c1c4b9f076c4a /test
parent198882e9ae1dc65bbca3c00fa67a711c80f3a89c (diff)
downloadudev-a402404fb23195839a9e008dbbe5edb5349c05b0.tar.gz
test: add test for empty and non-existent ATTR
Diffstat (limited to 'test')
-rw-r--r--test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file0
-rwxr-xr-xtest/udev-test.pl27
2 files changed, 27 insertions, 0 deletions
diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 1b81eb8d..4f61ce3e 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -483,6 +483,33 @@ 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
+ },
+ {
desc => "program and bus type match",
subsys => "block",
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",