s4:torture:smb2 prefer torture_comment() to printf().
authorGünther Deschner <gd@samba.org>
Mon, 22 Feb 2016 14:40:50 +0000 (15:40 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 7 Sep 2016 10:09:17 +0000 (12:09 +0200)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source4/torture/smb2/connect.c
source4/torture/smb2/create.c
source4/torture/smb2/dir.c
source4/torture/smb2/getinfo.c
source4/torture/smb2/notify.c
source4/torture/smb2/scan.c
source4/torture/smb2/setinfo.c
source4/torture/smb2/util.c

index 063b298c1dfd101686205935c9c8dee4063bf210..ecb4871026ec97761470c8dd4f99606039b7d6a7 100644 (file)
@@ -96,7 +96,7 @@ static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tre
                return status;
        }
 
-       torture_smb2_all_info(tree, handle);
+       torture_smb2_all_info(tctx, tree, handle);
 
        status = smb2_write(tree, &w);
        if (!NT_STATUS_IS_OK(status)) {
@@ -104,7 +104,7 @@ static NTSTATUS torture_smb2_write(struct torture_context *tctx, struct smb2_tre
                return status;
        }
 
-       torture_smb2_all_info(tree, handle);
+       torture_smb2_all_info(tctx, tree, handle);
 
        ZERO_STRUCT(f);
        f.in.file.handle = handle;
index 7e6be8d8473c1e3d3afe026f322669f784cffcf6..9b3840060263c4bbad0d5970a878d4d76eae929b 100644 (file)
@@ -808,7 +808,7 @@ static bool test_smb2_open(struct torture_context *tctx,
        smb2_util_close(tree, h1);
        smb2_util_unlink(tree, fname);
 
-       status = smb2_create_complex_file(tree, fname, &h1);
+       status = smb2_create_complex_file(tctx, tree, fname, &h1);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        smb2_util_close(tree, h1);
index 98844b43005ce0ef8d16d9788dd9d28f4e4ef631..715e9846cf5c135876df2ec0b31be0528b858c72 100644 (file)
@@ -441,7 +441,7 @@ static bool test_one_file(struct torture_context *tctx,
        status = torture_smb2_testdir(tree, DNAME, &h);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "");
 
-       status = smb2_create_complex_file(tree, DNAME "\\torture_search.txt",
+       status = smb2_create_complex_file(tctx, tree, DNAME "\\torture_search.txt",
                                          &h2);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "");
 
@@ -1012,7 +1012,7 @@ static bool test_modify_search(struct torture_context *tctx,
        smb2_util_close(tree, create.out.file.handle);
 
        files[num_files + 2].name = talloc_asprintf(mem_ctx, "T013-13.txt.3");
-       status = smb2_create_complex_file(tree, DNAME "\\T013-13.txt.3", &h);
+       status = smb2_create_complex_file(tctx, tree, DNAME "\\T013-13.txt.3", &h);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "");
 
        smb2_util_unlink(tree, DNAME "\\T014-14.txt");
index ead401a9a16966eb6cf2df108616611e6ecdc9f8..78f62e7bf82ee77e0ab7157f9790f87ed33cd45d 100644 (file)
@@ -95,8 +95,8 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree
                                   DNAME "\n");
 
        torture_comment(tctx, "Testing file info levels\n");
-       torture_smb2_all_info(tree, hfile);
-       torture_smb2_all_info(tree, hdir);
+       torture_smb2_all_info(tctx, tree, hfile);
+       torture_smb2_all_info(tctx, tree, hdir);
 
        for (i=0;i<ARRAY_SIZE(file_levels);i++) {
                if (file_levels[i].level == RAW_FILEINFO_SEC_DESC) {
@@ -441,35 +441,35 @@ static bool torture_smb2_qsec_buffercheck(struct torture_context *tctx)
 
 /* basic testing of all SMB2 getinfo levels
 */
-static bool torture_smb2_getinfo(struct torture_context *torture)
+static bool torture_smb2_getinfo(struct torture_context *tctx)
 {
        struct smb2_tree *tree;
        bool ret = true;
        NTSTATUS status;
 
-       ret = torture_smb2_connection(torture, &tree);
-       torture_assert(torture, ret, "connection failed");
+       ret = torture_smb2_connection(tctx, &tree);
+       torture_assert(tctx, ret, "connection failed");
 
        smb2_deltree(tree, FNAME);
        smb2_deltree(tree, DNAME);
 
-       status = torture_setup_complex_file(tree, FNAME);
-       torture_assert_ntstatus_ok(torture, status,
+       status = torture_setup_complex_file(tctx, tree, FNAME);
+       torture_assert_ntstatus_ok(tctx, status,
                                   "setup complex file " FNAME);
 
-       status = torture_setup_complex_file(tree, FNAME ":streamtwo");
-       torture_assert_ntstatus_ok(torture, status,
+       status = torture_setup_complex_file(tctx, tree, FNAME ":streamtwo");
+       torture_assert_ntstatus_ok(tctx, status,
                                   "setup complex file " FNAME ":streamtwo");
 
-       status = torture_setup_complex_dir(tree, DNAME);
-       torture_assert_ntstatus_ok(torture, status,
+       status = torture_setup_complex_dir(tctx, tree, DNAME);
+       torture_assert_ntstatus_ok(tctx, status,
                                   "setup complex dir " DNAME);
 
-       status = torture_setup_complex_file(tree, DNAME ":streamtwo");
-       torture_assert_ntstatus_ok(torture, status,
+       status = torture_setup_complex_file(tctx, tree, DNAME ":streamtwo");
+       torture_assert_ntstatus_ok(tctx, status,
                                   "setup complex dir " DNAME ":streamtwo");
 
-       ret &= torture_smb2_fileinfo(torture, tree);
+       ret &= torture_smb2_fileinfo(tctx, tree);
 
        return ret;
 }
index de4ff58bbfdf6a7ac1a94ec497586399c72817f1..d9b0f593e32b2e815a22a53a331af76f4b7b3a51 100644 (file)
@@ -114,7 +114,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -136,7 +136,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -155,7 +155,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -187,7 +187,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -201,7 +201,7 @@ static bool test_valid_request(struct torture_context *torture,
                }
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(torture, tree, FNAME);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        status = smb2_notify_recv(req, torture, &n);
@@ -1066,7 +1066,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
                sinfo.basic_info.in.create_time = 0;
                torture_comment(torture, "Testing set file create time\n");
                NOTIFY_MASK_TEST("Testing set file create time",
-                       smb2_create_complex_file(tree2,
+                       smb2_create_complex_file(torture, tree2,
                        BASEDIR "\\tname1", &h2);,
                        smb2_setinfo_file(tree2, &sinfo);,
                        (smb2_util_close(tree2, h2),
@@ -1081,7 +1081,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
        sinfo.basic_info.in.access_time = 0;
        torture_comment(torture, "Testing set file access time\n");
        NOTIFY_MASK_TEST("Testing set file access time",
-               smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+               smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
                smb2_setinfo_file(tree2, &sinfo);,
                (smb2_util_close(tree2, h2),
                smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
@@ -1094,7 +1094,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
        sinfo.basic_info.in.change_time = 0;
        torture_comment(torture, "Testing set file change time\n");
        NOTIFY_MASK_TEST("Testing set file change time",
-               smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+               smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
                smb2_setinfo_file(tree2, &sinfo);,
                (smb2_util_close(tree2, h2),
                smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
@@ -1104,7 +1104,7 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
 
        torture_comment(torture, "Testing write\n");
        NOTIFY_MASK_TEST("Testing write",
-               smb2_create_complex_file(tree2, BASEDIR "\\tname1", &h2);,
+               smb2_create_complex_file(torture, tree2, BASEDIR "\\tname1", &h2);,
                smb2_util_write(tree2, h2, &c, 10000, 1);,
                (smb2_util_close(tree2, h2),
                smb2_util_unlink(tree2, BASEDIR "\\tname1"));,
index a0e3b816750ba13176a40e346e87dd23bb06e29c..f1527d6af50fa9ff20f15d41816cf8e600295428 100644 (file)
@@ -49,22 +49,22 @@ static bool torture_smb2_getinfo_scan(struct torture_context *tctx)
                return false;
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(tctx, tree, FNAME);
        if (!NT_STATUS_IS_OK(status)) {
                torture_comment(tctx, "Failed to setup complex file '%s': %s\n",
                       FNAME, nt_errstr(status));
                return false;
        }
-       torture_setup_complex_file(tree, FNAME2);
+       torture_setup_complex_file(tctx, tree, FNAME2);
 
-       status = torture_setup_complex_dir(tree, DNAME);
+       status = torture_setup_complex_dir(tctx, tree, DNAME);
        if (!NT_STATUS_IS_OK(status)) {
                torture_comment(tctx, "Failed to setup complex dir '%s': %s\n",
                       DNAME, nt_errstr(status));
                smb2_util_unlink(tree, FNAME);
                return false;
        }
-       torture_setup_complex_file(tree, DNAME2);
+       torture_setup_complex_file(tctx, tree, DNAME2);
 
        torture_smb2_testfile(tree, FNAME, &fhandle);
        torture_smb2_testdir(tree, DNAME, &dhandle);
@@ -123,13 +123,13 @@ static bool torture_smb2_setinfo_scan(struct torture_context *tctx)
                return false;
        }
 
-       status = torture_setup_complex_file(tree, FNAME);
+       status = torture_setup_complex_file(tctx, tree, FNAME);
        if (!NT_STATUS_IS_OK(status)) {
                torture_comment(tctx, "Failed to setup complex file '%s': %s\n",
                       FNAME, nt_errstr(status));
                return false;
        }
-       torture_setup_complex_file(tree, FNAME2);
+       torture_setup_complex_file(tctx, tree, FNAME2);
 
        torture_smb2_testfile(tree, FNAME, &handle);
 
index fee72931b6f0151a1b30e92686fbb24903ee82b1..3b01b054f792ddf444be86af4454663cbee65a0e 100644 (file)
@@ -102,7 +102,7 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
 
 #define RECREATE_FILE(fname) do { \
        smb2_util_close(tree, handle); \
-       status = smb2_create_complex_file(tree, fname, &handle); \
+       status = smb2_create_complex_file(tctx, tree, fname, &handle); \
        if (!NT_STATUS_IS_OK(status)) { \
                torture_result(tctx, TORTURE_FAIL, "(%s) ERROR: open of %s failed (%s)\n", \
                       __location__, fname, nt_errstr(status)); \
@@ -147,7 +147,7 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
                torture_result(tctx, TORTURE_FAIL, "(%s) %s - %s/%s should be 0x%x - 0x%x\n", __location__, \
                       call_name, #stype, #field, \
                       (unsigned int)value, (unsigned int)finfo2.stype.out.field); \
-               torture_smb2_all_info(tree, handle); \
+               torture_smb2_all_info(tctx, tree, handle); \
                ret = false; \
                goto done; \
        }} while (0)
@@ -161,7 +161,7 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
                        (unsigned int)nt_time_to_unix(finfo2.stype.out.field)); \
                torture_warning(tctx, "\t%s", timestring(tctx, value)); \
                torture_warning(tctx, "\t%s\n", nt_time_string(tctx, finfo2.stype.out.field)); \
-               torture_smb2_all_info(tree, handle); \
+               torture_smb2_all_info(tctx, tree, handle); \
                ret = false; \
                goto done; \
        }} while (0)
@@ -174,7 +174,7 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
                goto done; \
        }} while (0)
 
-       torture_smb2_all_info(tree, handle);
+       torture_smb2_all_info(tctx, tree, handle);
        
        torture_comment(tctx, "Test basic_information level\n");
        basetime += 86400;
index d0fc69590df966146f5b802382c80be218ad4b25..2c9ff136fb52c255f26516d8714aa39c2f300709 100644 (file)
@@ -55,8 +55,11 @@ NTSTATUS smb2_util_write(struct smb2_tree *tree,
 /*
   create a complex file/dir using the SMB2 protocol
 */
-static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname, 
-                                        struct smb2_handle *handle, bool dir)
+static NTSTATUS smb2_create_complex(struct torture_context *tctx,
+                                   struct smb2_tree *tree,
+                                   const char *fname,
+                                   struct smb2_handle *handle,
+                                   bool dir)
 {
        TALLOC_CTX *tmp_ctx = talloc_new(tree);
        char buf[7] = "abc";
@@ -121,7 +124,7 @@ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname,
 
        status = smb2_setinfo_file(tree, &setfile);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to setup file times - %s\n", nt_errstr(status));
+               torture_comment(tctx, "Failed to setup file times - %s\n", nt_errstr(status));
                return status;
        }
 
@@ -131,14 +134,14 @@ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname,
 
        status = smb2_getinfo_file(tree, tree, &fileinfo);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to query file times - %s\n", nt_errstr(status));
+               torture_comment(tctx, "Failed to query file times - %s\n", nt_errstr(status));
                return status;
                
        }
 
 #define CHECK_TIME(field) do {\
        if (setfile.basic_info.in.field != fileinfo.all_info2.out.field) { \
-               printf("(%s) " #field " not setup correctly: %s(%llu) => %s(%llu)\n", \
+               torture_comment(tctx, "(%s) " #field " not setup correctly: %s(%llu) => %s(%llu)\n", \
                        __location__, \
                        nt_time_string(tree, setfile.basic_info.in.field), \
                        (unsigned long long)setfile.basic_info.in.field, \
@@ -159,25 +162,28 @@ static NTSTATUS smb2_create_complex(struct smb2_tree *tree, const char *fname,
 /*
   create a complex file using the SMB2 protocol
 */
-NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, 
-                                        struct smb2_handle *handle)
+NTSTATUS smb2_create_complex_file(struct torture_context *tctx,
+                                 struct smb2_tree *tree, const char *fname,
+                                 struct smb2_handle *handle)
 {
-       return smb2_create_complex(tree, fname, handle, false);
+       return smb2_create_complex(tctx, tree, fname, handle, false);
 }
 
 /*
   create a complex dir using the SMB2 protocol
 */
-NTSTATUS smb2_create_complex_dir(struct smb2_tree *tree, const char *fname, 
+NTSTATUS smb2_create_complex_dir(struct torture_context *tctx,
+                                struct smb2_tree *tree, const char *fname,
                                 struct smb2_handle *handle)
 {
-       return smb2_create_complex(tree, fname, handle, true);
+       return smb2_create_complex(tctx, tree, fname, handle, true);
 }
 
 /*
   show lots of information about a file
 */
-void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
+void torture_smb2_all_info(struct torture_context *tctx,
+                          struct smb2_tree *tree, struct smb2_handle handle)
 {
        NTSTATUS status;
        TALLOC_CTX *tmp_ctx = talloc_new(tree);
@@ -193,29 +199,29 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
                return;
        }
 
-       d_printf("all_info for '%s'\n", io.all_info2.out.fname.s);
-       d_printf("\tcreate_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.create_time));
-       d_printf("\taccess_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.access_time));
-       d_printf("\twrite_time:     %s\n", nt_time_string(tmp_ctx, io.all_info2.out.write_time));
-       d_printf("\tchange_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.change_time));
-       d_printf("\tattrib:         0x%x\n", io.all_info2.out.attrib);
-       d_printf("\tunknown1:       0x%x\n", io.all_info2.out.unknown1);
-       d_printf("\talloc_size:     %llu\n", (long long)io.all_info2.out.alloc_size);
-       d_printf("\tsize:           %llu\n", (long long)io.all_info2.out.size);
-       d_printf("\tnlink:          %u\n", io.all_info2.out.nlink);
-       d_printf("\tdelete_pending: %u\n", io.all_info2.out.delete_pending);
-       d_printf("\tdirectory:      %u\n", io.all_info2.out.directory);
-       d_printf("\tfile_id:        %llu\n", (long long)io.all_info2.out.file_id);
-       d_printf("\tea_size:        %u\n", io.all_info2.out.ea_size);
-       d_printf("\taccess_mask:    0x%08x\n", io.all_info2.out.access_mask);
-       d_printf("\tposition:       0x%llx\n", (long long)io.all_info2.out.position);
-       d_printf("\tmode:           0x%llx\n", (long long)io.all_info2.out.mode);
+       torture_comment(tctx, "all_info for '%s'\n", io.all_info2.out.fname.s);
+       torture_comment(tctx, "\tcreate_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.create_time));
+       torture_comment(tctx, "\taccess_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.access_time));
+       torture_comment(tctx, "\twrite_time:     %s\n", nt_time_string(tmp_ctx, io.all_info2.out.write_time));
+       torture_comment(tctx, "\tchange_time:    %s\n", nt_time_string(tmp_ctx, io.all_info2.out.change_time));
+       torture_comment(tctx, "\tattrib:         0x%x\n", io.all_info2.out.attrib);
+       torture_comment(tctx, "\tunknown1:       0x%x\n", io.all_info2.out.unknown1);
+       torture_comment(tctx, "\talloc_size:     %llu\n", (long long)io.all_info2.out.alloc_size);
+       torture_comment(tctx, "\tsize:           %llu\n", (long long)io.all_info2.out.size);
+       torture_comment(tctx, "\tnlink:          %u\n", io.all_info2.out.nlink);
+       torture_comment(tctx, "\tdelete_pending: %u\n", io.all_info2.out.delete_pending);
+       torture_comment(tctx, "\tdirectory:      %u\n", io.all_info2.out.directory);
+       torture_comment(tctx, "\tfile_id:        %llu\n", (long long)io.all_info2.out.file_id);
+       torture_comment(tctx, "\tea_size:        %u\n", io.all_info2.out.ea_size);
+       torture_comment(tctx, "\taccess_mask:    0x%08x\n", io.all_info2.out.access_mask);
+       torture_comment(tctx, "\tposition:       0x%llx\n", (long long)io.all_info2.out.position);
+       torture_comment(tctx, "\tmode:           0x%llx\n", (long long)io.all_info2.out.mode);
 
        /* short name, if any */
        io.generic.level = RAW_FILEINFO_ALT_NAME_INFORMATION;
        status = smb2_getinfo_file(tree, tmp_ctx, &io);
        if (NT_STATUS_IS_OK(status)) {
-               d_printf("\tshort name:     '%s'\n", io.alt_name_info.out.fname.s);
+               torture_comment(tctx, "\tshort name:     '%s'\n", io.alt_name_info.out.fname.s);
        }
 
        /* the EAs, if any */
@@ -224,7 +230,7 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
        if (NT_STATUS_IS_OK(status)) {
                int i;
                for (i=0;i<io.all_eas.out.num_eas;i++) {
-                       d_printf("\tEA[%d] flags=%d len=%d '%s'\n", i,
+                       torture_comment(tctx, "\tEA[%d] flags=%d len=%d '%s'\n", i,
                                 io.all_eas.out.eas[i].flags,
                                 (int)io.all_eas.out.eas[i].value.length,
                                 io.all_eas.out.eas[i].name.s);
@@ -237,12 +243,12 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
        if (NT_STATUS_IS_OK(status)) {
                int i;
                for (i=0;i<io.stream_info.out.num_streams;i++) {
-                       d_printf("\tstream %d:\n", i);
-                       d_printf("\t\tsize       %ld\n", 
+                       torture_comment(tctx, "\tstream %d:\n", i);
+                       torture_comment(tctx, "\t\tsize       %ld\n",
                                 (long)io.stream_info.out.streams[i].size);
-                       d_printf("\t\talloc size %ld\n", 
+                       torture_comment(tctx, "\t\talloc size %ld\n",
                                 (long)io.stream_info.out.streams[i].alloc_size);
-                       d_printf("\t\tname       %s\n", io.stream_info.out.streams[i].stream_name.s);
+                       torture_comment(tctx, "\t\tname       %s\n", io.stream_info.out.streams[i].stream_name.s);
                }
        }       
 
@@ -358,7 +364,7 @@ bool torture_smb2_session_setup(struct torture_context *tctx,
        status = smb2_session_setup_spnego(session, credentials,
                                           previous_session_id);
        if (!NT_STATUS_IS_OK(status)) {
-               printf("session setup failed: %s\n", nt_errstr(status));
+               torture_comment(tctx, "session setup failed: %s\n", nt_errstr(status));
                talloc_free(session);
                return false;
        }
@@ -395,7 +401,7 @@ bool torture_smb2_connection_ext(struct torture_context *tctx,
                                  lpcfg_gensec_settings(tctx, tctx->lp_ctx)
                                  );
        if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
+               torture_comment(tctx, "Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
                       host, share, nt_errstr(status));
                return false;
        }
@@ -430,7 +436,7 @@ bool torture_smb2_con_sopt(struct torture_context *tctx,
        lpcfg_smbcli_options(tctx->lp_ctx, &options);
 
        if (share == NULL) {
-               printf("No share for option %s\n", soption);
+               torture_comment(tctx, "No share for option %s\n", soption);
                return false;
        }
 
@@ -448,7 +454,7 @@ bool torture_smb2_con_sopt(struct torture_context *tctx,
                                  lpcfg_gensec_settings(tctx, tctx->lp_ctx)
                                  );
        if (!NT_STATUS_IS_OK(status)) {
-               printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
+               torture_comment(tctx, "Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
                       host, share, nt_errstr(status));
                return false;
        }
@@ -538,10 +544,11 @@ NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
   create a complex file using SMB2, to make it easier to
   find fields in SMB2 getinfo levels
 */
-NTSTATUS torture_setup_complex_file(struct smb2_tree *tree, const char *fname)
+NTSTATUS torture_setup_complex_file(struct torture_context *tctx,
+                                   struct smb2_tree *tree, const char *fname)
 {
        struct smb2_handle handle;
-       NTSTATUS status = smb2_create_complex_file(tree, fname, &handle);
+       NTSTATUS status = smb2_create_complex_file(tctx, tree, fname, &handle);
        NT_STATUS_NOT_OK_RETURN(status);
        return smb2_util_close(tree, handle);
 }
@@ -551,10 +558,11 @@ NTSTATUS torture_setup_complex_file(struct smb2_tree *tree, const char *fname)
   create a complex dir using SMB2, to make it easier to
   find fields in SMB2 getinfo levels
 */
-NTSTATUS torture_setup_complex_dir(struct smb2_tree *tree, const char *fname)
+NTSTATUS torture_setup_complex_dir(struct torture_context *tctx,
+                                  struct smb2_tree *tree, const char *fname)
 {
        struct smb2_handle handle;
-       NTSTATUS status = smb2_create_complex_dir(tree, fname, &handle);
+       NTSTATUS status = smb2_create_complex_dir(tctx, tree, fname, &handle);
        NT_STATUS_NOT_OK_RETURN(status);
        return smb2_util_close(tree, handle);
 }