X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=test%2Fudev-test.pl;h=1b81eb8d722ad29e8e06cd0805248627600aa92c;hp=9725aff5ba0a245ca7881787e1f68d0f2792e26e;hb=647f7c49e8ddfbbe2afd9545484a3ad936f438e9;hpb=6880b25d4044f2d154908f88e717435412187355 diff --git a/test/udev-test.pl b/test/udev-test.pl index 9725aff5b..1b81eb8d7 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -30,13 +30,21 @@ my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; my @tests = ( + { + desc => "no rules", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda" , + rules => < "label test of scsi disc (old key names)", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "node", exp_add_error => "yes", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "", + not_exp_name => "ttyACM0", + exp_add_error => "yes", + rules => < "test empty NAME (empty override)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "", not_exp_name => "wrong", exp_add_error => "yes", rules => < "test empty NAME 2", + desc => "test empty NAME (non-empty override)", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", @@ -1448,6 +1467,31 @@ EOF KERNEL=="dontknow*|*nothing", NAME="nomatch" KERNEL=="ttyACM*", NAME="before" KERNEL=="dontknow*|ttyACM*|nothing*", NAME="right" +EOF + }, + { + desc => "test multi matches 3", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 4", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < < "TEST invalid NAME= only (skip invalid rule)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "magic [subsys/sysname] attribute substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0660", + rules => <{subsys}, $rules->{devpath}, \$rules->{rules}); + if (defined($rules->{not_exp_name})) { + if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || + (-l "$PWD/$udev_root$rules->{not_exp_name}")) { + print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; + $error++ + } + } + if ((-e "$PWD/$udev_root$rules->{exp_name}") || (-l "$PWD/$udev_root$rules->{exp_name}")) { my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}"); - if (defined($rules->{not_exp_name})) { - if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || - (-l "$PWD/$udev_root$rules->{not_exp_name}")) { - print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; - $error++ - } - } if (defined($rules->{exp_perms})) { permissions_test($rules, $uid, $gid, $mode); }