summaryrefslogtreecommitdiff
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
parent198882e9ae1dc65bbca3c00fa67a711c80f3a89c (diff)
test: add test for empty and non-existent ATTR
-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
-rw-r--r--udev/udevadm-settle.c2
3 files changed, 29 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 0000000000..e69de29bb2
--- /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 1b81eb8d72..4f61ce3e5d 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",
diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
index 8a765f61cf..867bbed137 100644
--- a/udev/udevadm-settle.c
+++ b/udev/udevadm-settle.c
@@ -84,6 +84,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
break;
usleep(1000 * 1000 / LOOP_PER_SECOND);
}
+
+ /* if we reached the timeout, print the list of remaining events */
if (loop <= 0) {
struct udev_list_entry *list_entry;