X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=test%2Fudev-test.pl;h=2ece4317351a747431bdae0bed6f1975bc7e6ec5;hb=3e5958dee5f24283eb5c6a2d2d95e1a39428a3b8;hp=8ee8ba5414698f35ce9846584e1bdf27e1dd7268;hpb=8b36cc0f179ee35176016ab67ae53078df4110fa;p=elogind.git diff --git a/test/udev-test.pl b/test/udev-test.pl index 8ee8ba541..2ece43173 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -14,14 +14,8 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# happy testing, # Kay Sievers , 2003 -# -# Modified April 9, 2004 by Leann Ogasawara -# - expanded @tests array to add more symlinks and permissions tests -# - some of the symlinks tests also test lack of node creation -# - added symlink_test() function -# - moved permissions and major_minor tests into their own functions +# Leann Ogasawara , 2004 use warnings; use strict; @@ -45,8 +39,8 @@ my @tests = ( devpath => "/block/sda", exp_name => "boot_disk" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "visor" , conf => < "visor" , conf => < "visor" , conf => < "Handle backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "preserve backslashes, if they are not for a newline", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "aaa", + conf => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "/class/tty/ttyUSB0", exp_name => "sub/direct/ory/visor" , conf => < "/block/sda/sda3", exp_name => "first_disk3" , conf => < "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => < "old style SYSFS_ attribute", - subsys => "block", - devpath => "/block/sda", - exp_name => "good" , - conf => < "/block/sda", exp_name => "disk-IBM-ESXS-sda" , conf => < "/block/sda/sda3", exp_name => "special-device-3" , conf => < "/block/sda/sda3", exp_name => "subsys_block" , conf => < "/block/sda/sda3", exp_name => "newline_removed" , conf => < "/block/sda/sda3", exp_name => "test-0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "escape-3" , conf => < "/block/sda/sda3", exp_name => "foo9" , conf => < "/block/sda/sda3", exp_name => "bar9" , conf => < "/block/sda/sda3", exp_name => "foo7" , conf => < "/block/sda/sda3", exp_name => "my-foo9" , conf => < "/block/sda/sda3", exp_name => "my-foo8" , conf => < "/class/tty/console", exp_name => "TTY" , conf => < "/class/tty/console", exp_name => "foo" , conf => < "/class/tty/console", exp_name => "TTY" , conf => < "/class/tty/console", exp_name => "foo" , conf => < "/block/sda", exp_name => "scsi-0:0:0:0" , conf => < "/block/sda", exp_name => "boot_disk15" , conf => < "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "/block/cciss!c0d0/cciss!c0d0p1", exp_name => "cciss/c0d0p1" , conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "ignored", conf => < "/block/sda", exp_name => "matched-with-space", conf => < "tty", devpath => "/class/tty/tty33", exp_name => "tty33", - exp_perms => "0:0:0600", + exp_perms => "0:0:0660", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_perms => "5000::0600", + exp_perms => "5000::0660", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_perms => ":100:0600", + exp_perms => ":100:0660", conf => < "node", exp_perms => "::0777", conf => < "node", exp_perms => "5000:100:0777", conf => < "ttyUSB0", exp_perms => "5000::", conf => < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", - exp_perms => ":100:0600", + exp_perms => ":100:0660", conf => < "ttyUSB0", exp_perms => "::0060", conf => < "ttyUSB0", exp_perms => "5000:100:0777", conf => < "permissions only rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "5000:100:0777", + conf => < "multiple permissions only rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "3000:4000:0777", + conf => < "permissions only rule with override at NAME rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "3000:8000:0777", + conf => < "node", exp_majorminor => "8:0", conf => < "node", exp_majorminor => "89:300", conf => < "node", exp_majorminor => "4095:1", conf => < "node", exp_majorminor => "4094:89999", conf => < "symlink2-ttyUSB0", exp_target => "ttyUSB0", conf => < "visor0", exp_target => "ttyUSB0", conf => < "1/2/symlink" , exp_target => "a/b/node", conf => < "1/2/c/d/symlink" , exp_target => "../../a/b/node", conf => < "second-0" , exp_target => "visor" , conf => < "symlink-only2", exp_target => "link", conf => < "symlink name empty", - subsys => "block", - devpath => "/block/sda", - exp_name => "", - exp_target => "link", - exp_error => "yes", - conf => < "/block/sda", exp_name => ".", exp_target => "link", - exp_error => "yes", - conf => < "symlink to empty name", - subsys => "block", - devpath => "/block/sda", - exp_name => "symlink", - exp_target => "", - exp_error => "yes", - conf => < "symlink and name empty", - subsys => "block", - devpath => "/block/sda", - exp_name => "", - exp_target => "", - exp_error => "yes", + exp_add_error => "yes", + exp_rem_error => "yes", conf => < "/class/tty/tty0", exp_name => "link", exp_target => "link", + exp_rem_error => "yes", + option => "clear", conf => < "symlink0", exp_target => "ttyUSB0", conf => < "symlink-ttyUSB0", exp_target => "ttyUSB0", conf => < "major-188:0", exp_target => "ttyUSB0", conf => < "symlink-0:0:0:0", exp_target => "node", conf => < "test", exp_target => "ttyUSB0", conf => < "test", exp_target => "ttyUSB0", conf => < "this", exp_target => "ttyUSB0", conf => < "test", exp_target => "link", conf => < "188:0", exp_target => "ttyUSB0", conf => < "188", exp_target => "ttyUSB0", conf => < "percent%sign", exp_target => "ttyUSB0", conf => < "%ttyUSB0_name", exp_target => "ttyUSB0", conf => < "link1", exp_target => "node", conf => < "link4", exp_target => "node", conf => < "/block/sda", exp_name => "cdrom", conf => < "enumeration char test sequence (1/5 keep)", + desc => "enumeration char test sequence 1/5 (keep)", subsys => "block", devpath => "/block/sda", exp_name => "cdrom", option => "keep", conf => < "enum", option => "keep", conf => < "cdrom1", option => "keep", conf => < "enum1", option => "keep", conf => < "cdrom2", option => "clear", conf => < "/block/sda", exp_name => "cdrom", conf => < "ignore rule test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_add_error => "yes", + conf => < "all_partitions, option-only rule", + subsys => "block", + devpath => "/block/sda", + exp_name => "node6", + conf => < "all_partitions, option-only rule (fail on partition)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "node6", + exp_add_error => "yes", + conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_error => "yes", + exp_rem_error => "yes", conf => < "block", devpath => "/block/sda", exp_name => "node14", - exp_error => "yes", + exp_rem_error => "yes", option => "clear", conf => < "/block/sda", exp_name => "node", conf => < "/block/sda", exp_name => "node", conf => < "temporary node creation test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + conf => < "devpath substitution test", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + conf => < "parent node name substitution test sequence 1/2 (keep)", + subsys => "block", + devpath => "/block/sda", + exp_name => "main_device", + option => "keep", + conf => < "parent node name substitution test sequence 2/2 (clean)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "main_device-part-1", + option => "clean", + conf => < "udev_root substitution", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "start-udev-root-end", + conf => < "last_rule option", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "last", + conf => < "negation KERNEL!=", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "match", + conf => < "negation SUBSYSTEM!=", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "not-anything", + conf => < "negation PROGRAM!= exit code", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "nonzero-program", + conf => < "test for whitespace between the operator", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => < "ENV{} test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => < "ENV{} test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => <{exp_name}\' to \'$config->{exp_target}\'\n"; print "created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { $error++; @@ -1091,7 +1278,7 @@ sub symlink_test { } else { print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; print "symlink: not created "; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { $error++; @@ -1130,7 +1317,7 @@ sub run_test { print "add: ok "; } else { print "add: error "; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { print "\n\n"; @@ -1149,7 +1336,7 @@ sub run_test { if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { print "remove: error "; - if ($config->{exp_error}) { + if ($config->{exp_rem_error}) { print "as expected\n\n"; } else { print "\n\n"; @@ -1185,9 +1372,6 @@ open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$conf_tmp\"\n"; -print CONF "default_mode=\"0600\"\n"; -print CONF "default_owner=\"root\"\n"; -print CONF "default_group=\"root\"\n"; close CONF; my $test_num = 1;