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 1b81eb8d722ad29e8e06cd0805248627600aa92c..4f61ce3e5ddf0b40fda8c928032f1ffeccf26693 100755 (executable)
@@ -480,6 +480,33 @@ EOF
                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
        },
        {
index 8a765f61cf6b83bc02a4c433c65a1f23ec2bb5fc..867bbed137c21ce4cdb3d9d83565e407f5d807f4 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;