diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-09-01 16:20:06 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-09-01 16:20:06 +0200 |
commit | e08109cbc82bc37fc0a1deb202697790afdc5474 (patch) | |
tree | c073e3a5c71a7aaa7b7d310589ab8e2a75f60e6d /test/udev-test.pl | |
parent | 424756eda38b13d853fa8a392d6f0df3e4e802ae (diff) |
udev-test.pl: add --valgrind option
Diffstat (limited to 'test/udev-test.pl')
-rwxr-xr-x | test/udev-test.pl | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index ad551dd042..6cd4849045 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -20,16 +20,16 @@ use warnings; use strict; -my $PWD = $ENV{PWD}; -my $sysfs = "sys/"; -my $udev_bin = "../udev/test-udev"; -my $udev_root = "udev-root/"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; +my $PWD = $ENV{PWD}; +my $sysfs = "sys/"; +my $udev_bin = "../udev/test-udev"; +my $valgrind = 0; +my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; +my $udev_root = "udev-root/"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; # uncomment following line to run udev with valgrind. -# Should make this a runtime option to the script someday... -#my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( { @@ -1656,7 +1656,11 @@ sub udev { close CONF; $ENV{ACTION} = $action; - system("$udev_bin $subsys"); + if ($valgrind > 0) { + system("$udev_bin_valgrind $subsys"); + } else { + system("$udev_bin $subsys"); + } } my $error = 0; @@ -1857,16 +1861,25 @@ print CONF "udev_log=\"info\"\n"; close CONF; my $test_num = 1; +my @list; -if ($ARGV[0]) { - # only run one test - $test_num = $ARGV[0]; - - if (defined($tests[$test_num-1]->{desc})) { - print "udev-test will run test number $test_num only:\n\n"; - run_test($tests[$test_num-1], $test_num); +foreach my $arg (@ARGV) { + if ($arg =~ m/--valgrind/) { + $valgrind = 1; + printf("using valgrind\n"); } else { - print "test does not exist.\n"; + push(@list, $arg); + } +} + +if ($list[0]) { + foreach my $arg (@list) { + if (defined($tests[$arg-1]->{desc})) { + print "udev-test will run test number $arg:\n\n"; + run_test($tests[$arg-1], $arg); + } else { + print "test does not exist.\n"; + } } } else { # test all |