diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-04-30 14:05:19 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-04-30 07:00:05 +0200 |
commit | 7e9ed052778d22e4d70bed444b226461dced01b6 (patch) | |
tree | 6eb7ef5e5e326d996749ae43b22d51d20503e9af /source4 | |
parent | 773304ec8b52d718bd3ca9e1b2543a50d7f4843e (diff) | |
download | samba-7e9ed052778d22e4d70bed444b226461dced01b6.tar.gz samba-7e9ed052778d22e4d70bed444b226461dced01b6.tar.xz samba-7e9ed052778d22e4d70bed444b226461dced01b6.zip |
s4-torture: Move various samba3 tests to the torture_suite_add_1smb_test wrapper
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/raw/raw.c | 14 | ||||
-rw-r--r-- | source4/torture/raw/samba3hide.c | 20 | ||||
-rw-r--r-- | source4/torture/raw/samba3misc.c | 43 |
3 files changed, 14 insertions, 63 deletions
diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c index 10a0e89194..cf3a5cb2d1 100644 --- a/source4/torture/raw/raw.c +++ b/source4/torture/raw/raw.c @@ -63,16 +63,16 @@ NTSTATUS torture_raw_init(void) torture_suite_add_suite(suite, torture_raw_streams(suite)); torture_suite_add_suite(suite, torture_raw_acls(suite)); torture_suite_add_suite(suite, torture_raw_composite(suite)); - torture_suite_add_simple_test(suite, "samba3hide", torture_samba3_hide); - torture_suite_add_simple_test(suite, "samba3closeerr", torture_samba3_closeerr); - torture_suite_add_simple_test(suite, "samba3rootdirfid", + torture_suite_add_1smb_test(suite, "samba3hide", torture_samba3_hide); + torture_suite_add_1smb_test(suite, "samba3closeerr", torture_samba3_closeerr); + torture_suite_add_1smb_test(suite, "samba3rootdirfid", torture_samba3_rootdirfid); - torture_suite_add_simple_test(suite, "samba3checkfsp", torture_samba3_checkfsp); - torture_suite_add_simple_test(suite, "samba3oplocklogoff", torture_samba3_oplock_logoff); + torture_suite_add_1smb_test(suite, "samba3checkfsp", torture_samba3_checkfsp); + torture_suite_add_1smb_test(suite, "samba3oplocklogoff", torture_samba3_oplock_logoff); torture_suite_add_simple_test(suite, "samba3badpath", torture_samba3_badpath); - torture_suite_add_simple_test(suite, "samba3caseinsensitive", + torture_suite_add_1smb_test(suite, "samba3caseinsensitive", torture_samba3_caseinsensitive); - torture_suite_add_simple_test(suite, "samba3posixtimedlock", + torture_suite_add_1smb_test(suite, "samba3posixtimedlock", torture_samba3_posixtimedlock); torture_suite_add_simple_test(suite, "scan-eamax", torture_max_eas); diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c index c3a572c21c..f980ffceb6 100644 --- a/source4/torture/raw/samba3hide.c +++ b/source4/torture/raw/samba3hide.c @@ -154,21 +154,14 @@ static NTSTATUS smbcli_chmod(struct smbcli_tree *tree, const char *fname, return smb_raw_setpathinfo(tree, &sfinfo); } -bool torture_samba3_hide(struct torture_context *torture) +bool torture_samba3_hide(struct torture_context *torture, struct smbcli_state *cli) { - struct smbcli_state *cli; const char *fname = "test.txt"; int fnum; NTSTATUS status; struct smbcli_tree *hideunread; struct smbcli_tree *hideunwrite; - if (!torture_open_connection_share( - torture, &cli, torture, torture_setting_string(torture, "host", NULL), - torture_setting_string(torture, "share", NULL), torture->ev)) { - torture_fail(torture, "torture_open_connection_share failed\n"); - } - status = smbcli_setup_unix(cli->tree); if (!NT_STATUS_IS_OK(status)) { torture_fail(torture, @@ -277,19 +270,14 @@ bool torture_samba3_hide(struct torture_context *torture) * close. smb_close should return NT_STATUS_ACCESS_DENIED. */ -bool torture_samba3_closeerr(struct torture_context *tctx) +bool torture_samba3_closeerr(struct torture_context *tctx, struct smbcli_state *cli) { - struct smbcli_state *cli = NULL; bool result = false; NTSTATUS status; const char *dname = "closeerr.dir"; const char *fname = "closeerr.dir\\closerr.txt"; int fnum; - if (!torture_open_connection(&cli, tctx, 0)) { - goto fail; - } - smbcli_deltree(cli->tree, dname); torture_assert_ntstatus_ok( @@ -334,9 +322,5 @@ bool torture_samba3_closeerr(struct torture_context *tctx) result = true; - fail: - if (cli) { - torture_close_connection(cli); - } return result; } diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 07669ed28b..9a10272aec 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -37,9 +37,8 @@ } \ } while (0) -bool torture_samba3_checkfsp(struct torture_context *torture) +bool torture_samba3_checkfsp(struct torture_context *torture, struct smbcli_state *cli) { - struct smbcli_state *cli; const char *fname = "test.txt"; const char *dirname = "testdir"; int fnum; @@ -55,14 +54,6 @@ bool torture_samba3_checkfsp(struct torture_context *torture) return false; } - if (!torture_open_connection_share( - torture, &cli, torture, torture_setting_string(torture, "host", NULL), - torture_setting_string(torture, "share", NULL), torture->ev)) { - d_printf("torture_open_connection_share failed\n"); - ret = false; - goto done; - } - smbcli_deltree(cli->tree, dirname); status = torture_second_tcon(torture, cli->session, @@ -154,7 +145,6 @@ bool torture_samba3_checkfsp(struct torture_context *torture) done: smbcli_deltree(cli->tree, dirname); - torture_close_connection(cli); talloc_free(mem_ctx); return ret; @@ -611,9 +601,8 @@ static void count_fn(struct clilist_file_info *info, const char *name, *counter += 1; } -bool torture_samba3_caseinsensitive(struct torture_context *torture) +bool torture_samba3_caseinsensitive(struct torture_context *torture, struct smbcli_state *cli) { - struct smbcli_state *cli; TALLOC_CTX *mem_ctx; NTSTATUS status; const char *dirname = "insensitive"; @@ -629,10 +618,6 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) return false; } - if (!torture_open_connection(&cli, torture, 0)) { - goto done; - } - smbcli_deltree(cli->tree, dirname); status = smbcli_mkdir(cli->tree, dirname); @@ -710,9 +695,8 @@ static void receive_lock_result(struct smbcli_request *req) * Note: To run this test, use "--option=torture:localdir=<LOCALDIR>" */ -bool torture_samba3_posixtimedlock(struct torture_context *tctx) +bool torture_samba3_posixtimedlock(struct torture_context *tctx, struct smbcli_state *cli) { - struct smbcli_state *cli; NTSTATUS status; bool ret = true; const char *dirname = "posixlock"; @@ -732,11 +716,6 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) struct tevent_timer *te; - if (!torture_open_connection(&cli, tctx, 0)) { - ret = false; - goto done; - } - smbcli_deltree(cli->tree, dirname); status = smbcli_mkdir(cli->tree, dirname); @@ -870,20 +849,14 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) return ret; } -bool torture_samba3_rootdirfid(struct torture_context *tctx) +bool torture_samba3_rootdirfid(struct torture_context *tctx, struct smbcli_state *cli) { - struct smbcli_state *cli; NTSTATUS status; uint16_t dnum; union smb_open io; const char *fname = "testfile"; bool ret = false; - if (!torture_open_connection(&cli, tctx, 0)) { - ret = false; - goto done; - } - smbcli_unlink(cli->tree, fname); ZERO_STRUCT(io); @@ -942,9 +915,8 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx) return ret; } -bool torture_samba3_oplock_logoff(struct torture_context *tctx) +bool torture_samba3_oplock_logoff(struct torture_context *tctx, struct smbcli_state *cli) { - struct smbcli_state *cli; NTSTATUS status; uint16_t fnum1; union smb_open io; @@ -953,11 +925,6 @@ bool torture_samba3_oplock_logoff(struct torture_context *tctx) struct smbcli_request *req; struct smb_echo echo_req; - if (!torture_open_connection(&cli, tctx, 0)) { - ret = false; - goto done; - } - smbcli_unlink(cli->tree, fname); ZERO_STRUCT(io); |