From 60b314428008878f949b9fba54825c2f4f900288 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 13:29:32 +1100 Subject: fixed loadparm handling in standalone tests (This used to be commit 2633f4259ed30ab990017c4c3205f92bf38f0135) --- source4/torture/gentest.c | 2 +- source4/torture/locktest.c | 2 +- source4/torture/masktest.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index d50393baf0..8fa433a872 100644 --- a/source4/torture/gentest.c +++ b/source4/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/source4/torture/locktest.c b/source4/torture/locktest.c index 90e2eec2be..119b5186d9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -572,7 +572,7 @@ static void usage(void) 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] = cli_credentials_init(talloc_autofree_context()); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index d1b853de72..855da54340 100644 --- a/source4/torture/masktest.c +++ b/source4/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()); -- cgit From 66e8bc9dac291946986d1eb202fc2ed584330118 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 14:55:31 +1100 Subject: converted locktest to use popt and cmdline utility code (This used to be commit 625ea49a95cbdb507ea5b191f75ffa27e25cdb90) --- source4/torture/config.mk | 3 + source4/torture/locktest.c | 162 +++++++++++++++++++-------------------------- 2 files changed, 71 insertions(+), 94 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 0c5e641b4b..18e5ea70ec 100644 --- a/source4/torture/config.mk +++ b/source4/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/source4/torture/locktest.c b/source4/torture/locktest.c index 119b5186d9..ebc325fe2b 100644 --- a/source4/torture/locktest.c +++ b/source4/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 "); 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= 3)) { + usage(pc); + exit(1); + } + + setup_logging("locktest", DEBUG_STDOUT); + + for (server=0;server Date: Fri, 15 Feb 2008 15:26:20 +1100 Subject: fixed masktest to use popt, and fixed the incorrect pstring conversion (This used to be commit c37133fd95e6d02a0cdf0f7b5408211740d8046c) --- source4/torture/masktest.c | 157 ++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 94 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 855da54340..ac7029aa50 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/filesys.h" #include "system/dir.h" #include "libcli/libcli.h" @@ -30,12 +31,10 @@ #include "dynconfig.h" #include "libcli/resolve/resolve.h" -static struct cli_credentials *credentials; static bool showall = false; static bool old_list = false; static const char *maskchars = "<>\"?*abc."; static const char *filechars = "abcdefghijklm."; -static int verbose; static int die_on_error; static int NumLoops = 0; static int max_length = 20; @@ -87,13 +86,13 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, *share = 0; share++; - cli_credentials_set_workstation(credentials, "masktest", CRED_SPECIFIED); + cli_credentials_set_workstation(cmdline_credentials, "masktest", CRED_SPECIFIED); status = smbcli_full_connection(NULL, &c, server, ports, share, NULL, - credentials, resolve_ctx, NULL, + cmdline_credentials, resolve_ctx, NULL, options); if (!NT_STATUS_IS_OK(status)) { @@ -112,7 +111,7 @@ static bool f_info_hit; static void listfn(struct clilist_file_info *f, const char *s, void *state) { - struct masktest_state *m = talloc_get_type(state,struct masktest_state); + struct masktest_state *m = (struct masktest_state *)state; if (ISDOT(f->name)) { resultp[0] = '+'; @@ -128,7 +127,7 @@ static void listfn(struct clilist_file_info *f, const char *s, void *state) } static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, - char *long_name, fstring short_name) + char **long_name, fstring short_name) { const char *mask; struct masktest_state state; @@ -151,12 +150,12 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, if (f_info_hit) { fstrcpy(short_name, last_hit.short_name); strlower(short_name); - long_name = talloc_strdup(mem_ctx, last_hit.long_name); - strlower(long_name); + *long_name = talloc_strdup(mem_ctx, last_hit.long_name); + strlower(*long_name); } if (*short_name == '\0') { - fstrcpy(short_name, long_name); + fstrcpy(short_name, *long_name); } } @@ -168,7 +167,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, char *res2; static int count; fstring short_name; - char *long_name; + char *long_name = NULL; struct masktest_state state; count++; @@ -186,7 +185,7 @@ static void testpair(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, char *mask, resultp = res1; fstrcpy(short_name, ""); - get_real_name(mem_ctx, cli, long_name, short_name); + get_real_name(mem_ctx, cli, &long_name, short_name); fstrcpy(res1, "---"); smbcli_list_new(cli->tree, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, @@ -241,6 +240,8 @@ static void test_mask(int argc, char *argv[], l2 = 1 + random() % max_length; mask = talloc_strdup(mem_ctx, "\\masktest\\"); file = talloc_strdup(mem_ctx, "\\masktest\\"); + mask = talloc_realloc_size(mem_ctx, mask, strlen(mask)+l1+1); + file = talloc_realloc_size(mem_ctx, file, strlen(file)+l2+1); l = strlen(mask); for (i=0;i"); - share = argv[1]; - - all_string_sub(share,"/","\\",0); + while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case OPT_UNCLIST: + lp_set_cmdline(cmdline_lp_ctx, "torture:unclist", poptGetOptArg(pc)); + break; + } + } - setup_logging(argv[0], DEBUG_STDOUT); + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i= 2)) { + usage(pc); + exit(1); + } - global_loadparm = lp_ctx = loadparm_init(talloc_autofree_context()); - lp_load(lp_ctx, dyn_CONFIGFILE); + setup_logging("masktest", DEBUG_STDOUT); - credentials = cli_credentials_init(talloc_autofree_context()); - cli_credentials_guess(credentials, lp_ctx); + share = argv_new[1]; - seed = time(NULL); + all_string_sub(share,"/","\\",0); - while ((opt = getopt(argc, argv, "n:d:U:s:hm:f:aoW:M:vEl:")) != EOF) { - switch (opt) { - case 'n': - NumLoops = atoi(optarg); - break; - case 'd': - DEBUGLEVEL = atoi(optarg); - break; - case 'E': - die_on_error = 1; - break; - case 'v': - verbose++; - break; - case 'M': - lp_set_cmdline(lp_ctx, "max protocol", optarg); - break; - case 'U': - cli_credentials_parse_string(credentials, optarg, CRED_SPECIFIED); - break; - case 's': - seed = atoi(optarg); - break; - case 'h': - usage(); - exit(1); - case 'm': - maskchars = optarg; - break; - case 'l': - max_length = atoi(optarg); - break; - case 'f': - filechars = optarg; - break; - case 'a': - showall = 1; - break; - case 'o': - old_list = true; - break; - default: - printf("Unknown option %c (%d)\n", (char)opt, opt); - exit(1); - } - } + lp_ctx = cmdline_lp_ctx; gensec_init(lp_ctx); - argc -= optind; - argv += optind; - lp_smbcli_options(lp_ctx, &options); cli = connect_one(lp_resolve_context(lp_ctx), share, @@ -398,7 +367,7 @@ static void usage(void) DEBUG(0,("seed=%d format --- --- (server, correct)\n", seed)); srandom(seed); - test_mask(argc, argv, cli); + test_mask(argc_new-1, argv_new+1, cli); return(0); } -- cgit From c09f70608c97c5df87818f0c6297e85cf8827862 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:33:10 +1100 Subject: added a blackbox test for masktest (This used to be commit 05a110123df2372418e2ef2fd8f269b92054069c) --- source4/torture/locktest.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index ebc325fe2b..fb2430f881 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -396,7 +396,7 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS], we then do random locking ops in tamdem on the 4 fnums from each server and ensure that the results match */ -static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) +static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) { struct smbcli_state *cli[NSERVERS][NCONNECTIONS]; int fnum[NSERVERS][NCONNECTIONS][NFILES]; @@ -451,7 +451,12 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) open_files(cli, fnum); n = retest(cli, fnum, numops); - if (n == numops || !analyze) return; + if (n == numops || !analyze) { + if (n != numops) { + return 1; + } + return 0; + } n++; skip = n/2; @@ -517,6 +522,8 @@ static void test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) (double)recorded[i].len, recorded[i].needed); } + + return 1; } @@ -632,8 +639,6 @@ _NORETURN_ static void usage(poptContext pc) seed, lock_base, lock_range, min_length)); srandom(seed); - test_locks(lp_ctx, share); - - return(0); + return test_locks(lp_ctx, share); } -- cgit From 80362574b83eaa27c4fcf8f93546f8700fc736c8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:39:07 +1100 Subject: fix typo (This used to be commit 1699b2a804cf91175de2528c1e640a09b4de4f08) --- source4/torture/locktest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index fb2430f881..de25c0abc8 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -573,7 +573,7 @@ _NORETURN_ static void usage(poptContext pc) setlinebuf(stdout); seed = time(NULL); - pc = poptGetContext("locjtest", argc, (const char **) argv, long_options, + pc = poptGetContext("locktest", argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); poptSetOtherOptionHelp(pc, " "); -- cgit From 9e6327dc41c8f3a4b523ccbab869e6b001e1b6df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:52:52 +1100 Subject: make sure lp_ctx is initialised (This used to be commit 3abb33c8bff9aac8ba1ba4783b919732e5159283) --- source4/torture/locktest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index de25c0abc8..039484a8cb 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -528,7 +528,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS]) -_NORETURN_ static void usage(poptContext pc) +static void usage(poptContext pc) { printf("Usage:\n\tlocktest //server1/share1 //server2/share2 [options..]\n"); poptPrintUsage(pc, stdout, 0); @@ -578,6 +578,7 @@ _NORETURN_ static void usage(poptContext pc) poptSetOtherOptionHelp(pc, " "); + lp_ctx = cmdline_lp_ctx; servers[0] = cli_credentials_init(talloc_autofree_context()); servers[1] = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(servers[0], lp_ctx); -- cgit From db408c0d0dbe159146c637c97bbe9bbf41983586 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 15:53:11 +1100 Subject: convert gentest to use popt and the cmdline library (This used to be commit 681366b956a71aa7bd16b75263ccd73ddc680082) --- source4/torture/gentest.c | 166 +++++++++++++++++++++++----------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 8fa433a872..28cac81624 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "lib/cmdline/popt_common.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/raw/request.h" @@ -1755,6 +1756,7 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info) info->end_of_file_info.in.size = gen_offset(); break; case RAW_SFILEINFO_RENAME_INFORMATION: + case RAW_SFILEINFO_RENAME_INFORMATION_SMB2: info->rename_information.in.overwrite = gen_bool(); info->rename_information.in.root_fid = gen_root_fid(instance); info->rename_information.in.new_name = gen_fname_open(instance); @@ -2129,25 +2131,13 @@ static bool start_gentest(struct loadparm_context *lp_ctx) } -static void usage(void) +static void usage(poptContext pc) { printf( "Usage:\n\ - gentest2 //server1/share1 //server2/share2 [options..]\n\ - options:\n\ - -U user%%pass (can be specified twice)\n\ - -s seed\n\ - -o numops\n\ - -a (show all ops)\n\ - -A backtrack to find minimal ops\n\ - -i FILE add a list of wildcard exclusions\n\ - -O enable oplocks\n\ - -S FILE set preset seeds file\n\ - -L use preset seeds\n\ - -F fast reconnect (just close files)\n\ - -C continuous analysis mode\n\ - -X analyse even when test OK\n\ + gentest //server1/share1 //server2/share2 [options..]\n\ "); + poptPrintUsage(pc, stdout, 0); } /** @@ -2180,14 +2170,88 @@ static bool split_unc_name(const char *unc, char **server, char **share) int opt; int i, username_count=0; bool ret; + char *ignore_file=NULL; struct loadparm_context *lp_ctx; + poptContext pc; + int argc_new; + char **argv_new; + enum {OPT_UNCLIST=1000}; + struct poptOption long_options[] = { + POPT_AUTOHELP + {"seed", 0, POPT_ARG_INT, &options.seed, 0, "Seed to use for randomizer", NULL}, + {"num-ops", 0, POPT_ARG_INT, &options.numops, 0, "num ops", NULL}, + {"oplocks", 0, POPT_ARG_NONE, &options.use_oplocks,0, "use oplocks", NULL}, + {"showall", 0, POPT_ARG_NONE, &options.showall, 0, "display all operations", NULL}, + {"analyse", 0, POPT_ARG_NONE, &options.analyze, 0, "do backtrack analysis", NULL}, + {"analysealways", 0, POPT_ARG_NONE, &options.analyze_always, 0, "analysis always", NULL}, + {"analysecontinuous", 0, POPT_ARG_NONE, &options.analyze_continuous, 0, "analysis continuous", NULL}, + {"ignore", 0, POPT_ARG_STRING, &ignore_file, 0, "ignore from file", NULL}, + {"preset", 0, POPT_ARG_NONE, &options.use_preset_seeds, 0, "use preset seeds", NULL}, + {"fast", 0, POPT_ARG_NONE, &options.fast_reconnect, 0, "use fast reconnect", NULL}, + {"unclist", 0, POPT_ARG_STRING, NULL, OPT_UNCLIST, "unclist", NULL}, + {"seedsfile", 0, POPT_ARG_STRING, &options.seeds_file, 0, "seed file", 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); + options.seed = time(NULL); + + pc = poptGetContext("gentest", argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); + + poptSetOtherOptionHelp(pc, " "); + + lp_ctx = cmdline_lp_ctx; + servers[0].credentials = cli_credentials_init(talloc_autofree_context()); + servers[1].credentials = cli_credentials_init(talloc_autofree_context()); + cli_credentials_guess(servers[0].credentials, lp_ctx); + cli_credentials_guess(servers[1].credentials, lp_ctx); + + 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(pc); + exit(1); + } + cli_credentials_parse_string(servers[username_count].credentials, poptGetOptArg(pc), CRED_SPECIFIED); + username_count++; + break; + } + } + + if (ignore_file) { + options.ignore_patterns = file_lines_load(ignore_file, NULL, NULL); + } + + argv_new = discard_const_p(char *, poptGetArgs(pc)); + argc_new = argc; + for (i=0; i= 3)) { + usage(pc); + exit(1); + } setlinebuf(stdout); setup_logging("gentest", DEBUG_STDOUT); if (argc < 3 || argv[1][0] == '-') { - usage(); + usage(pc); exit(1); } @@ -2195,7 +2259,6 @@ static bool split_unc_name(const char *unc, char **server, char **share) for (i=0;i Date: Fri, 15 Feb 2008 16:52:57 +1100 Subject: fixed some options that could not be overridden on the command line (This used to be commit eea486d8942fdda769684fa6e825c0f899cf3304) --- source4/torture/gentest.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 28cac81624..d5fc855f17 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -2200,6 +2200,9 @@ static bool split_unc_name(const char *unc, char **server, char **share) setlinebuf(stdout); options.seed = time(NULL); + options.numops = 1000; + options.max_open_handles = 20; + options.seeds_file = "gentest_seeds.dat"; pc = poptGetContext("gentest", argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); @@ -2265,16 +2268,6 @@ static bool split_unc_name(const char *unc, char **server, char **share) } } - argc -= NSERVERS; - argv += NSERVERS; - - lp_load(lp_ctx, dyn_CONFIGFILE); - - options.seed = time(NULL); - options.numops = 1000; - options.max_open_handles = 20; - options.seeds_file = "gentest_seeds.dat"; - if (username_count == 0) { usage(pc); return -1; -- cgit From 339dcbb64169abe9c1b810140eaef25a17a9a690 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 15 Feb 2008 16:53:10 +1100 Subject: remove redundent code (This used to be commit 7f2421f17cae313d7dbf5c35c73b5410cb1d5db0) --- source4/torture/locktest.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 039484a8cb..618568acf9 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -633,9 +633,6 @@ static void usage(poptContext pc) gensec_init(lp_ctx); - argc -= optind; - argv += optind; - DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n", seed, lock_base, lock_range, min_length)); srandom(seed); -- cgit From 17f31a7677a585834d8d172a67bf39bfda048a46 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 14:56:58 +0100 Subject: NET-API-BECOME-DC: at least find the 'provision' function in python mode This is still broken, as we call provision() with wrong arguments. Also the python provision() function, doesn't allow us to specify the locations of the partition ldb files, this is strictly needed otherwise the torture test destroys a production databases. I think we should have a provision_become_dc() again! metze (This used to be commit 096eafd34778dde222bce4b0a5c0fc38b7de0359) --- source4/torture/libnet/libnet_BecomeDC.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 0dd06bda4c..997dbc93b8 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -284,6 +284,7 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, { struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state); bool ok; + PyObject *module, *module_dict; PyObject *provision_fn, *result, *parameters; DEBUG(0,("Provision for Become-DC test using PYTHON\n")); @@ -293,13 +294,24 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, py_update_path("bin"); /* FIXME: Can't assume this always runs in source/... */ - provision_fn = PyImport_Import(PyString_FromString("samba.provision.provision")); + module = PyImport_Import(PyString_FromString("samba.provision")); + if (module == NULL) { + DEBUG(0, ("Unable to import 'samba.provision' Python module.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + module_dict = PyModule_GetDict(module); + if (module_dict == NULL) { + DEBUG(0, ("Unable to GetDict of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + provision_fn = PyDict_GetItemString(module_dict, "provision"); if (provision_fn == NULL) { - DEBUG(0, ("Unable to import provision Python module.\n")); - return NT_STATUS_UNSUCCESSFUL; + DEBUG(0, ("Unable to get function 'provision' of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; } - + DEBUG(0,("New Server[%s] in Site[%s]\n", p->dest_dsa->dns_name, p->dest_dsa->site_name)); -- cgit