chiark / gitweb /
test: add test for empty and non-existent ATTR
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 5 Feb 2009 11:40:15 +0000 (12:40 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 5 Feb 2009 11:40:15 +0000 (12:40 +0100)
test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file [new file with mode: 0644]
test/udev-test.pl
udev/udevadm-settle.c

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 (file)
index 0000000..e69de29
index 1b81eb8..4f61ce3 100755 (executable)
@@ -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",
index 8a765f6..867bbed 100644 (file)
@@ -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;