From 5d4d8fefe28051ace587494bff5e16b4e4211773 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 3 May 2012 14:41:21 +0200 Subject: s4:torture/raw/context: add subtests as torture testcases TODO: add test_session with 'use spnego = false'. We need a way to do set an option just for one test case. Note: the 'use spnego = false' was ignored before as it's only used on the first session setup on a connection. metze Autobuild-User: Stefan Metzmacher Autobuild-Date: Tue May 8 04:50:39 CEST 2012 on sn-devel-104 --- source4/torture/raw/context.c | 66 +++++++++++++------------------------------ 1 file changed, 20 insertions(+), 46 deletions(-) (limited to 'source4/torture/raw') diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index b0636d19ea..af53453774 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -45,7 +45,8 @@ /* test session ops */ -static bool test_session(struct smbcli_state *cli, struct torture_context *tctx) +static bool test_session(struct torture_context *tctx, + struct smbcli_state *cli) { NTSTATUS status; bool ret = true; @@ -256,7 +257,7 @@ done: /* test tree ops */ -static bool test_tree(struct smbcli_state *cli, struct torture_context *tctx) +static bool test_tree(struct torture_context *tctx, struct smbcli_state *cli) { NTSTATUS status; bool ret = true; @@ -361,7 +362,7 @@ done: this demonstrates that a tcon isn't autoclosed by a ulogoff the tcon can be reused using any other valid session later */ -static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *tctx) +static bool test_tree_ulogoff(struct torture_context *tctx, struct smbcli_state *cli) { NTSTATUS status; bool ret = true; @@ -516,8 +517,8 @@ done: this test demonstrates that exit() only sees the PID used for the open() calls */ -static bool test_pid_exit_only_sees_open(struct smbcli_state *cli, - struct torture_context *tctx) +static bool test_pid_exit_only_sees_open(struct torture_context *tctx, + struct smbcli_state *cli) { NTSTATUS status; TALLOC_CTX *mem_ctx = tctx; @@ -626,7 +627,8 @@ done: /* test pid ops with 2 sessions */ -static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tctx) +static bool test_pid_2sess(struct torture_context *tctx, + struct smbcli_state *cli) { NTSTATUS status; bool ret = true; @@ -733,7 +735,8 @@ done: /* test pid ops with 2 tcons */ -static bool test_pid_2tcon(struct smbcli_state *cli, struct torture_context *tctx) +static bool test_pid_2tcon(struct torture_context *tctx, + struct smbcli_state *cli) { NTSTATUS status; bool ret = true; @@ -871,49 +874,20 @@ done: return ret; } - -/* - basic testing of session/tree context calls -*/ -static bool torture_raw_context_int(struct torture_context *tctx, - struct smbcli_state *cli) -{ - bool ret = true; - - ret &= test_session(cli, tctx); - ret &= test_tree(cli, tctx); - ret &= test_tree_ulogoff(cli, tctx); - ret &= test_pid_exit_only_sees_open(cli, tctx); - ret &= test_pid_2sess(cli, tctx); - ret &= test_pid_2tcon(cli, tctx); - - smb_raw_exit(cli->session); - smbcli_deltree(cli->tree, BASEDIR); - - return ret; -} -/* - basic testing of session/tree context calls -*/ -static bool torture_raw_context_all(struct torture_context *torture, - struct smbcli_state *cli) -{ - bool ret = true; - if (lpcfg_use_spnego(torture->lp_ctx)) { - ret &= torture_raw_context_int(torture, cli); - lpcfg_set_cmdline(torture->lp_ctx, "use spnego", "False"); - } - - ret &= torture_raw_context_int(torture, cli); - - return ret; -} - struct torture_suite *torture_raw_context(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "context"); - torture_suite_add_1smb_test(suite, "all", torture_raw_context_all); + torture_suite_add_1smb_test(suite, "session1", test_session); + /* + * TODO: add test_session with 'use spnego = false' + * torture_suite_add_1smb_test(suite, "session1", test_session); + */ + torture_suite_add_1smb_test(suite, "tree", test_tree); + torture_suite_add_1smb_test(suite, "tree_ulogoff", test_tree_ulogoff); + torture_suite_add_1smb_test(suite, "pid_only_sess", test_pid_exit_only_sees_open); + torture_suite_add_1smb_test(suite, "pid_2sess", test_pid_2sess); + torture_suite_add_1smb_test(suite, "pid_2tcon", test_pid_2tcon); return suite; } -- cgit