[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-246-gf5b0745

Stefan Metzmacher metze at samba.org
Mon Jul 6 13:50:42 GMT 2009


The branch, master has been updated
       via  f5b07455d974969ee5eae2c529283034f275f82e (commit)
       via  ad17cf1772dfa34b8c691df372a1118575e62692 (commit)
      from  9216b2040c8af5699a7d3e484addfcda41142641 (commit)

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


- Log -----------------------------------------------------------------
commit f5b07455d974969ee5eae2c529283034f275f82e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 6 15:48:32 2009 +0200

    RAW-LOCK: fix a compiler warning and make a global static const
    
    metze

commit ad17cf1772dfa34b8c691df372a1118575e62692
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Jul 6 15:36:03 2009 +0200

    RAW-LOCK: fix the run against w2k3, w2k8, win7rc and samba3/4
    
    We now allow --target=w2k8.
    
    The strange thing is that w2k8 and win7rc only do half of the timeout
    that was given by the client.
    
    metze

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

Summary of changes:
 source4/torture/raw/lock.c   |   90 ++++++++++++++++++++++++------------------
 source4/torture/smbtorture.c |    2 +
 2 files changed, 54 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c
index f798f50..0228837 100644
--- a/source4/torture/raw/lock.c
+++ b/source4/torture/raw/lock.c
@@ -69,8 +69,9 @@
 	}} while (0)
 #define BASEDIR "\\testlock"
 
+#define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
 #define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
-#define TARGET_IS_SAMBA4(_tctx) (torture_setting_bool(_tctx, "samba4", false))
+#define TARGET_IS_SAMBA3(_tctx) (torture_setting_bool(_tctx, "samba3", false))
 
 /*
   test SMBlock and SMBunlock ops
@@ -374,15 +375,9 @@ static bool test_lockx(struct torture_context *tctx, struct smbcli_state *cli)
 	lock[0].count = 1;
 	status = smb_raw_lock(cli->tree, &io);
 
-	/* XXX This is very strange - Win7 gives us an invalid range when we
-	 * unlock the range even though the range is locked! Win7 bug? */
-	if (TARGET_IS_WIN7(tctx))
-		CHECK_STATUS(status, NT_STATUS_INVALID_LOCK_RANGE);
-	else {
-		CHECK_STATUS(status, NT_STATUS_OK);
-		status = smb_raw_lock(cli->tree, &io);
-		CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
-	}
+	CHECK_STATUS(status, NT_STATUS_OK);
+	status = smb_raw_lock(cli->tree, &io);
+	CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
 
 done:
 	smbcli_close(cli->tree, fnum);
@@ -788,6 +783,7 @@ static bool test_errorcode(struct torture_context *tctx,
 	struct smbcli_request *req;
 	time_t start;
 	int t;
+	int delay;
 
 	if (!torture_setup_dir(cli, BASEDIR)) {
 		return false;
@@ -1091,12 +1087,17 @@ next_run:
 	/* end of the loop */
 	if (t == 0) {
 		smb_raw_exit(cli->session);
-		torture_comment(tctx, "testing with timeout > 0 (=1)\n");
-		fname = BASEDIR "\\test1.txt";
 		t = 1;
+		torture_comment(tctx, "testing with timeout > 0 (=%d)\n",
+				t);
+		fname = BASEDIR "\\test1.txt";
 		goto next_run;
 	}
 
+	t = 4000;
+	torture_comment(tctx, "testing special cases with timeout > 0 (=%d)\n",
+			t);
+
 	/*
 	 * the following 3 test sections demonstrate that
 	 * the cache is only set when the error is reported
@@ -1124,7 +1125,7 @@ next_run:
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	start = time(NULL);
-	io.lockx.in.timeout = 1000;
+	io.lockx.in.timeout = t;
 	req = smb_raw_lock_send(cli->tree, &io);
 	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
 		       "Failed to setup timed lock (%s)\n", __location__));
@@ -1138,12 +1139,18 @@ next_run:
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
+	delay = t / 1000;
+	if (TARGET_IS_W2K8(tctx) || TARGET_IS_WIN7(tctx)) {
+		delay /= 2;
+	}
+
+	torture_assert(tctx,!(time(NULL) < start+delay), talloc_asprintf(tctx,
+		       "lock comes back to early timeout[%d] delay[%d]"
+		       "(%s)\n", t, delay, __location__));
+
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_LOCK_NOT_GRANTED);
 
-	torture_assert(tctx,!(time(NULL) < start+1), talloc_asprintf(tctx,
-		       "lock comes back to early (%s)\n", __location__));
-
 	smbcli_close(cli->tree, fnum);
 	fname = BASEDIR "\\test3.txt";
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
@@ -1165,7 +1172,7 @@ next_run:
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	start = time(NULL);
-	io.lockx.in.timeout = 1000;
+	io.lockx.in.timeout = t;
 	req = smb_raw_lock_send(cli->tree, &io);
 	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
 		       "Failed to setup timed lock (%s)\n", __location__));
@@ -1179,14 +1186,20 @@ next_run:
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
+	delay = t / 1000;
+	if (TARGET_IS_W2K8(tctx) || TARGET_IS_WIN7(tctx)) {
+		delay /= 2;
+	}
+
+	torture_assert(tctx,!(time(NULL) < start+delay), talloc_asprintf(tctx,
+		       "lock comes back to early timeout[%d] delay[%d]"
+		       "(%s)\n", t, delay, __location__));
+
 	lock[0].offset = 100;
 	lock[0].count = 10;
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
-	torture_assert(tctx,!(time(NULL) < start+1), talloc_asprintf(tctx,
-		       "lock comes back to early (%s)\n", __location__));
-
 	smbcli_close(cli->tree, fnum);
 	fname = BASEDIR "\\test4.txt";
 	fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
@@ -1208,7 +1221,7 @@ next_run:
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 	start = time(NULL);
-	io.lockx.in.timeout = 1000;
+	io.lockx.in.timeout = t;
 	req = smb_raw_lock_send(cli->tree, &io);
 	torture_assert(tctx,(req != NULL), talloc_asprintf(tctx,
 		       "Failed to setup timed lock (%s)\n", __location__));
@@ -1220,12 +1233,18 @@ next_run:
 	status = smbcli_request_simple_recv(req);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
+	delay = t / 1000;
+	if (TARGET_IS_W2K8(tctx) || TARGET_IS_WIN7(tctx)) {
+		delay /= 2;
+	}
+
+	torture_assert(tctx,!(time(NULL) < start+delay), talloc_asprintf(tctx,
+		       "lock comes back to early timeout[%d] delay[%d]"
+		       "(%s)\n", t, delay, __location__));
+
 	status = smb_raw_lock(cli->tree, &io);
 	CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
 
-	torture_assert(tctx,!(time(NULL) < start+1), talloc_asprintf(tctx,
-		       "lock comes back to early (%s)\n", __location__));
-
 done:
 	smb_raw_exit(cli->session);
 	smbcli_deltree(cli->tree, BASEDIR);
@@ -1307,7 +1326,7 @@ struct double_lock_test {
 /**
  * Tests zero byte locks.
  */
-struct double_lock_test zero_byte_tests[] = {
+static const struct double_lock_test zero_byte_tests[] = {
 	/* {pid, offset, count}, {pid, offset, count}, status */
 
 	/** First, takes a zero byte lock at offset 10. Then:
@@ -1341,7 +1360,6 @@ struct double_lock_test zero_byte_tests[] = {
 static bool test_zerobytelocks(struct torture_context *tctx, struct smbcli_state *cli)
 {
 	union smb_lock io;
-	struct smb_lock_entry zerozero;
 	NTSTATUS status;
 	bool ret = true;
 	int fnum, i;
@@ -1370,7 +1388,7 @@ static bool test_zerobytelocks(struct torture_context *tctx, struct smbcli_state
 	 * assumed to succeed. The second lock may contend, depending on the
 	 * expected status. */
 	for (i = 0;
-	     i < sizeof(zero_byte_tests) / sizeof(struct double_lock_test);
+	     i < ARRAY_SIZE(zero_byte_tests);
 	     i++) {
 		torture_comment(tctx, "  ... {%d, %llu, %llu} + {%d, %llu, %llu} = %s\n",
 		    zero_byte_tests[i].lock1.pid,
@@ -1572,18 +1590,16 @@ static bool test_unlock(struct torture_context *tctx, struct smbcli_state *cli)
 	io.lockx.in.locks = &lock2;
 	status = smb_raw_lock(cli->tree, &io);
 
-	/* XXX Samba will fail this test. This is temporary(because this isn't
+	/* XXX Samba 3 will fail this test. This is temporary(because this isn't
 	 * new to Win7, it succeeds in WinXP too), until I can come to a
 	 * resolution as to whether Samba should support this or not. There is
 	 * code to preference unlocking exclusive locks before shared locks,
 	 * but its wrapped with "#ifdef ZERO_ZERO". -zkirsch */
-	if (TARGET_IS_WIN7(tctx)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else if (TARGET_IS_SAMBA4(tctx)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
+	if (TARGET_IS_SAMBA3(tctx)) {
 		CHECK_STATUS_OR(status, NT_STATUS_LOCK_NOT_GRANTED,
 		    NT_STATUS_FILE_LOCK_CONFLICT);
+	} else {
+		CHECK_STATUS(status, NT_STATUS_OK);
 	}
 
 	/* cleanup */
@@ -1592,12 +1608,10 @@ static bool test_unlock(struct torture_context *tctx, struct smbcli_state *cli)
 	status = smb_raw_lock(cli->tree, &io);
 
 	/* XXX Same as above. */
-	if (TARGET_IS_WIN7(tctx)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else if (TARGET_IS_SAMBA4(tctx)) {
-		CHECK_STATUS(status, NT_STATUS_OK);
-	} else {
+	if (TARGET_IS_SAMBA3(tctx)) {
 		CHECK_STATUS(status, NT_STATUS_RANGE_NOT_LOCKED);
+	} else {
+		CHECK_STATUS(status, NT_STATUS_OK);
 	}
 
 	io.lockx.in.file.fnum = fnum1;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index f559d7d..ce8c704 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -525,6 +525,8 @@ int main(int argc,char *argv[])
 		lp_set_cmdline(cmdline_lp_ctx, "torture:samba3", "true");
 	} else if (strcmp(target, "samba4") == 0) {
 		lp_set_cmdline(cmdline_lp_ctx, "torture:samba4", "true");
+	} else if (strcmp(target, "w2k8") == 0) {
+		lp_set_cmdline(cmdline_lp_ctx, "torture:w2k8", "true");
 	} else if (strcmp(target, "win7") == 0) {
 		lp_set_cmdline(cmdline_lp_ctx, "torture:win7", "true");
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list