[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha2-827-g625ea49
Andrew Tridgell
tridge at samba.org
Fri Feb 15 03:56:39 GMT 2008
The branch, v4-0-test has been updated
via 625ea49a95cbdb507ea5b191f75ffa27e25cdb90 (commit)
via af6484f78d273407dd9b264bc4adb33497eee48b (commit)
via b6ba0afc1424a1d202626aabf1cd0f28246319a6 (commit)
via 9c12b5b49679d404ac623041f2da944019f97754 (commit)
via 2633f4259ed30ab990017c4c3205f92bf38f0135 (commit)
from bc4e03f2ddb669758e27e2a5c32e15c7d6c5257d (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit 625ea49a95cbdb507ea5b191f75ffa27e25cdb90
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Feb 15 14:55:31 2008 +1100
converted locktest to use popt and cmdline utility code
commit af6484f78d273407dd9b264bc4adb33497eee48b
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Feb 15 14:27:06 2008 +1100
added blackbox testing for locktest
commit b6ba0afc1424a1d202626aabf1cd0f28246319a6
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Feb 15 14:11:11 2008 +1100
add some info on running tests
commit 9c12b5b49679d404ac623041f2da944019f97754
Merge: 2633f4259ed30ab990017c4c3205f92bf38f0135 bc4e03f2ddb669758e27e2a5c32e15c7d6c5257d
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Feb 15 13:30:55 2008 +1100
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
commit 2633f4259ed30ab990017c4c3205f92bf38f0135
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Feb 15 13:29:32 2008 +1100
fixed loadparm handling in standalone tests
-----------------------------------------------------------------------
Summary of changes:
source/selftest/README | 21 +++++
source/selftest/samba4_tests.sh | 1 +
source/selftest/target/Samba4.pm | 16 +++-
source/torture/config.mk | 3 +
source/torture/gentest.c | 2 +-
source/torture/locktest.c | 162 +++++++++++++++--------------------
source/torture/masktest.c | 2 +-
testprogs/blackbox/test_locktest.sh | 41 +++++++++
8 files changed, 151 insertions(+), 97 deletions(-)
create mode 100755 testprogs/blackbox/test_locktest.sh
Changeset truncated at 500 lines:
diff --git a/source/selftest/README b/source/selftest/README
index 3250f32..e8e87c8 100644
--- a/source/selftest/README
+++ b/source/selftest/README
@@ -39,3 +39,24 @@ The following environments are currently available:
* DOMAIN: Domain name
* REALM: Realm name
* SERVER: Name of the member server
+
+
+=============
+Running tests
+=============
+
+To run all the tests use:
+
+ make test
+
+To run a quick subset (aiming for about 1 minute of testing) run:
+
+ make quicktest
+
+To run a specific test, use this syntax
+
+ make test TESTS=testname
+
+for example
+
+ make test TESTS=samba4.BASE-DELETE
diff --git a/source/selftest/samba4_tests.sh b/source/selftest/samba4_tests.sh
index 2595d51..ab7065c 100755
--- a/source/selftest/samba4_tests.sh
+++ b/source/selftest/samba4_tests.sh
@@ -253,6 +253,7 @@ plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PAS
plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN"
plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP"
+plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
# Tests using the "Simple" NTVFS backend
diff --git a/source/selftest/target/Samba4.pm b/source/selftest/target/Samba4.pm
index fba0f6a..563aca8 100644
--- a/source/selftest/target/Samba4.pm
+++ b/source/selftest/target/Samba4.pm
@@ -525,7 +525,7 @@ sub provision($$$$$$)
(system("rm -rf $prefix/*") == 0) or die("Unable to clean up");
mkdir($_, 0777) foreach ($privatedir, $etcdir, $piddir, $ncalrpcdir, $lockdir,
- $tmpdir);
+ $tmpdir, "$tmpdir/test1", "$tmpdir/test2");
my $localbasedn = $basedn;
@@ -569,6 +569,20 @@ sub provision($$$$$$)
posix:sharedelay = 100000
posix:eadb = $lockdir/eadb.tdb
+[test1]
+ path = $tmpdir/test1
+ read only = no
+ ntvfs handler = posix
+ posix:sharedelay = 100000
+ posix:eadb = $lockdir/eadb.tdb
+
+[test2]
+ path = $tmpdir/test2
+ read only = no
+ ntvfs handler = posix
+ posix:sharedelay = 100000
+ posix:eadb = $lockdir/eadb.tdb
+
[cifs]
read only = no
ntvfs handler = cifs
diff --git a/source/torture/config.mk b/source/torture/config.mk
index 0c5e641..18e5ea7 100644
--- a/source/torture/config.mk
+++ b/source/torture/config.mk
@@ -362,6 +362,9 @@ INSTALLDIR = BINDIR
OBJ_FILES = \
locktest.o
PRIVATE_DEPENDENCIES = \
+ LIBPOPT \
+ POPT_SAMBA \
+ POPT_CREDENTIALS \
LIBSAMBA-UTIL \
LIBCLI_SMB \
LIBSAMBA-CONFIG
diff --git a/source/torture/gentest.c b/source/torture/gentest.c
index d50393b..8fa433a 100644
--- a/source/torture/gentest.c
+++ b/source/torture/gentest.c
@@ -2205,7 +2205,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
argc -= NSERVERS;
argv += NSERVERS;
- lp_ctx = loadparm_init(talloc_autofree_context());
+ global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
servers[0].credentials = cli_credentials_init(talloc_autofree_context());
diff --git a/source/torture/locktest.c b/source/torture/locktest.c
index 90e2eec..ebc325f 100644
--- a/source/torture/locktest.c
+++ b/source/torture/locktest.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "lib/cmdline/popt_common.h"
#include "system/filesys.h"
#include "system/time.h"
#include "pstring.h"
@@ -29,15 +30,15 @@
#include "libcli/resolve/resolve.h"
static int numops = 1000;
-static bool showall;
-static bool analyze;
-static bool hide_unlock_fails;
-static bool use_oplocks;
+static int showall;
+static int analyze;
+static int hide_unlock_fails;
+static int use_oplocks;
static uint_t lock_range = 100;
static uint_t lock_base = 0;
static uint_t min_length = 0;
-static bool exact_error_codes;
-static bool zero_zero;
+static int exact_error_codes;
+static int zero_zero;
#define FILENAME "\\locktest.dat"
@@ -520,26 +521,10 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
-static void usage(void)
+_NORETURN_ static void usage(poptContext pc)
{
- printf(
-"Usage:\n\
- locktest //server1/share1 //server2/share2 [options..]\n\
- options:\n\
- -U user%%pass (may be specified twice)\n\
- -s seed\n\
- -o numops\n\
- -u hide unlock fails\n\
- -a (show all ops)\n\
- -A analyse for minimal ops\n\
- -O use oplocks\n\
- -E enable exact error code checking\n\
- -Z enable the zero/zero lock\n\
- -R range set lock range\n\
- -B base set lock base\n\
- -M min set min lock length\n\
- -l filename unclist file\n\
-");
+ printf("Usage:\n\tlocktest //server1/share1 //server2/share2 [options..]\n");
+ poptPrintUsage(pc, stdout, 0);
}
/****************************************************************************
@@ -552,97 +537,86 @@ static void usage(void)
int seed, server;
int username_count=0;
struct loadparm_context *lp_ctx;
+ poptContext pc;
+ int argc_new, i;
+ char **argv_new;
+ enum {OPT_UNCLIST=1000};
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"seed", 0, POPT_ARG_INT, &seed, 0, "Seed to use for randomizer", NULL},
+ {"num-ops", 0, POPT_ARG_INT, &numops, 0, "num ops", NULL},
+ {"lockrange", 0, POPT_ARG_INT, &lock_range,0, "locking range", NULL},
+ {"lockbase", 0, POPT_ARG_INT, &lock_base, 0, "locking base", NULL},
+ {"minlength", 0, POPT_ARG_INT, &min_length,0, "min lock length", NULL},
+ {"hidefails", 0, POPT_ARG_NONE, &hide_unlock_fails,0,"hide unlock fails", NULL},
+ {"oplocks", 0, POPT_ARG_NONE, &use_oplocks,0, "use oplocks", NULL},
+ {"showall", 0, POPT_ARG_NONE, &showall, 0, "display all operations", NULL},
+ {"analyse", 0, POPT_ARG_NONE, &analyze, 0, "do backtrack analysis", NULL},
+ {"zerozero", 0, POPT_ARG_NONE, &zero_zero, 0, "do zero/zero lock", NULL},
+ {"exacterrors", 0, POPT_ARG_NONE, &exact_error_codes,0,"use exact error codes", NULL},
+ {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL},
+ { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" },
+ POPT_COMMON_SAMBA
+ POPT_COMMON_CONNECTION
+ POPT_COMMON_CREDENTIALS
+ POPT_COMMON_VERSION
+ { NULL }
+ };
setlinebuf(stdout);
+ seed = time(NULL);
- setup_logging("locktest", DEBUG_STDOUT);
-
- if (argc < 3 || argv[1][0] == '-') {
- usage();
- exit(1);
- }
-
- setup_logging(argv[0], DEBUG_STDOUT);
-
- for (server=0;server<NSERVERS;server++) {
- share[server] = argv[1+server];
- all_string_sub(share[server],"/","\\",0);
- }
-
- argc -= NSERVERS;
- argv += NSERVERS;
+ pc = poptGetContext("locjtest", argc, (const char **) argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
- lp_ctx = loadparm_init(talloc_autofree_context());
- lp_load(lp_ctx, dyn_CONFIGFILE);
+ poptSetOtherOptionHelp(pc, "<unc1> <unc2>");
servers[0] = cli_credentials_init(talloc_autofree_context());
servers[1] = cli_credentials_init(talloc_autofree_context());
cli_credentials_guess(servers[0], lp_ctx);
cli_credentials_guess(servers[1], lp_ctx);
- seed = time(NULL);
-
- while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:l:")) != EOF) {
+ while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
+ case OPT_UNCLIST:
+ lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc));
+ break;
case 'U':
if (username_count == 2) {
- usage();
+ usage(pc);
exit(1);
}
- cli_credentials_parse_string(servers[username_count],
- optarg, CRED_SPECIFIED);
+ cli_credentials_parse_string(servers[username_count], poptGetOptArg(pc), CRED_SPECIFIED);
username_count++;
break;
- case 'R':
- lock_range = strtol(optarg, NULL, 0);
- break;
- case 'B':
- lock_base = strtol(optarg, NULL, 0);
- break;
- case 'M':
- min_length = strtol(optarg, NULL, 0);
- break;
- case 's':
- seed = atoi(optarg);
- break;
- case 'u':
- hide_unlock_fails = true;
- break;
- case 'o':
- numops = atoi(optarg);
- break;
- case 'O':
- use_oplocks = true;
- break;
- case 'a':
- showall = true;
- break;
- case 'A':
- analyze = true;
- break;
- case 'Z':
- zero_zero = true;
- break;
- case 'E':
- exact_error_codes = true;
- break;
- case 'l':
- lp_set_cmdline(lp_ctx, "torture:unclist", optarg);
- break;
- case 'W':
- lp_set_cmdline(lp_ctx, "workgroup", optarg);
+ }
+ }
+
+ argv_new = discard_const_p(char *, poptGetArgs(pc));
+ argc_new = argc;
+ for (i=0; i<argc; i++) {
+ if (argv_new[i] == NULL) {
+ argc_new = i;
break;
- case 'h':
- usage();
- exit(1);
- default:
- printf("Unknown option %c (%d)\n", (char)opt, opt);
- exit(1);
}
}
+ if (!(argc_new >= 3)) {
+ usage(pc);
+ exit(1);
+ }
+
+ setup_logging("locktest", DEBUG_STDOUT);
+
+ for (server=0;server<NSERVERS;server++) {
+ share[server] = argv_new[1+server];
+ all_string_sub(share[server],"/","\\",0);
+ }
+
+ lp_ctx = cmdline_lp_ctx;
+
if (username_count == 0) {
- usage();
+ usage(pc);
return -1;
}
if (username_count == 1) {
diff --git a/source/torture/masktest.c b/source/torture/masktest.c
index d1b853d..855da54 100644
--- a/source/torture/masktest.c
+++ b/source/torture/masktest.c
@@ -325,7 +325,7 @@ static void usage(void)
argc -= 1;
argv += 1;
- lp_ctx = loadparm_init(talloc_autofree_context());
+ global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context());
lp_load(lp_ctx, dyn_CONFIGFILE);
credentials = cli_credentials_init(talloc_autofree_context());
diff --git a/testprogs/blackbox/test_locktest.sh b/testprogs/blackbox/test_locktest.sh
new file mode 100755
index 0000000..c08b408
--- /dev/null
+++ b/testprogs/blackbox/test_locktest.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Blackbox tests for locktest
+# Copyright (C) 2008 Andrew Tridgell
+# based on test_smbclient.sh
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_locktest.sh SERVER USERNAME PASSWORD DOMAIN PREFIX
+EOF
+exit 1;
+fi
+
+SERVER=$1
+USERNAME=$2
+PASSWORD=$3
+DOMAIN=$4
+PREFIX=$5
+shift 5
+failed=0
+
+samba4bindir=`dirname $0`/../../source/bin
+locktest=$samba4bindir/locktest
+
+testit() {
+ name="$1"
+ shift
+ cmdline="$*"
+ echo "test: $name"
+ $cmdline
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "success: $name"
+ else
+ echo "failure: $name"
+ fi
+ return $status
+}
+
+testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100 -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
+
+exit $failed
--
Samba Shared Repository
More information about the samba-cvs
mailing list