From 3e7fbae72cf2358a324fd5d796be52ac8e80c101 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Sep 2007 11:16:16 +0000 Subject: [PATCH] r24887: Support reading testlists from other locations (e.g. Samba3) (This used to be commit 88537c5affb91050b1cce244688d99624d0f6c7d) --- source4/selftest/selftest.pl | 55 +++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 39755e692df..db5bd2cf27c 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -138,6 +138,7 @@ my $opt_resetup_env = undef; my $opt_bindir = undef; my $opt_no_lazy_setup = undef; my $opt_format = "plain"; +my @opt_testlists = (); my $srcdir = "."; my $builddir = "."; @@ -270,6 +271,7 @@ Usage: $Script [OPTIONS] PREFIX Generic options: --help this help page --target=samba4|samba3|win Samba version to target + --testlist=FILE file to read available tests from Paths: --prefix=DIR prefix to run tests in [st] @@ -321,6 +323,7 @@ my $result = GetOptions ( 'resetup-environment' => \$opt_resetup_env, 'bindir:s' => \$opt_bindir, 'format=s' => \$opt_format, + 'testlist=s' => \@opt_testlists ); exit(1) if (not $result); @@ -533,28 +536,42 @@ $ENV{CONFIGURATION} = "--configfile=$conffile"; my %required_envs = (); -if ($opt_quick) { - open(IN, "$testsdir/tests_quick.sh|"); -} else { - open(IN, "$testsdir/tests_all.sh|"); -} -while () { - if ($_ eq "-- TEST --\n") { - my $name = ; - $name =~ s/\n//g; - my $env = ; - $env =~ s/\n//g; - my $cmdline = ; - $cmdline =~ s/\n//g; - if (not defined($tests) or $name =~ /$tests/) { - $required_envs{$env} = 1; - push (@todo, [$name, $env, $cmdline]); +sub read_testlist($) +{ + my ($filename) = @_; + + my @ret = (); + open(IN, $filename) or die("Unable to open $filename: $!"); + + while () { + if ($_ eq "-- TEST --\n") { + my $name = ; + $name =~ s/\n//g; + my $env = ; + $env =~ s/\n//g; + my $cmdline = ; + $cmdline =~ s/\n//g; + if (not defined($tests) or $name =~ /$tests/) { + $required_envs{$env} = 1; + push (@ret, [$name, $env, $cmdline]); + } + } else { + print; } - } else { - print; } + close(IN) or die("Error creating recipe"); + return @ret; +} + +if ($opt_quick) { + @todo = read_testlist("$testsdir/tests_quick.sh|"); +} else { + @todo = read_testlist("$testsdir/tests_all.sh|"); +} + +foreach (@opt_testlists) { + push(@todo, read_testlist($_)); } -close(IN) or die("Error creating recipe"); my $suitestotal = $#todo + 1; my $i = 0; -- 2.34.1