svn commit: samba r3085 - in branches/SAMBA_4_0/source/torture/raw: .

tridge at samba.org tridge at samba.org
Wed Oct 20 11:14:04 GMT 2004


Author: tridge
Date: 2004-10-20 11:13:54 +0000 (Wed, 20 Oct 2004)
New Revision: 3085

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/torture/raw&rev=3085&nolog=1

Log:
make the RAW-WRITE tests more robust to errors in previous parts of the test

Modified:
   branches/SAMBA_4_0/source/torture/raw/write.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/write.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/write.c	2004-10-20 11:11:55 UTC (rev 3084)
+++ branches/SAMBA_4_0/source/torture/raw/write.c	2004-10-20 11:13:54 UTC (rev 3085)
@@ -58,6 +58,18 @@
 #define BASEDIR "\\testwrite"
 
 
+static BOOL setup_dir(struct smbcli_state *cli, const char *dname)
+{
+	smb_raw_exit(cli->session);
+	if (smbcli_deltree(cli->tree, dname) == -1 ||
+	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, dname))) {
+		printf("Unable to setup %s - %s\n", dname, smbcli_errstr(cli->tree));
+		return False;
+	}
+	return True;
+}
+
+
 /*
   setup a random buffer based on a seed
 */
@@ -103,9 +115,7 @@
 
 	buf = talloc_zero(mem_ctx, maxsize);
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 
@@ -222,9 +232,7 @@
 
 	buf = talloc_zero(mem_ctx, maxsize);
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 
@@ -396,9 +404,7 @@
 
 	buf = talloc_zero(mem_ctx, maxsize);
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 
@@ -535,9 +541,7 @@
 
 	buf = talloc_zero(mem_ctx, maxsize);
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 
@@ -682,9 +686,7 @@
 
 	printf("Testing delayed update of write time\n");
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 
@@ -715,7 +717,7 @@
 	written =  smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
 
 	if (written != 1) {
-		printf("write failed - wrote %d bytes\n", written);
+		printf("write failed - wrote %d bytes (%s)\n", written, __location__);
 		return False;
 	}
 
@@ -776,9 +778,7 @@
 
 	printf("Testing finfo update on close\n");
 
-	if (smbcli_deltree(cli->tree, BASEDIR) == -1 ||
-	    NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) {
-		printf("Unable to setup %s - %s\n", BASEDIR, smbcli_errstr(cli->tree));
+	if (!setup_dir(cli, BASEDIR)) {
 		return False;
 	}
 



More information about the samba-cvs mailing list