1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 10:25:37 +03:00

test: add test for empty and non-existent ATTR

This commit is contained in:
Kay Sievers 2009-02-05 12:40:15 +01:00
parent 198882e9ae
commit a402404fb2
3 changed files with 29 additions and 0 deletions

View File

@ -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
},
{

View 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;