diff options
author | greg@kroah.com <greg@kroah.com> | 2004-02-12 00:49:52 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:32:26 -0700 |
commit | 2e31718495a89e6b582240ed527950f78e7d1849 (patch) | |
tree | ba9a0c55349f4f20a1e9b5590741e56fa0cd281a /test | |
parent | 1b9410278e40850bdcedb2fdfc0f815361b1c303 (diff) |
[PATCH] let udev-test.pl run an individual test if you ask it to.
just put the test number on the command line:
udev-test.pl 3
will run test number 3
If no test number is specified, all of the tests will be run, just like before.
Diffstat (limited to 'test')
-rw-r--r-- | test/udev-test.pl | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index 1bce65885e..c433b84a97 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -93,6 +93,16 @@ KERNEL="ttyUSB*", NAME="visor/%n" EOF }, { + desc => "catch device by * - take 2", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor/0" , + conf => <<EOF +KERNEL="*USB1", NAME="bad" +KERNEL="*USB0", NAME="visor/%n" +EOF + }, + { desc => "catch device by ?", subsys => "tty", devpath => "class/tty/ttyUSB0", @@ -360,25 +370,12 @@ sub udev { system("$udev_bin $subsys"); } - -# prepare -system("rm -rf $udev_root"); -mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; - -# test my $error = 0; -print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; - -# create initial config file -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 "udev_permissions=\"$perm\"\n"; -close CONF; -foreach my $config (@tests) { - print "TEST: $config->{desc}\n"; +sub run_test { + my ($config, $number) = @_; + + print "TEST $number: $config->{desc}\n"; print "device \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); @@ -402,6 +399,37 @@ foreach my $config (@tests) { } } +# prepare +system("rm -rf $udev_root"); +mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + +# create initial config file +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 "udev_permissions=\"$perm\"\n"; +close CONF; + +my $test_num = 1; + +if ($ARGV[0]) { + # only run one test + $test_num = $ARGV[0]; + print "udev-test will run test number $test_num only\n"; + + run_test($tests[$test_num], $test_num); +} else { + # test all + print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + + foreach my $config (@tests) { + run_test($config, $test_num); + $test_num++; + + } +} + print "$error errors occured\n\n"; # cleanup |