summaryrefslogtreecommitdiff
path: root/source4/torture/smbtorture.c
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2010-03-22 21:55:49 -0700
committerJames Peach <jpeach@apple.com>2010-06-21 08:58:10 -0700
commit0fc18ead76a79286365646eeb7607b39b01a1c9f (patch)
treec0c95254ca2ea1cbd39eb5c3681ae96d05d2ecd0 /source4/torture/smbtorture.c
parent7a25e2efe9360b333fedc3fb938774437703700e (diff)
downloadsamba-0fc18ead76a79286365646eeb7607b39b01a1c9f.tar.gz
smbtorture: Add "target" command to interactive shell.
Add a "target" command to set the target server to test. Refactor the command line argument processing a little so that you can run --shell without any additional arguments.
Diffstat (limited to 'source4/torture/smbtorture.c')
-rw-r--r--source4/torture/smbtorture.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index b7140d70a57..f0da3f0e9e9 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -122,7 +122,7 @@ bool torture_run_named_tests(struct torture_context *torture, const char *name,
return ret;
}
-static bool parse_target(struct loadparm_context *lp_ctx, const char *target)
+bool torture_parse_target(struct loadparm_context *lp_ctx, const char *target)
{
char *host = NULL, *share = NULL;
struct dcerpc_binding *binding_struct;
@@ -607,16 +607,6 @@ int main(int argc,char *argv[])
}
}
- if (!(argc_new >= 3)) {
- usage(pc);
- exit(1);
- }
-
- if (!parse_target(cmdline_lp_ctx, argv_new[1])) {
- usage(pc);
- exit(1);
- }
-
if (!strcmp(ui_ops_name, "simple")) {
ui_ops = &std_ui_ops;
} else if (!strcmp(ui_ops_name, "subunit")) {
@@ -649,12 +639,29 @@ int main(int argc,char *argv[])
gensec_init(cmdline_lp_ctx);
- if (argc_new == 0) {
- printf("You must specify a testsuite to run, or 'ALL'\n");
- } else if (shell) {
+ // At this point, we should just have a target string,
+ // followed by a series of test names. Unless we are in
+ // shell mode, in which case we don't need anythig more.
+
+ if (argc_new > 1) {
+ // Take the target name or binding.
+ if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
+ usage(pc);
+ exit(1);
+ }
+
+ argc_new--;
+ }
+
+ if (shell) {
+ // In shell mode, just ignore any remaining test names.
torture_shell(torture);
+ } else if (argc_new == 1) {
+ printf("You must specify a test to run, or 'ALL'\n");
+ usage(pc);
+ exit(1);
} else {
- for (i=2;i<argc_new;i++) {
+ for (i=1;i<argc_new;i++) {
if (!torture_run_named_tests(torture, argv_new[i],
(const char **)restricted)) {
correct = false;