diff options
author | James Peach <jpeach@samba.org> | 2010-03-22 21:55:49 -0700 |
---|---|---|
committer | James Peach <jpeach@apple.com> | 2010-06-21 08:58:10 -0700 |
commit | 0fc18ead76a79286365646eeb7607b39b01a1c9f (patch) | |
tree | c0c95254ca2ea1cbd39eb5c3681ae96d05d2ecd0 /source4/torture/shell.c | |
parent | 7a25e2efe9360b333fedc3fb938774437703700e (diff) | |
download | samba-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/shell.c')
-rw-r--r-- | source4/torture/shell.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source4/torture/shell.c b/source4/torture/shell.c index 888097de7fa..2f58eb989bc 100644 --- a/source4/torture/shell.c +++ b/source4/torture/shell.c @@ -43,6 +43,8 @@ static void shell_list(const struct shell_command *, struct torture_context *, int, const char **); static void shell_auth(const struct shell_command *, struct torture_context *, int, const char **); +static void shell_target(const struct shell_command *, + struct torture_context *, int, const char **); static void shell_usage(const struct shell_command *); static bool match_command(const char *, const struct shell_command *); @@ -86,6 +88,11 @@ static const struct shell_command commands[] = { shell_set, "set", "[NAME VALUE]", "print or set test configuration parameters" + }, + + { + shell_target, "target", "[TARGET]", + "print or set the test target" } }; @@ -263,6 +270,28 @@ static void shell_auth(const struct shell_command * command, } +static void shell_target(const struct shell_command *command, + struct torture_context *tctx, int argc, const char **argv) +{ + if (argc == 0) { + const char * host; + const char * share; + const char * binding; + + host = torture_setting_string(tctx, "host", NULL); + share = torture_setting_string(tctx, "share", NULL); + binding = torture_setting_string(tctx, "binding", NULL); + + printf("Target host: %s\n", host ? host : ""); + printf("Target share: %s\n", share ? share : ""); + printf("Target binding: %s\n", binding ? binding : ""); + } else if (argc == 1) { + torture_parse_target(tctx->lp_ctx, argv[0]); + } else { + shell_usage(command); + } +} + static void shell_usage(const struct shell_command * command) { if (command->usage) { @@ -287,4 +316,3 @@ static bool match_command(const char * name, return false; } - |