subunit: Support formatting compatible with upstream subunit, for consistency.
[sfrench/samba-autobuild/.git] / source4 / torture / raw / composite.c
index 5a663fb565cdea77a04048a8af4c3e5341b0fb58..73a25fd3456d4ae4a51f6844aa3723467e8404ab 100644 (file)
@@ -31,6 +31,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "torture/util.h"
 #include "param/param.h"
+#include "libcli/resolve/resolve.h"
 
 #define BASEDIR "\\composite"
 
@@ -64,7 +65,7 @@ static bool test_loadfile(struct smbcli_state *cli, struct torture_context *tctx
        io1.in.data  = data;
        io1.in.size  = len;
 
-       printf("testing savefile\n");
+       printf("Testing savefile\n");
 
        status = smb_composite_savefile(cli->tree, &io1);
        if (!NT_STATUS_IS_OK(status)) {
@@ -74,7 +75,7 @@ static bool test_loadfile(struct smbcli_state *cli, struct torture_context *tctx
 
        io2.in.fname = fname;
 
-       printf("testing parallel loadfile with %d ops\n", num_ops);
+       printf("Testing parallel loadfile with %d ops\n", num_ops);
 
        c = talloc_array(tctx, struct composite_context *, num_ops);
 
@@ -132,7 +133,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
        int i;
        size_t len = random() % 10000;
        extern int torture_numops;
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
        int *count = talloc_zero(tctx, int);
        bool ret = true;
 
@@ -144,7 +145,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
        io1.in.data  = data;
        io1.in.size  = len;
 
-       printf("testing savefile\n");
+       printf("Testing savefile\n");
 
        status = smb_composite_savefile(cli->tree, &io1);
        if (!NT_STATUS_IS_OK(status)) {
@@ -153,7 +154,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
        }
 
        io2.in.dest_host = torture_setting_string(tctx, "host", NULL);
-       io2.in.port = 0;
+       io2.in.ports = lp_smb_ports(tctx->lp_ctx);
        io2.in.called_name = torture_setting_string(tctx, "host", NULL);
        io2.in.service = torture_setting_string(tctx, "share", NULL);
        io2.in.service_type = "A:";
@@ -161,8 +162,13 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
        io2.in.credentials = cmdline_credentials;
        io2.in.workgroup  = lp_workgroup(tctx->lp_ctx);
        io2.in.filename = fname;
+       io2.in.resolve_ctx = lp_resolve_context(tctx->lp_ctx);
+       io2.in.iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
+       io2.in.gensec_settings = lp_gensec_settings(tctx, tctx->lp_ctx);
+       lp_smbcli_options(tctx->lp_ctx, &io2.in.options);
+       lp_smbcli_session_options(tctx->lp_ctx, &io2.in.session_options);
 
-       printf("testing parallel fetchfile with %d ops\n", torture_numops);
+       printf("Testing parallel fetchfile with %d ops\n", torture_numops);
 
        event_ctx = cli->transport->socket->event.ctx;
        c = talloc_array(tctx, struct composite_context *, torture_numops);
@@ -219,7 +225,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct
        struct smb_composite_appendacl **io;
        struct smb_composite_appendacl **io_orig;
        struct composite_context **c;
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
 
        struct security_descriptor *test_sd;
        struct security_ace *ace;
@@ -278,7 +284,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct
 
        /* set parameters for appendacl async call */
 
-       printf("testing parallel appendacl with %d ops\n", num_ops);
+       printf("Testing parallel appendacl with %d ops\n", num_ops);
 
        c = talloc_array(tctx, struct composite_context *, num_ops);
        io = talloc_array(tctx, struct  smb_composite_appendacl *, num_ops);
@@ -293,7 +299,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct
                c[i]->async.private_data = count;
        }
 
-       event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
+       event_ctx = tctx->ev;
        printf("waiting for completion\n");
        while (*count != num_ops) {
                event_loop_once(event_ctx);
@@ -336,26 +342,30 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
 
        int i;
        extern int torture_numops;
-       struct event_context *event_ctx;
+       struct tevent_context *event_ctx;
        int *count = talloc_zero(tctx, int);
        bool ret = true;
 
        io1.in.dest_host = torture_setting_string(tctx, "host", NULL);
-       io1.in.port = 0;
+       io1.in.dest_ports = lp_smb_ports(tctx->lp_ctx);
+       io1.in.socket_options = lp_socket_options(tctx->lp_ctx);
        io1.in.called_name = torture_setting_string(tctx, "host", NULL);
        io1.in.service = torture_setting_string(tctx, "share", NULL);
        io1.in.service_type = "A:";
        io1.in.credentials = cmdline_credentials;
        io1.in.workgroup = lp_workgroup(tctx->lp_ctx);
        io1.in.level = RAW_QFS_OBJECTID_INFORMATION;
+       io1.in.iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
+       io1.in.gensec_settings = lp_gensec_settings(tctx, tctx->lp_ctx);
 
-       printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops);
+       printf("Testing parallel queryfsinfo [Object ID] with %d ops\n",
+                  torture_numops);
 
-       event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
+       event_ctx = tctx->ev;
        c = talloc_array(tctx, struct composite_context *, torture_numops);
 
        for (i=0; i<torture_numops; i++) {
-               c[i] = smb_composite_fsinfo_send(cli->tree,&io1);
+               c[i] = smb_composite_fsinfo_send(cli->tree, &io1, lp_resolve_context(tctx->lp_ctx));
                c[i]->async.fn = loadfile_complete;
                c[i]->async.private_data = count;
        }