summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-13 16:08:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:35 -0500
commit1e29e06d8036da9d87d85e160163379893fda954 (patch)
tree127b8f49cf4462bd618ca53afd2bc97e198b4ce1
parent02097b0955a6f2f673faa64a660491e1596fe14b (diff)
downloadsamba-1e29e06d8036da9d87d85e160163379893fda954.tar.gz
samba-1e29e06d8036da9d87d85e160163379893fda954.tar.bz2
samba-1e29e06d8036da9d87d85e160163379893fda954.zip
r20737: Add option parsing.
(This used to be commit b1719ebf3812b79715cf4e549426d798571b4908)
-rwxr-xr-xsource4/script/tests/selftest.pl37
1 files changed, 33 insertions, 4 deletions
diff --git a/source4/script/tests/selftest.pl b/source4/script/tests/selftest.pl
index 169dc9edd8..088cab16a6 100755
--- a/source4/script/tests/selftest.pl
+++ b/source4/script/tests/selftest.pl
@@ -7,6 +7,7 @@ use warnings;
use FindBin qw($RealBin $Script);
use File::Spec;
+use Getopt::Long;
use POSIX;
use Cwd;
@@ -91,7 +92,35 @@ EOF
exit $failed;
}
-die("Usage: $Script PREFIX TESTS [SOCKET_WRAPPER]") if ( $#ARGV == -1);
+sub ShowHelp()
+{
+ print "Samba test runner
+Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
+
+Usage: $Script PREFIX TESTS [SOCKET_WRAPPER]
+
+Generic options:
+ --help this help page
+ --target=samba4|samba3 Samba version to target
+
+";
+ exit(0);
+}
+
+my $opt_help = 0;
+my $opt_target = "samba4";
+
+my $result = GetOptions (
+ 'help|h|?' => \$opt_help,
+ 'target' => \$opt_target
+ );
+
+if (not $result) {
+ exit(1);
+}
+
+ShowHelp() if ($opt_help);
+ShowHelp() if ($#ARGV <= 0);
my $prefix = shift;
my $tests = shift;
@@ -160,14 +189,14 @@ if ( defined($socket_wrapper) and $socket_wrapper eq "SOCKET_WRAPPER")
print "NOT USING SOCKET_WRAPPER\n";
}
-#Start slapd before smbd
+# Start slapd before smbd
if ($ldap) {
slapd_start($ENV{SLAPD_CONF}, $ENV{LDAPI_ESCAPE}) or die("couldn't start slapd");
print "LDAP PROVISIONING...";
system("$bindir/smbscript $setupdir/provision $ENV{PROVISION_OPTIONS} --ldap-backend=$ENV{LDAPI}") or
die("LDAP PROVISIONING failed: $bindir/smbscript $setupdir/provision $ENV{PROVISION_OPTIONS} --ldap-backend=$ENV{LDAPI}");
- #LDAP is slow
+ # LDAP is slow
$torture_maxtime *= 2;
}
@@ -189,7 +218,7 @@ $ENV{TORTURE_INTERFACES} = '127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.
my @torture_options = ("--option=interfaces=$ENV{TORTURE_INTERFACES} $ENV{CONFIGURATION}");
# ensure any one smbtorture call doesn't run too long
push (@torture_options, "--maximum-runtime=$torture_maxtime");
-push (@torture_options, "--target=samba4");
+push (@torture_options, "--target=$opt_target");
push (@torture_options, "--option=torture:progress=no")
if (defined($ENV{RUN_FROM_BUILD_FARM}) and $ENV{RUN_FROM_BUILD_FARM} eq "yes");