From 5754e74c089a727183a281aa9071979dff2a9477 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Jan 2010 09:30:48 +0100 Subject: [PATCH] update tests --- .../usb5/5-2/5-2:1.0/tty/ttyACM0/uevent | 1 + test/udev-test.pl | 595 ++++++++---------- 2 files changed, 253 insertions(+), 343 deletions(-) diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent index 2ba9f437..e6caaabf 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent @@ -1,2 +1,3 @@ +DEVNAME=ttyACM0 MAJOR=166 MINOR=0 diff --git a/test/udev-test.pl b/test/udev-test.pl index 896bb228..aeca9486 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,7 +35,9 @@ my @tests = ( subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda" , + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "modem" , rules => < "modem" , rules => < "modem" , rules => < "modem" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "sub/direct/ory/modem" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "first_disk5" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "subdir/err/node" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "disk-ATA-sda" , rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "special-device-5" , + not_exp_name => "not" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "newline_removed" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "test-0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "bar9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo7" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo8" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "850:0:0:05" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "855" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "8550:0:0:0" , rules => < "/devices/virtual/tty/console", exp_name => "TTY", rules => < "/devices/virtual/tty/console", exp_name => "TTY" , rules => < "/devices/virtual/tty/console", exp_name => "foo" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "empty" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "non-existent" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "create all possible partitions", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk15" , + exp_name => "sda15" , exp_majorminor => "8:15", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "/devices/virtual/block/fake!blockdev0", exp_name => "is/a/fake/blockdev0" , rules => < "block", devpath => "/devices/virtual/block/fake!blockdev0", exp_name => "fake/blockdev0" , + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-sd", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-ahci", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ignored", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "matched-with-space", rules => < "tty33", exp_perms => "0:0:0660", rules => < "node", exp_perms => "5000::0660", rules => < "node", exp_perms => ":100:0660", rules => < "node", exp_perms => "nobody::0660", rules => < "node", exp_perms => ":daemon:0660", rules => < "node", exp_perms => "root:mail:0660", rules => < "node", exp_perms => "::0777", rules => < "node", exp_perms => "5000:100:0777", rules => < "ttyACM0", exp_perms => "5000::", rules => < "ttyACM0", exp_perms => ":100:0660", rules => < "ttyACM0", exp_perms => "::0060", rules => < "ttyACM0", exp_perms => "5000:100:0777", rules => < < "permissions only rule with override at NAME rule", + desc => "permissions only rule with override at SYMLINK+ rule", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", @@ -772,7 +772,7 @@ SUBSYSTEM=="tty", OWNER="3000" SUBSYSTEM=="tty", GROUP="4000" SUBSYSTEM=="tty", MODE="0777" KERNEL=="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444" -KERNEL=="ttyACM[0-9]*", NAME="ttyACM%n", GROUP="8000" +KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", GROUP="8000" EOF }, { @@ -782,7 +782,7 @@ EOF exp_name => "node", exp_majorminor => "8:0", rules => < "node", exp_majorminor => "4095:1", rules => < "node", exp_majorminor => "4095:89999", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink2-ttyACM0", - exp_target => "ttyACM-0", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "one", not_exp_name => " ", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem0", - exp_target => "ttyACM0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/symlink" , exp_target => "a/b/node", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/c/d/symlink" , exp_target => "../../a/b/node", + exp_rem_error => "yes", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "second-0" , - exp_target => "modem" , rules => < "symlink only rule", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "symlink-only2", - exp_target => "link", - rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => ".", - exp_target => "link", exp_add_error => "yes", exp_rem_error => "yes", rules => < "tty", devpath => "/devices/virtual/tty/tty0", exp_name => "link", - exp_target => "link", exp_add_error => "yes", exp_rem_error => "yes", option => "clean", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink-ttyACM0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "major-166:0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "this", - exp_target => "ttyACM0", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "test", - exp_target => "link", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "166:0", - exp_target => "ttyACM0", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link1", - exp_target => "node", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link4", - exp_target => "node", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node6", + exp_rem_error => "yes", rules => < "node", exp_rem_error => "yes", rules => < "ignore remove event test (with all partitions)", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node14", + exp_name => "sda14", exp_rem_error => "yes", option => "clean", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "devpath substitution test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "main_device", option => "keep", + exp_rem_error => "yes", rules => < "main_device-part-1", option => "clean", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "start-udev-root-end", rules => < "last", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "match", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "not-anything", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "nonzero-program", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "true", rules => < "true", rules => < "true", rules => < < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "uber", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "replaced", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "serial-354172020305000", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "apply NAME final", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "link", - exp_target => "ok", - rules => < "test RUN key", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink", - exp_target => "ok", - exp_rem_error => "yes", - option => "clean", - rules => < "test RUN key and DEVNAME", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink", - exp_target => "ok", - exp_rem_error => "yes", - option => "clean", - rules => < < "root:tty:0640", rules => < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node-add-me", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "three", not_exp_name => "two", - exp_target => "node", 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 (non-empty override)", + desc => "test empty SYMLINK+ (empty override)", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", + not_exp_name => "wrong", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "keep", rules => < "parentenv-parent_right", option => "clean", rules => < "right", rules => < "right", rules => < "NAME compare test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "link", - exp_target => "node", - not_exp_name => "wronglink", - rules => < "NAME compare test 2", + desc => "SYMLINK+ compare test", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "link2", - exp_target => "sda1", - not_exp_name => "link", + exp_name => "right", + not_exp_name => "wrong", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "00:16:41:e2:8d:ff", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "there", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "relative", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "found-subdir", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0000", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "5000:100:0400", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0660", + exp_rem_error => "yes", rules => < <{desc}\n"; if ($rules->{exp_target}) { - print "device \'$rules->{devpath}\' expecting symlink '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; + print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; } else { - print "device \'$rules->{devpath}\' expecting node \'$rules->{exp_name}\'\n"; + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; } @@ -1813,7 +1719,8 @@ sub run_test { 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++ + $error++; + sleep(1); } } @@ -1842,6 +1749,7 @@ sub run_test { system("tree $udev_root"); print "\n"; $error++; + sleep(1); } } @@ -1861,6 +1769,7 @@ sub run_test { system("tree $udev_root"); print "\n"; $error++; + sleep(1); } } else { print "remove: ok\n"; -- 2.39.5