1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s4-torture: Move various samba3 tests to the torture_suite_add_1smb_test wrapper

This commit is contained in:
Andrew Bartlett 2012-04-30 14:05:19 +10:00
parent 773304ec8b
commit 7e9ed05277
3 changed files with 14 additions and 63 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);