svn commit: samba r24887 - in branches/SAMBA_4_0: . source/selftest

jelmer at samba.org jelmer at samba.org
Sun Sep 2 11:16:18 GMT 2007


Author: jelmer
Date: 2007-09-02 11:16:16 +0000 (Sun, 02 Sep 2007)
New Revision: 24887

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24887

Log:
Support reading testlists from other locations (e.g. Samba3)
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/selftest/selftest.pl


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/selftest/selftest.pl
===================================================================
--- branches/SAMBA_4_0/source/selftest/selftest.pl	2007-09-02 03:57:56 UTC (rev 24886)
+++ branches/SAMBA_4_0/source/selftest/selftest.pl	2007-09-02 11:16:16 UTC (rev 24887)
@@ -138,6 +138,7 @@
 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 @@
 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 @@
 		'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 @@
 
 my %required_envs = ();
 
+sub read_testlist($)
+{
+	my ($filename) = @_;
+
+	my @ret = ();
+	open(IN, $filename) or die("Unable to open $filename: $!");
+
+	while (<IN>) {
+		if ($_ eq "-- TEST --\n") {
+			my $name = <IN>;
+			$name =~ s/\n//g;
+			my $env = <IN>;
+			$env =~ s/\n//g;
+			my $cmdline = <IN>;
+			$cmdline =~ s/\n//g;
+			if (not defined($tests) or $name =~ /$tests/) {
+				$required_envs{$env} = 1;
+				push (@ret, [$name, $env, $cmdline]);
+			}
+		} else {
+			print;
+		}
+	}
+	close(IN) or die("Error creating recipe");
+	return @ret;
+}
+
 if ($opt_quick) {
-	open(IN, "$testsdir/tests_quick.sh|");
+	@todo = read_testlist("$testsdir/tests_quick.sh|");
 } else {
-	open(IN, "$testsdir/tests_all.sh|");
+	@todo = read_testlist("$testsdir/tests_all.sh|");
 }
-while (<IN>) {
-	if ($_ eq "-- TEST --\n") {
-		my $name = <IN>;
-		$name =~ s/\n//g;
-		my $env = <IN>;
-		$env =~ s/\n//g;
-		my $cmdline = <IN>;
-		$cmdline =~ s/\n//g;
-		if (not defined($tests) or $name =~ /$tests/) {
-			$required_envs{$env} = 1;
-			push (@todo, [$name, $env, $cmdline]);
-		}
-	} else {
-		print;
-	}
+
+foreach (@opt_testlists) {
+	push(@todo, read_testlist($_));
 }
-close(IN) or die("Error creating recipe");
 
 my $suitestotal = $#todo + 1;
 my $i = 0;



More information about the samba-cvs mailing list