[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Mar 6 17:35:07 MST 2012


The branch, master has been updated
       via  4f5412d s3:selftest: ask smbtorture4 for smb2 tests
       via  3a75195 selftest: skip samba3.smb2.scan because they are no tests
       via  25ba1c7 selftest: remove samba3.smb2.*scan from knownfail
       via  46a96c4 s4:torture make a suite for smb2.*scan
       via  59f818d s4:torture: print ntstatus on failure of setup complex file in smb2 setinfo/getinfo scan
       via  af6555d s4:torture: use different filenames for smb2 setinfo and getinfo scan
       via  80436ed s4:torture: cleanup after smb2 setinfo scan
       via  2b3ed65 s4:torture: cleanup after smb2 getinfo scan
       via  cbe918d selftest: skip samba3.smb2.session because it hangs
       via  c14dacb selftest: skip samba3.smb2.hold-oplock because its not a test
       via  632b104 selftest: mark samba3.smb2.ioctl tests knownfail
       via  f0392e1 selftest: mark samba3.smb2.durable-v2-open tests as knownfail
       via  6fb34b9 selftest: mark samba3.smb2.durable-open.oplock test knownfail
       via  3c826d4 selftest: mark samba3.smb2.durable-open reopen tests knownfail
       via  a3994f6 selftest: samba3.smb2.compound.invalid2 works
       via  7dc26c2 selftest: mark smb2 tests knownfail failing in 3.6
       via  10f266b s4:torture: avoid reporting error on failure of smb2.ioctl tests
       via  01774d6 s4:torture: avoid reporting error on failure of smb2.getinfo test
       via  2aa81dc s4:torture: avoid reporting error on failure of smb2.setinfo test
       via  dc44cbf s4:torture: avoid reporting error on failure of smb2.streams tests
       via  b80e956 s4:torture: avoid reporting error on failure of smb2.acls tests
      from  68b8407 s3:smbd: keep 'num_files' and 'files' directly under smbd_server_connection

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4f5412dda687c3ff76b426842bf284d01d56a997
Author: Gregor Beck <gbeck at sernet.de>
Date:   Thu Feb 2 12:02:00 2012 +0100

    s3:selftest: ask smbtorture4 for smb2 tests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User: Stefan Metzmacher <metze at samba.org>
    Autobuild-Date: Wed Mar  7 01:34:05 CET 2012 on sn-devel-104

commit 3a751958b3d52cec5e52dba7797c2b613d875358
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 12:15:00 2012 +0100

    selftest: skip samba3.smb2.scan because they are no tests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 25ba1c7bc65dcb0d01069c0dc64dad3672964932
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 12:12:58 2012 +0100

    selftest: remove samba3.smb2.*scan from knownfail
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 46a96c42a2fe29b3176047ce1024e016716df187
Author: Gregor Beck <gbeck at sernet.de>
Date:   Thu Mar 1 15:59:41 2012 +0100

    s4:torture make a suite for smb2.*scan
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 59f818d80b4cdf4f67b653d3754e4eebe279915b
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 12:05:59 2012 +0100

    s4:torture: print ntstatus on failure of setup complex file in smb2 setinfo/getinfo scan
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit af6555d2a9f3b09238aa2e9a924f08aabe9d6090
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 12:02:18 2012 +0100

    s4:torture: use different filenames for smb2 setinfo and getinfo scan
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 80436ed0995164819935eea18e9b45f0edb7f849
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 11:20:18 2012 +0100

    s4:torture: cleanup after smb2 setinfo scan
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 2b3ed652734482869bbe77d44db89f79440c3b3e
Author: Gregor Beck <gbeck at sernet.de>
Date:   Fri Mar 2 11:19:48 2012 +0100

    s4:torture: cleanup after smb2 getinfo scan
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit cbe918d10645520d8e996af9a4652ce220ca2c91
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:10:30 2012 +0100

    selftest: skip samba3.smb2.session because it hangs
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit c14dacbebe47f880cb8cc08b80887c0c1d8bb2e8
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:09:56 2012 +0100

    selftest: skip samba3.smb2.hold-oplock because its not a test
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 632b1042aed94a71d810613fcdbbfecf615a25fa
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:07:27 2012 +0100

    selftest: mark samba3.smb2.ioctl tests knownfail
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit f0392e1b04fcbef100e35d32074724f25b073eec
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Mar 6 19:35:55 2012 +0100

    selftest: mark samba3.smb2.durable-v2-open tests as knownfail
    
    metze

commit 6fb34b951ea3d63037e3e76a12f3e512dd60cfc7
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:06:11 2012 +0100

    selftest: mark samba3.smb2.durable-open.oplock test knownfail
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 3c826d4411a280ccc93fbddf7bf531c2f75ef050
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:05:12 2012 +0100

    selftest: mark samba3.smb2.durable-open reopen tests knownfail
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit a3994f673b186b137fc1556be7a7a0fddfd0474d
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 07:58:44 2012 +0100

    selftest: samba3.smb2.compound.invalid2 works
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 7dc26c2799e6c4c9d3506b0bd190edd51c8d9f08
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 07:57:52 2012 +0100

    selftest: mark smb2 tests knownfail failing in 3.6
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 10f266b6ed2553619da8bf028644b923988abb03
Author: Gregor Beck <gbeck at sernet.de>
Date:   Wed Feb 29 11:02:20 2012 +0100

    s4:torture: avoid reporting error on failure of smb2.ioctl tests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 01774d65c28facb0721978fd10391acd15b0dc1d
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Feb 28 14:19:49 2012 +0100

    s4:torture: avoid reporting error on failure of smb2.getinfo test
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 2aa81dc81706a37e28b0a09b2ecf7ea1eb08461a
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Feb 28 12:53:29 2012 +0100

    s4:torture: avoid reporting error on failure of smb2.setinfo test
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit dc44cbfb1aed3dd375ccdad2ba701fc817c4d0b0
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Feb 28 12:54:35 2012 +0100

    s4:torture: avoid reporting error on failure of smb2.streams tests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit b80e95633ea4046108fd3941500d317028eb0e39
Author: Gregor Beck <gbeck at sernet.de>
Date:   Tue Feb 28 12:46:41 2012 +0100

    s4:torture: avoid reporting error on failure of smb2.acls tests
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 selftest/knownfail             |   51 +++++++++
 selftest/skip                  |    3 +
 source3/selftest/tests.py      |   11 ++-
 source4/torture/smb2/acls.c    |    5 +-
 source4/torture/smb2/getinfo.c |   86 ++++++----------
 source4/torture/smb2/ioctl.c   |  227 ++++++++++++++--------------------------
 source4/torture/smb2/scan.c    |   53 +++++++---
 source4/torture/smb2/setinfo.c |    2 +-
 source4/torture/smb2/smb2.c    |    5 +-
 source4/torture/smb2/streams.c |   25 +++--
 10 files changed, 233 insertions(+), 235 deletions(-)


Changeset truncated at 500 lines:

diff --git a/selftest/knownfail b/selftest/knownfail
index 1a6c6bd..455ff5a 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -138,3 +138,54 @@
 ^samba4.ldap.acl.*.AclSearchTests.test_search5$  # ACL search behaviour not enabled by default
 ^samba4.ldap.acl.*.AclSearchTests.test_search6$  # ACL search behaviour not enabled by default
 ^samba4.rpc.lsa.forest.trust #Not fully provided by Samba4
+^samba3.smb2.create .gentest
+^samba3.smb2.create .blob
+^samba3.smb2.create .open
+^samba3.smb2.create .leading-slash
+^samba3.smb2.create .aclfile
+^samba3.smb2.create .acldir
+^samba3.smb2.create .nulldacl
+^samba3.smb2.notify .valid-req
+^samba3.smb2.notify .dir
+^samba3.smb2.notify .rec
+^samba3.smb2.durable-open .file-position
+^samba3.smb2.durable-open .lease
+^samba3.smb2.durable-open .lock
+^samba3.smb2.durable-open .open
+^samba3.smb2.durable-open .reopen1
+^samba3.smb2.durable-open .reopen2
+^samba3.smb2.durable-open .reopen2a
+^samba3.smb2.durable-open .reopen3
+^samba3.smb2.durable-open .reopen4
+^samba3.smb2.durable-open .oplock
+^samba3.smb2.durable-v2-open .open-oplock
+^samba3.smb2.durable-v2-open .open-lease
+^samba3.smb2.durable-v2-open .persistent-open-oplock
+^samba3.smb2.durable-v2-open .persistent-open-lease
+^samba3.smb2.ioctl .shadow_copy
+^samba3.smb2.ioctl .req_resume_key
+^samba3.smb2.ioctl .copy_chunk_simple
+^samba3.smb2.ioctl .copy_chunk_multi
+^samba3.smb2.ioctl .copy_chunk_tiny
+^samba3.smb2.ioctl .copy_chunk_overwrite
+^samba3.smb2.ioctl .copy_chunk_append
+^samba3.smb2.dir .one
+^samba3.smb2.dir .modify
+^samba3.smb2.lease .request
+^samba3.smb2.lease .upgrade
+^samba3.smb2.lease .break
+^samba3.smb2.lease .oplock
+^samba3.smb2.lease .multibreak
+^samba3.smb2.oplock .batch12
+^samba3.smb2.oplock .batch20
+^samba3.smb2.acls .CREATOR
+^samba3.smb2.acls .GENERIC
+^samba3.smb2.acls .OWNER
+^samba3.smb2.acls .INHERITANCE
+^samba3.smb2.acls .INHERITFLAGS
+^samba3.smb2.acls .DYNAMIC
+^samba3.smb2.streams .rename
+^samba3.smb2.streams .rename2
+^samba3.smb2.streams .attributes
+^samba3.smb2.getinfo .getinfo
+^samba3.smb2.setinfo .setinfo
diff --git a/selftest/skip b/selftest/skip
index 5b7de62..9d71f95 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -41,6 +41,9 @@
 ^samba3.*raw.qfileinfo
 ^samba3.*raw.qfsinfo
 ^samba3.*raw.sfileinfo.base
+^samba3.smb2.hold-oplock                # Not a test, but a way to block other clients for a test
+^samba3.smb2.scan                       # No tests
+^samba3.smb2.session                    # Hangs
 ^samba4.raw.composite
 ^samba4.base.iometer
 ^samba4.base.casetable
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 74c745f..591a351 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -38,18 +38,26 @@ if not os.getenv("SELFTEST_VERBOSE"):
 torture_options.append("--format=subunit")
 if os.getenv("SELFTEST_QUICK"):
     torture_options.append("--option=torture:quick=yes")
+
+smb4torture_testsuite_list = subprocess.Popen([smb4torture, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines()
+
 smb4torture += " " + " ".join(torture_options)
 
 sub = subprocess.Popen("%s --version 2> /dev/null" % smb4torture, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
 sub.communicate("")
 smb4torture_possible = (sub.returncode == 0)
 
+
+def smb4torture_testsuites(prefix):
+    return filter(lambda x: x.startswith(prefix), smb4torture_testsuite_list)
+
 def plansmbtorturetestsuite(name, env, options, description=''):
     modname = "samba3.%s %s" % (name, description)
     cmdline = "%s $LISTOPT %s %s" % (valgrindify(smb4torture), options, name)
     if smb4torture_possible:
         plantestsuite_loadlist(modname, env, cmdline)
 
+
 plantestsuite("samba3.blackbox.success", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_success.sh")])
 plantestsuite("samba3.blackbox.failure", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_failure.sh")])
 
@@ -213,8 +221,7 @@ raw = ["raw.acls", "raw.chkpath", "raw.close", "raw.composite", "raw.context", "
        "raw.bench-oplock", "raw.bench-lock", "raw.bench-open", "raw.bench-tcon",
        "raw.samba3checkfsp", "raw.samba3closeerr", "raw.samba3oplocklogoff"]
 
-smb2 = ["smb2.lock", "smb2.read", "smb2.compound", "smb2.connect", "smb2.scan", "smb2.scanfind",
-        "smb2.bench-oplock", "smb2.rename"]
+smb2 = smb4torture_testsuites("smb2.")
 
 rpc = ["rpc.authcontext", "rpc.samba3.bind", "rpc.samba3.srvsvc", "rpc.samba3.sharesec",
        "rpc.samba3.spoolss", "rpc.samba3.wkssvc", "rpc.samba3.winreg",
diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
index fa6c002..37052c6 100644
--- a/source4/torture/smb2/acls.c
+++ b/source4/torture/smb2/acls.c
@@ -72,11 +72,14 @@
 
 #define CHECK_SECURITY_DESCRIPTOR(_sd1, _sd2) do { \
 	if (!security_descriptor_equal(_sd1, _sd2)) { \
-		torture_warning(tctx, "%s: security descriptors don't match!\n", __location__); \
+		torture_warning(tctx, "security descriptors don't match!\n"); \
 		torture_warning(tctx, "got:\n"); \
 		NDR_PRINT_DEBUG(security_descriptor, _sd1); \
 		torture_warning(tctx, "expected:\n"); \
 		NDR_PRINT_DEBUG(security_descriptor, _sd2); \
+		torture_result(tctx, TORTURE_FAIL, \
+			       "%s: security descriptors don't match!\n", \
+			       __location__); \
 		ret = false; \
 	} \
 } while (0)
diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c
index 166c3f6..2e30190 100644
--- a/source4/torture/smb2/getinfo.c
+++ b/source4/torture/smb2/getinfo.c
@@ -84,16 +84,12 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree
 	int i;
 
 	status = torture_smb2_testfile(tree, FNAME, &hfile);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf(__location__ " Unable to create test file '%s' - %s\n", FNAME, nt_errstr(status));
-		goto failed;
-	}
+	torture_assert_ntstatus_ok(tctx, status, "Unable to create test file "
+				   FNAME "\n");
 
 	status = torture_smb2_testdir(tree, DNAME, &hdir);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf(__location__ " Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status));
-		goto failed;
-	}
+	torture_assert_ntstatus_ok(tctx, status, "Unable to create test dir "
+				   DNAME "\n");
 
 	printf("Testing file info levels\n");
 	torture_smb2_all_info(tree, hfile);
@@ -105,40 +101,33 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree
 			file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7;
 		}
 		if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) {
-			file_levels[i].finfo.all_eas.in.continue_flags = 
+			file_levels[i].finfo.all_eas.in.continue_flags =
 				SMB2_CONTINUE_FLAG_RESTART;
-			file_levels[i].dinfo.all_eas.in.continue_flags = 
+			file_levels[i].dinfo.all_eas.in.continue_flags =
 				SMB2_CONTINUE_FLAG_RESTART;
 		}
 		file_levels[i].finfo.generic.level = file_levels[i].level;
 		file_levels[i].finfo.generic.in.file.handle = hfile;
 		file_levels[i].fstatus = smb2_getinfo_file(tree, tree, &file_levels[i].finfo);
-		if (!NT_STATUS_IS_OK(file_levels[i].fstatus)) {
-			printf("(%s) %s failed on file - %s\n", __location__,
-				file_levels[i].name, nt_errstr(file_levels[i].fstatus));
-			goto failed;
-		}
+		torture_assert_ntstatus_ok(tctx, file_levels[i].fstatus,
+					   talloc_asprintf(tctx, "%s on file",
+							   file_levels[i].name));
 		file_levels[i].dinfo.generic.level = file_levels[i].level;
 		file_levels[i].dinfo.generic.in.file.handle = hdir;
 		file_levels[i].dstatus = smb2_getinfo_file(tree, tree, &file_levels[i].dinfo);
-		if (!NT_STATUS_IS_OK(file_levels[i].dstatus)) {
-			printf("(%s) %s failed on dir - %s\n", __location__,
-				file_levels[i].name, nt_errstr(file_levels[i].dstatus));
-			goto failed;
-		}
+		torture_assert_ntstatus_ok(tctx, file_levels[i].dstatus,
+					   talloc_asprintf(tctx, "%s on dir",
+							   file_levels[i].name));
 	}
 
 	return true;
-
-failed:
-	return false;
 }
 
 
 /*
   test fsinfo levels
 */
-static bool torture_smb2_fsinfo(struct smb2_tree *tree)
+static bool torture_smb2_fsinfo(struct torture_context *tctx, struct smb2_tree *tree)
 {
 	int i;
 	NTSTATUS status;
@@ -146,19 +135,14 @@ static bool torture_smb2_fsinfo(struct smb2_tree *tree)
 
 	printf("Testing fsinfo levels\n");
 	status = smb2_util_roothandle(tree, &handle);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf(__location__ " Unable to create root handle - %s\n", nt_errstr(status));
-		return false;
-	}
+	torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle");
 
 	for (i=0;i<ARRAY_SIZE(fs_levels);i++) {
 		fs_levels[i].info.generic.level = fs_levels[i].level;
 		fs_levels[i].info.generic.handle = handle;
 		fs_levels[i].status = smb2_getinfo_fs(tree, tree, &fs_levels[i].info);
-		if (!NT_STATUS_IS_OK(fs_levels[i].status)) {
-			printf("%s failed - %s\n", fs_levels[i].name, nt_errstr(fs_levels[i].status));
-			return false;
-		}
+		torture_assert_ntstatus_ok(tctx, fs_levels[i].status,
+					   fs_levels[i].name);
 	}
 
 	return true;
@@ -168,7 +152,7 @@ static bool torture_smb2_fsinfo(struct smb2_tree *tree)
 /*
   test for buffer size handling
 */
-static bool torture_smb2_buffercheck(struct smb2_tree *tree)
+static bool torture_smb2_buffercheck(struct torture_context *tctx, struct smb2_tree *tree)
 {
 	NTSTATUS status;
 	struct smb2_handle handle;
@@ -176,10 +160,7 @@ static bool torture_smb2_buffercheck(struct smb2_tree *tree)
 
 	printf("Testing buffer size handling\n");
 	status = smb2_util_roothandle(tree, &handle);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf(__location__ " Unable to create root handle - %s\n", nt_errstr(status));
-		return false;
-	}
+	torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle");
 
 	ZERO_STRUCT(b);
 	b.in.info_type            = SMB2_GETINFO_FS;
@@ -189,12 +170,9 @@ static bool torture_smb2_buffercheck(struct smb2_tree *tree)
 	b.in.file.handle          = handle;
 
 	status = smb2_getinfo(tree, tree, &b);
-	if (!NT_STATUS_EQUAL(status, NT_STATUS_INFO_LENGTH_MISMATCH)) {
-		printf(__location__ " Wrong error code for small buffer %s\n",
-		       nt_errstr(status));
-		return false;
-	}
-
+	torture_assert_ntstatus_equal(tctx, status,
+				      NT_STATUS_INFO_LENGTH_MISMATCH,
+				      "Wrong error code for small buffer");
 	return true;
 }
 
@@ -208,27 +186,27 @@ bool torture_smb2_getinfo(struct torture_context *torture)
 	bool ret = true;
 	NTSTATUS status;
 
-	if (!torture_smb2_connection(torture, &tree)) {
-		return false;
-	}
+	ret = torture_smb2_connection(torture, &tree);
+	torture_assert(torture, ret, "connection failed");
 
 	smb2_deltree(tree, FNAME);
 	smb2_deltree(tree, DNAME);
 
 	status = torture_setup_complex_file(tree, FNAME);
-	if (!NT_STATUS_IS_OK(status)) {
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status,
+				   "setup complex file " FNAME);
+
 	torture_setup_complex_file(tree, FNAME ":streamtwo");
+
 	status = torture_setup_complex_dir(tree, DNAME);
-	if (!NT_STATUS_IS_OK(status)) {
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status,
+				   "setup complex dir " DNAME);
+
 	torture_setup_complex_file(tree, DNAME ":streamtwo");
 
 	ret &= torture_smb2_fileinfo(torture, tree);
-	ret &= torture_smb2_fsinfo(tree);
-	ret &= torture_smb2_buffercheck(tree);
+	ret &= torture_smb2_fsinfo(torture, tree);
+	ret &= torture_smb2_buffercheck(torture, tree);
 
 	talloc_free(mem_ctx);
 
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index cbef4d7..ad300c0 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -45,17 +45,11 @@ static bool test_ioctl_get_shadow_copy(struct torture_context *torture,
 	smb2_util_unlink(tree, FNAME);
 
 	status = torture_smb2_testfile(tree, FNAME, &h);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("create write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "create write");
 
 	ZERO_ARRAY(buf);
 	status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("failed write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "write");
 
 	ZERO_STRUCT(ioctl);
 	ioctl.smb2.level = RAW_IOCTL_SMB2;
@@ -65,10 +59,7 @@ static bool test_ioctl_get_shadow_copy(struct torture_context *torture,
 	ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
 
 	status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("FSCTL_SRV_ENUM_SNAPS failed\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "FSCTL_SRV_ENUM_SNAPS");
 
 	return true;
 }
@@ -90,17 +81,11 @@ static bool test_ioctl_req_resume_key(struct torture_context *torture,
 	smb2_util_unlink(tree, FNAME);
 
 	status = torture_smb2_testfile(tree, FNAME, &h);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("create write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "create write");
 
 	ZERO_ARRAY(buf);
 	status = smb2_util_write(tree, h, buf, 0, ARRAY_SIZE(buf));
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("failed write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "write");
 
 	ZERO_STRUCT(ioctl);
 	ioctl.smb2.level = RAW_IOCTL_SMB2;
@@ -110,16 +95,12 @@ static bool test_ioctl_req_resume_key(struct torture_context *torture,
 	ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
 
 	status = smb2_ioctl(tree, tmp_ctx, &ioctl.smb2);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("FSCTL_SRV_REQUEST_RESUME_KEY failed\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "FSCTL_SRV_REQUEST_RESUME_KEY");
 
 	ndr_ret = ndr_pull_struct_blob(&ioctl.smb2.out.out, tmp_ctx, &res_key,
 			(ndr_pull_flags_fn_t)ndr_pull_req_resume_key_rsp);
-	if (ndr_ret != NDR_ERR_SUCCESS) {
-		return false;
-	}
+	torture_assert_ndr_success(torture, ndr_ret,
+				   "ndr_pull_req_resume_key_rsp");
 
 	ndr_print_debug((ndr_print_fn_t)ndr_print_req_resume_key_rsp, "yo", &res_key);
 
@@ -132,7 +113,8 @@ static uint64_t patt_hash(uint64_t off)
 	return off;
 }
 
-static bool check_pattern(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
+static bool check_pattern(struct torture_context *torture,
+			  struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 			  struct smb2_handle h, uint64_t off, uint64_t len,
 			  uint64_t patt_off)
 {
@@ -145,30 +127,25 @@ static bool check_pattern(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 	r.in.length      = len;
 	r.in.offset      = off;
 	status = smb2_read(tree, mem_ctx, &r);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("read failed - %s\n", nt_errstr(status));
-		return false;
-	} else if (len != r.out.data.length) {
-		printf("read data len mismatch got %zu, expected %llu\n",
-		       r.out.data.length, (unsigned long long)len);
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "read");
+
+	torture_assert_u64_equal(torture, r.out.data.length, len,
+				 "read data len mismatch");
 
 	for (i = 0; i <= len - 8; i += 8, patt_off += 8) {
-		if (BVAL(r.out.data.data, i) != patt_hash(patt_off)) {
-			printf("pattern bad at %llu, got %llx, expected %llx\n",
-			       (unsigned long long)i,
-			       (unsigned long long)BVAL(r.out.data.data, i),
-			       (unsigned long long)patt_hash(patt_off));
-			return false;
-		}
+		uint64_t data = BVAL(r.out.data.data, i);
+		torture_assert_u64_equal(torture, data, patt_hash(patt_off),
+					 talloc_asprintf(torture, "read data "
+							 "pattern bad at %llu\n",
+							 (unsigned long long)i));
 	}
 
 	talloc_free(r.out.data.data);
 	return true;
 }
 
-static bool test_setup_copy_chunk(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
+static bool test_setup_copy_chunk(struct torture_context *torture,
+				  struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 				  uint32_t nchunks,
 				  struct smb2_handle *src_h,
 				  uint64_t src_size,
@@ -191,37 +168,25 @@ static bool test_setup_copy_chunk(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 	smb2_util_unlink(tree, FNAME2);
 
 	status = torture_smb2_testfile(tree, FNAME, src_h);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("create write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "create write");
 
 	if (src_size > 0) {
 		for (i = 0; i <= src_size - 8; i += 8) {
 			SBVAL(buf, i, patt_hash(i));
 		}
 		status = smb2_util_write(tree, *src_h, buf, 0, src_size);
-		if (!NT_STATUS_IS_OK(status)) {
-			printf("failed src write\n");
-			return false;
-		}
+		torture_assert_ntstatus_ok(torture, status, "src write");
 	}
 
 	status = torture_smb2_testfile(tree, FNAME2, dest_h);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("create write\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status, "create write");
 
 	if (dest_size > 0) {
 		for (i = 0; i <= src_size - 8; i += 8) {
 			SBVAL(buf, i, patt_hash(i));
 		}
 		status = smb2_util_write(tree, *dest_h, buf, 0, dest_size);
-		if (!NT_STATUS_IS_OK(status)) {
-			printf("failed dest write\n");
-			return false;
-		}
+		torture_assert_ntstatus_ok(torture, status, "dest write");
 	}
 
 	ZERO_STRUCTPN(ioctl);
@@ -233,16 +198,15 @@ static bool test_setup_copy_chunk(struct smb2_tree *tree, TALLOC_CTX *mem_ctx,
 	ioctl->smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
 
 	status = smb2_ioctl(tree, mem_ctx, &ioctl->smb2);
-	if (!NT_STATUS_IS_OK(status)) {
-		printf("FSCTL_SRV_REQUEST_RESUME_KEY failed\n");
-		return false;
-	}
+	torture_assert_ntstatus_ok(torture, status,
+				   "FSCTL_SRV_REQUEST_RESUME_KEY");
+
 
 	ndr_ret = ndr_pull_struct_blob(&ioctl->smb2.out.out, mem_ctx, &res_key,
 			(ndr_pull_flags_fn_t)ndr_pull_req_resume_key_rsp);
-	if (ndr_ret != NDR_ERR_SUCCESS) {
-		return false;
-	}
+
+	torture_assert_ndr_success(torture, ndr_ret,
+				   "ndr_pull_req_resume_key_rsp");
 
 	ZERO_STRUCTPN(ioctl);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list