diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-04-10 22:20:12 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-04-10 22:38:32 +0200 |
commit | 64bf8c400c8076316929cb6f06346bdf1c48d9d7 (patch) | |
tree | 7cb1fcf57fcc613474f66dcff6ea06d207149ac1 | |
parent | 4fb98b6856fd0174d0f41f390e28027da636c307 (diff) | |
download | samba-64bf8c400c8076316929cb6f06346bdf1c48d9d7.tar.gz |
selftest: Support passing --load-list to test runners.
-rwxr-xr-x | selftest/selftest.pl | 20 | ||||
-rwxr-xr-x | source4/selftest/tests.sh | 15 |
2 files changed, 30 insertions, 5 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl index fb2e1a8a61..7bc14b12cb 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -125,6 +125,7 @@ use strict; use FindBin qw($RealBin $Script); use File::Spec; +use File::Temp qw(tempfile); use Getopt::Long; use POSIX; use Cwd qw(abs_path); @@ -224,9 +225,9 @@ sub expand_environment_strings($) return $s; } -sub run_testsuite($$$$$$) +sub run_testsuite($$$$$) { - my ($envname, $name, $cmd, $i, $totalsuites, $tests_to_run) = @_; + my ($envname, $name, $cmd, $i, $totalsuites) = @_; my $pcap_file = setup_pcap($name); Subunit::start_testsuite($name); @@ -639,7 +640,8 @@ sub read_testlist($) open(IN, $filename) or die("Unable to open $filename: $!"); while (<IN>) { - if ($_ eq "-- TEST --\n") { + if (/-- TEST(-LOADLIST)? --\n/) { + my $supports_loadlist = ($1 eq "-LOADLIST"); my $name = <IN>; $name =~ s/\n//g; my $env = <IN>; @@ -648,7 +650,7 @@ sub read_testlist($) $cmdline =~ s/\n//g; if (should_run_test($name) == 1) { $required_envs{$env} = 1; - push (@ret, [$name, $env, $cmdline]); + push (@ret, [$name, $env, $cmdline, $supports_loadlist]); } } else { print; @@ -934,8 +936,16 @@ $envvarstr next; } + if ($$_[3] and $individual_tests and $individual_tests->{$name}) { + my ($fh, $listid_file) = tempfile(UNLINK => 0); + foreach (@{$individual_tests->{$name}}) { + print $fh "$_\n"; + } + $cmd .= " --load-list=$listid_file"; + } + run_testsuite($envname, $name, $cmd, $i, $suitestotal, - ($individual_tests and $individual_tests->{$name})); + ); if (defined($opt_analyse_cmd)) { system("$opt_analyse_cmd \"$name\""); diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index d4f7e47290..da0b4e329b 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -43,6 +43,21 @@ plantestsuite() { echo $cmdline } +plantestsuite_loadlist() { + name=$1 + env=$2 + shift 2 + cmdline="$*" + echo "-- TEST-LOADLIST --" + if [ "$env" = "none" ]; then + echo "samba4.$name" + else + echo "samba4.$name ($env)" + fi + echo $env + echo $cmdline +} + skiptestsuite() { name=$1 reason=$2 |