s4-torture: Move various samba3 tests to the torture_suite_add_1smb_test wrapper
authorAndrew Bartlett <abartlet@samba.org>
Mon, 30 Apr 2012 04:05:19 +0000 (14:05 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 30 Apr 2012 05:00:05 +0000 (07:00 +0200)
source4/torture/raw/raw.c
source4/torture/raw/samba3hide.c
source4/torture/raw/samba3misc.c

index 10a0e89194e2449bb4b54a5c85ff640c49953909..cf3a5cb2d18cc9863cda0f98c69bb4149c9a4ab5 100644 (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);
 
index c3a572c21cf7608af0d7ad201b914b2fffe64768..f980ffceb6dc78571cd480762ae1fa5176600b99 100644 (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;
 }
index 07669ed28b0131014d84a08329bbe8555821fe3b..9a10272aecbef501301954ee379bb15b3886a538 100644 (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);