summaryrefslogtreecommitdiff
path: root/source4/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-13 20:02:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:35 -0500
commit1d1315adcd429cdfcecc1bfa2df554481ba60b5f (patch)
treeab84fc17807488fdcf11acf3d7fbdef77828ded8 /source4/script
parent1e29e06d8036da9d87d85e160163379893fda954 (diff)
downloadsamba-1d1315adcd429cdfcecc1bfa2df554481ba60b5f.tar.gz
samba-1d1315adcd429cdfcecc1bfa2df554481ba60b5f.tar.bz2
samba-1d1315adcd429cdfcecc1bfa2df554481ba60b5f.zip
r20739: Add more command-line options.
(This used to be commit 8ca927f8883ec7b7e9c91ae2c2df2cac2110601d)
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/tests/selftest.pl64
1 files changed, 45 insertions, 19 deletions
diff --git a/source4/script/tests/selftest.pl b/source4/script/tests/selftest.pl
index 088cab16a6..bb76eff913 100755
--- a/source4/script/tests/selftest.pl
+++ b/source4/script/tests/selftest.pl
@@ -97,11 +97,13 @@ sub ShowHelp()
print "Samba test runner
Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
-Usage: $Script PREFIX TESTS [SOCKET_WRAPPER]
+Usage: $Script PREFIX
Generic options:
- --help this help page
- --target=samba4|samba3 Samba version to target
+ --help this help page
+ --target=samba4|samba3|win Samba version to target
+ --socket-wrapper enable socket wrapper
+ --quick run quick overall test
";
exit(0);
@@ -109,10 +111,14 @@ Generic options:
my $opt_help = 0;
my $opt_target = "samba4";
+my $opt_quick = 0;
+my $opt_socket_wrapper = 0;
my $result = GetOptions (
'help|h|?' => \$opt_help,
- 'target' => \$opt_target
+ 'target' => \$opt_target,
+ 'socket-wrapper' => \$opt_socket_wrapper,
+ 'quick' => \$opt_quick
);
if (not $result) {
@@ -120,11 +126,9 @@ if (not $result) {
}
ShowHelp() if ($opt_help);
-ShowHelp() if ($#ARGV <= 0);
+ShowHelp() if ($#ARGV < 0);
my $prefix = shift;
-my $tests = shift;
-my $socket_wrapper = shift;
my $torture_maxtime = $ENV{TORTURE_MAXTIME};
unless (defined($torture_maxtime)) {
@@ -154,10 +158,7 @@ my $bindir = "$srcdir/bin";
my $setupdir = "$srcdir/setup";
my $testsdir = "$srcdir/script/tests";
-my $tls_enabled = 0;
-if ($tests eq "all") {
- $tls_enabled = 1;
-}
+my $tls_enabled = not $opt_quick;
$ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no");
$ENV{LD_LDB_MODULE_PATH} = "$old_pwd/bin/modules/ldb";
@@ -170,17 +171,36 @@ if (defined($ENV{LD_LIBRARY_PATH})) {
$ENV{PKG_CONFIG_PATH} = "$old_pwd/bin/pkgconfig:$ENV{PKG_CONFIG_PATH}";
$ENV{PATH} = "$old_pwd/bin:$ENV{PATH}";
-print "PROVISIONING...";
-open(IN, "$RealBin/mktestsetup.sh $prefix|") or die("Unable to setup");
-while (<IN>) {
- next unless (/^([A-Z_]+)=(.*)$/);
- $ENV{$1} = $2;
+if ($opt_target eq "samba4") {
+ print "PROVISIONING...";
+ open(IN, "$RealBin/mktestsetup.sh $prefix|") or die("Unable to setup");
+ while (<IN>) {
+ next unless (/^([A-Z_]+)=(.*)$/);
+ $ENV{$1} = $2;
+ }
+ close(IN);
+} elsif ($opt_target eq "win") {
+ die ("Windows tests will not run without root privileges.")
+ if (`whoami` ne "root");
+
+ die("Windows tests will not run with socket wrapper enabled.")
+ if ($opt_socket_wrapper);
+
+ die("Windows tests will not run quickly.") if ($opt_quick);
+
+ die("Environment variable WINTESTCONF has not been defined.\n".
+ "Windows tests will not run unconfigured.") if (not defined($ENV{WINTESTCONF}));
+
+ die ("$ENV{WINTESTCONF} could not be read.") if (! -r $ENV{WINTESTCONF});
+
+ $ENV{WINTEST_DIR}="$ENV{SRCDIR}/script/tests/win";
+} else {
+ die("unknown target `$opt_target'");
}
-close(IN);
my $socket_wrapper_dir = undef;
-if ( defined($socket_wrapper) and $socket_wrapper eq "SOCKET_WRAPPER")
+if ( $opt_socket_wrapper)
{
$socket_wrapper_dir = "$prefix/w";
$ENV{SOCKET_WRAPPER_DIR} = $socket_wrapper_dir;
@@ -245,7 +265,13 @@ system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}");
$ENV{failed} = 0;
$ENV{totalfailed} = 0;
-system("$testsdir/tests_$tests.sh");
+if ($opt_target eq "win") {
+ system("$testsdir/test_win.sh");
+} elsif ($opt_quick) {
+ system("$testsdir/tests_quick.sh");
+} else {
+ system("$testsdir/tests_all.sh");
+}
close(DATA);