[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1279-gd8f3f7c

Stefan Metzmacher metze at samba.org
Sat Apr 25 04:20:28 GMT 2009


The branch, master has been updated
       via  d8f3f7cd42273c172d9db8a1e4f447ed2f0876d7 (commit)
       via  a6781441628a40bc8b4694280eeda0b6b6bcea71 (commit)
       via  09f1754a9b402e0be5926ea6217f2592423c38da (commit)
       via  4ab243bcabefdcc044c6d517bb4d0e628227d5ac (commit)
       via  bec71ba928cf016a234396e2a7602e25e377aacc (commit)
       via  88e9f7247394c8c29350dd1dc8a1550e321bbf50 (commit)
      from  bd5c2c7dc80e0e7f6d8f36107ba7fcfc0f21ffe0 (commit)

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


- Log -----------------------------------------------------------------
commit d8f3f7cd42273c172d9db8a1e4f447ed2f0876d7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Apr 25 06:14:40 2009 +0200

    s4:selftest: don't run the smb2.durable.open test
    
    it often crashes when the server doesn't support them.
    
    metze

commit a6781441628a40bc8b4694280eeda0b6b6bcea71
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 17 19:59:25 2009 +0200

    s4:RPC-ECHO: disable the timeout test as it can't work with our client library
    
    We need proper ways to cancel requests in order to have that
    test working against a correctly behaving server over ncacn_np.
    
    metze

commit 09f1754a9b402e0be5926ea6217f2592423c38da
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 24 15:36:00 2009 +0200

    RAW-LOCK: samba4 behaves like windows 7 in regard of locking error codes
    
    metze

commit 4ab243bcabefdcc044c6d517bb4d0e628227d5ac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 24 12:28:59 2009 +0200

    s4:torture: use torture api instead of printf for RAW-LOCK
    
    metze

commit bec71ba928cf016a234396e2a7602e25e377aacc
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 24 11:23:43 2009 +0200

    s4:selftest: s4 doesn't support osxrename and directory rename yet
    
    metze

commit 88e9f7247394c8c29350dd1dc8a1550e321bbf50
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 24 11:23:07 2009 +0200

    s4:tortore: use torture api instead of printf in RAW-RENAME
    
    metze

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

Summary of changes:
 source4/selftest/knownfail   |    2 +
 source4/selftest/skip        |    1 +
 source4/torture/raw/lock.c   |  422 ++++++++++++++++++------------------------
 source4/torture/raw/rename.c |   74 ++++----
 source4/torture/rpc/echo.c   |    5 +-
 5 files changed, 226 insertions(+), 278 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail
index f5aaaa0..da503bc 100644
--- a/source4/selftest/knownfail
+++ b/source4/selftest/knownfail
@@ -8,6 +8,8 @@ local.iconv.*.next_codepoint()
 base.delete.*.deltest17
 base.delete.*.deltest20a
 base.delete.*.deltest20b
+raw.rename.*.osxrename
+raw.rename.*.directory rename
 rpc.winreg.*security
 samba4.local.registry.(dir|ldb).check hive security
 samba4.local.registry.local.security
diff --git a/source4/selftest/skip b/source4/selftest/skip
index 364d02a..cbf0fea 100644
--- a/source4/selftest/skip
+++ b/source4/selftest/skip
@@ -29,6 +29,7 @@ samba4.ntvfs.cifs.raw.qfileinfo.ipc
 smb2.notify
 smb2.scan
 smb2.lease
+smb2.durable.open
 ntvfs.cifs.base.charset
 ntvfs.cifs.base.iometer
 ntvfs.cifs.base.casetable
diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index 7e3ac29..f798f50 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -32,25 +32,28 @@
 
 #define CHECK_STATUS(status, correct) do { \
 	if (!NT_STATUS_EQUAL(status, correct)) { \
-		printf("(%s) Incorrect status %s - should be %s\n", \
-		       __location__, nt_errstr(status), nt_errstr(correct)); \
+		torture_result(tctx, TORTURE_FAIL, \
+			"(%s) Incorrect status %s - should be %s\n", \
+			__location__, nt_errstr(status), nt_errstr(correct)); \
 		ret = false; \
 		goto done; \
 	}} while (0)
 
 #define CHECK_STATUS_CONT(status, correct) do { \
 	if (!NT_STATUS_EQUAL(status, correct)) { \
-		printf("(%s) Incorrect status %s - should be %s\n", \
-		       __location__, nt_errstr(status), nt_errstr(correct)); \
+		torture_result(tctx, TORTURE_FAIL, \
+			"(%s) Incorrect status %s - should be %s\n", \
+			__location__, nt_errstr(status), nt_errstr(correct)); \
 		ret = false; \
 	}} while (0)
 
 #define CHECK_STATUS_OR(status, correct1, correct2) do { \
 	if ((!NT_STATUS_EQUAL(status, correct1)) && \
 	    (!NT_STATUS_EQUAL(status, correct2))) { \
-		printf("(%s) Incorrect status %s - should be %s or %s\n", \
-		       __location__, nt_errstr(status), nt_errstr(correct1), \
-		       nt_errstr(correct2)); \
+		torture_result(tctx, TORTURE_FAIL, \
+			"(%s) Incorrect status %s - should be %s or %s\n", \
+			__location__, nt_errstr(status), nt_errstr(correct1), \
+			nt_errstr(correct2)); \
 		ret = false; \
 		goto done; \
 	}} while (0)
@@ -58,14 +61,16 @@
 #define CHECK_STATUS_OR_CONT(status, correct1, correct2) do { \
 	if ((!NT_STATUS_EQUAL(status, correct1)) && \
 	    (!NT_STATUS_EQUAL(status, correct2))) { \
-		printf("(%s) Incorrect status %s - should be %s or %s\n", \
-		       __location__, nt_errstr(status), nt_errstr(correct1), \
-		       nt_errstr(correct2)); \
+		torture_result(tctx, TORTURE_FAIL, \
+			"(%s) Incorrect status %s - should be %s or %s\n", \
+			__location__, nt_errstr(status), nt_errstr(correct1), \
+			nt_errstr(correct2)); \
 		ret = false; \
 	}} while (0)
 #define BASEDIR "\\testlock"
 
 #define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
+#define TARGET_IS_SAMBA4(_tctx) (torture_setting_bool(_tctx, "samba4", false))
 
 /*
   test SMBlock and SMBunlock ops
@@ -82,17 +87,15 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 		return false;
 	}
 
-	printf("Testing RAW_LOCK_LOCK\n");
+	torture_comment(tctx, "Testing RAW_LOCK_LOCK\n");
 	io.generic.level = RAW_LOCK_LOCK;
 	
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to create %s - %s\n",
+		       fname, smbcli_errstr(cli->tree)));
 
-	printf("Trying 0/0 lock\n");
+	torture_comment(tctx, "Trying 0/0 lock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 0;
@@ -107,7 +110,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	printf("Trying 0/1 lock\n");
+	torture_comment(tctx, "Trying 0/1 lock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 1;
@@ -125,7 +128,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying 0xEEFFFFFF lock\n");
+	torture_comment(tctx, "Trying 0xEEFFFFFF lock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 4000;
@@ -143,7 +146,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying 0xEF000000 lock\n");
+	torture_comment(tctx, "Trying 0xEF000000 lock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 4000;
@@ -161,7 +164,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying max lock\n");
+	torture_comment(tctx, "Trying max lock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 4000;
@@ -179,7 +182,7 @@ static bool test_lock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying wrong pid unlock\n");
+	torture_comment(tctx, "Trying wrong pid unlock\n");
 	io.lock.level = RAW_LOCK_LOCK;
 	io.lock.in.file.fnum = fnum;
 	io.lock.in.count = 4002;
@@ -218,15 +221,13 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 		return false;
 	}
 
-	printf("Testing RAW_LOCK_LOCKX\n");
+	torture_comment(tctx, "Testing RAW_LOCK_LOCKX\n");
 	io.generic.level = RAW_LOCK_LOCKX;
 	
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to create %s - %s\n",
+		       fname, smbcli_errstr(cli->tree)));
 
 	io.lockx.level = RAW_LOCK_LOCKX;
 	io.lockx.in.file.fnum = fnum;
@@ -242,7 +243,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 
-	printf("Trying 0xEEFFFFFF lock\n");
+	torture_comment(tctx, "Trying 0xEEFFFFFF lock\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 4000;
@@ -260,7 +261,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying 0xEF000000 lock\n");
+	torture_comment(tctx, "Trying 0xEF000000 lock\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 4000;
@@ -278,7 +279,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying zero lock\n");
+	torture_comment(tctx, "Trying zero lock\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 0;
@@ -296,7 +297,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying max lock\n");
+	torture_comment(tctx, "Trying max lock\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 0;
@@ -314,7 +315,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying 2^63\n");
+	torture_comment(tctx, "Trying 2^63\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 1;
@@ -333,7 +334,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying 2^63 - 1\n");
+	torture_comment(tctx, "Trying 2^63 - 1\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 1;
@@ -353,7 +354,7 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	printf("Trying max lock 2\n");
+	torture_comment(tctx, "Trying max lock 2\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	lock[0].count = 1;
@@ -408,20 +409,20 @@ static bool test_pidhigh(struct torture_context *tctx,
 		return false;
 	}
 
-	printf("Testing high pid\n");
+	torture_comment(tctx, "Testing high pid\n");
 	io.generic.level = RAW_LOCK_LOCKX;
 
 	cli->session->pid = 1;
 	
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to create %s - %s\n",
+		       fname, smbcli_errstr(cli->tree)));
 
 	if (smbcli_write(cli->tree, fnum, 0, &c, 0, 1) != 1) {
-		printf("Failed to write 1 byte - %s\n", smbcli_errstr(cli->tree));
+		torture_result(tctx, TORTURE_FAIL,
+			"Failed to write 1 byte - %s\n",
+			smbcli_errstr(cli->tree));
 		ret = false;
 		goto done;
 	}
@@ -440,7 +441,9 @@ static bool test_pidhigh(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
-		printf("Failed to read 1 byte - %s\n", smbcli_errstr(cli->tree));
+		torture_result(tctx, TORTURE_FAIL,
+			"Failed to read 1 byte - %s\n",
+			smbcli_errstr(cli->tree));
 		ret = false;
 		goto done;
 	}
@@ -448,7 +451,8 @@ static bool test_pidhigh(struct torture_context *tctx,
 	cli->session->pid = 2;
 
 	if (smbcli_read(cli->tree, fnum, &c, 0, 1) == 1) {
-		printf("pid is incorrect handled for read with lock!\n");
+		torture_result(tctx, TORTURE_FAIL,
+			"pid is incorrect handled for read with lock!\n");
 		ret = false;
 		goto done;
 	}
@@ -456,10 +460,11 @@ static bool test_pidhigh(struct torture_context *tctx,
 	cli->session->pid = 0x10001;
 
 	if (smbcli_read(cli->tree, fnum, &c, 0, 1) != 1) {
-		printf("High pid is used on this server!\n");
+		torture_result(tctx, TORTURE_FAIL,
+			"High pid is used on this server!\n");
 		ret = false;
 	} else {
-		printf("High pid is not used on this server (correct)\n");
+		torture_warning(tctx, "High pid is not used on this server (correct)\n");
 	}
 
 done:
@@ -497,15 +502,13 @@ static bool test_async(struct torture_context *tctx,
 
 	lp_smbcli_session_options(tctx->lp_ctx, &options);
 
-	printf("Testing LOCKING_ANDX_CANCEL_LOCK\n");
+	torture_comment(tctx, "Testing LOCKING_ANDX_CANCEL_LOCK\n");
 	io.generic.level = RAW_LOCK_LOCKX;
 
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to create %s - %s\n",
+		       fname, smbcli_errstr(cli->tree)));
 
 	io.lockx.level = RAW_LOCK_LOCKX;
 	io.lockx.in.file.fnum = fnum;
@@ -522,16 +525,13 @@ static bool test_async(struct torture_context *tctx,
 
 	t = time(NULL);
 
-	printf("testing cancel by CANCEL_LOCK\n");
+	torture_comment(tctx, "testing cancel by CANCEL_LOCK\n");
 
 	/* setup a timed lock */
 	io.lockx.in.timeout = 10000;
 	req = smb_raw_lock_send(cli->tree, &io);
-	if (req == NULL) {
-		printf("Failed to setup timed lock (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
+		       "Failed to setup timed lock (%s)\n", __location__));
 
 	/* cancel the wrong range */
 	lock[0].offset = 0;
@@ -558,13 +558,10 @@ static bool test_async(struct torture_context *tctx,
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
-	if (time(NULL) > t+2) {
-		printf("lock cancel was not immediate (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
+		       "lock cancel was not immediate (%s)\n", __location__));
 
-	printf("testing cancel by unlock\n");
+	torture_comment(tctx, "testing cancel by unlock\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES;
@@ -574,11 +571,8 @@ static bool test_async(struct torture_context *tctx,
 
 	io.lockx.in.timeout = 5000;
 	req = smb_raw_lock_send(cli->tree, &io);
-	if (req == NULL) {
-		printf("Failed to setup timed lock (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
+		       "Failed to setup timed lock (%s)\n", __location__));
 
 	io.lockx.in.ulock_cnt = 1;
 	io.lockx.in.lock_cnt = 0;
@@ -589,14 +583,11 @@ static bool test_async(struct torture_context *tctx,
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
-	if (time(NULL) > t+2) {
-		printf("lock cancel by unlock was not immediate (%s) - took %d secs\n", 
-		       __location__, (int)(time(NULL)-t));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
+		       "lock cancel by unlock was not immediate (%s) - took %d secs\n",
+		       __location__, (int)(time(NULL)-t)));
 
-	printf("testing cancel by close\n");
+	torture_comment(tctx, "testing cancel by close\n");
 	io.lockx.in.ulock_cnt = 0;
 	io.lockx.in.lock_cnt = 1;
 	io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES;
@@ -607,11 +598,8 @@ static bool test_async(struct torture_context *tctx,
 	t = time(NULL);
 	io.lockx.in.timeout = 10000;
 	req = smb_raw_lock_send(cli->tree, &io);
-	if (req == NULL) {
-		printf("Failed to setup timed lock (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
+		       "Failed to setup timed lock (%s)\n", __location__));
 
 	status = smbcli_close(cli->tree, fnum);
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -619,13 +607,10 @@ static bool test_async(struct torture_context *tctx,
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	if (time(NULL) > t+2) {
-		printf("lock cancel by close was not immediate (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
+		       "lock cancel by close was not immediate (%s)\n", __location__));
 
-	printf("create a new sessions\n");
+	torture_comment(tctx, "create a new sessions\n");
 	session = smbcli_session_init(cli->transport, tctx, false, options);
 	setup.in.sesskey = cli->transport->negotiate.sesskey;
 	setup.in.capabilities = cli->transport->negotiate.capabilities;
@@ -636,7 +621,7 @@ static bool test_async(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 	session->vuid = setup.out.vuid;
 
-	printf("create new tree context\n");
+	torture_comment(tctx, "create new tree context\n");
 	share = torture_setting_string(tctx, "share", NULL);
 	host  = torture_setting_string(tctx, "host", NULL);
 	tree = smbcli_tree_init(session, tctx, false);
@@ -649,14 +634,13 @@ static bool test_async(struct torture_context *tctx,
 	CHECK_STATUS(status, NT_STATUS_OK);
 	tree->tid = tcon.tconx.out.tid;
 
-	printf("testing cancel by exit\n");
+	torture_comment(tctx, "testing cancel by exit\n");
 	fname = BASEDIR "\\test_exit.txt";
 	fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to reopen %s - %s\n",
+		       fname, smbcli_errstr(tree)));
+
 	io.lockx.level = RAW_LOCK_LOCKX;
 	io.lockx.in.file.fnum = fnum;
 	io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES;
@@ -680,11 +664,8 @@ static bool test_async(struct torture_context *tctx,
 	io.lockx.in.timeout = 10000;
 	t = time(NULL);
 	req = smb_raw_lock_send(tree, &io);
-	if (req == NULL) {
-		printf("Failed to setup timed lock (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
+		       "Failed to setup timed lock (%s)\n", __location__));
 
 	status = smb_raw_exit(session);
 	CHECK_STATUS(status, NT_STATUS_OK);
@@ -692,20 +673,16 @@ static bool test_async(struct torture_context *tctx,
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
-	if (time(NULL) > t+2) {
-		printf("lock cancel by exit was not immediate (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,!(time(NULL) > t+2), talloc_asprintf(tctx,
+		       "lock cancel by exit was not immediate (%s)\n", __location__));
 
-	printf("testing cancel by ulogoff\n");
+	torture_comment(tctx, "testing cancel by ulogoff\n");
 	fname = BASEDIR "\\test_ulogoff.txt";
 	fnum = smbcli_open(tree, fname, O_RDWR|O_CREAT, DENY_NONE);
-	if (fnum == -1) {
-		printf("Failed to reopen %s - %s\n", fname, smbcli_errstr(tree));
-		ret = false;
-		goto done;
-	}
+	torture_assert(tctx,(fnum != -1), talloc_asprintf(tctx,
+		       "Failed to reopen %s - %s\n",
+		       fname, smbcli_errstr(tree)));
+
 	io.lockx.level = RAW_LOCK_LOCKX;
 	io.lockx.in.file.fnum = fnum;
 	io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES;
@@ -729,18 +706,16 @@ static bool test_async(struct torture_context *tctx,
 	io.lockx.in.timeout = 10000;
 	t = time(NULL);
 	req = smb_raw_lock_send(tree, &io);
-	if (req == NULL) {
-		printf("Failed to setup timed lock (%s)\n", __location__);
-		ret = false;
-		goto done;
-	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list