svn commit: samba r23099 - in branches/SAMBA_4_0/source/torture/basic: .

jra at samba.org jra at samba.org
Wed May 23 21:14:06 GMT 2007


Author: jra
Date: 2007-05-23 21:14:05 +0000 (Wed, 23 May 2007)
New Revision: 23099

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23099

Log:
New interesting delete on close tests :-).
This will break all delete tests on the build farm
until I check in my server patch.
Jeremy.

Modified:
   branches/SAMBA_4_0/source/torture/basic/delete.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/basic/delete.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/delete.c	2007-05-23 20:48:53 UTC (rev 23098)
+++ branches/SAMBA_4_0/source/torture/basic/delete.c	2007-05-23 21:14:05 UTC (rev 23099)
@@ -1197,6 +1197,66 @@
 	return correct;
 }
 
+/* Test 20a ... */
+static bool deltest20a(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2)
+{
+	int fnum1 = -1;
+	int fnum2 = -1;
+	bool correct = True;
+
+	del_clean_area(cli1, cli2);
+
+	/* Test 20a. */
+
+	/* Ensure the file doesn't already exist. */
+	smbcli_close(cli1->tree, fnum1);
+	smbcli_close(cli1->tree, fnum2);
+	smbcli_setatr(cli1->tree, fname, 0, 0);
+	smbcli_unlink(cli1->tree, fname);
+
+	/* Firstly open and create with all access */
+	fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0, 
+				      SEC_RIGHTS_FILE_ALL,
+				      FILE_ATTRIBUTE_NORMAL,
+				      NTCREATEX_SHARE_ACCESS_READ|
+				      NTCREATEX_SHARE_ACCESS_WRITE|
+				      NTCREATEX_SHARE_ACCESS_DELETE,
+				      NTCREATEX_DISP_CREATE, 
+				      0, 0);
+	torture_assert(tctx, fnum1 != -1, talloc_asprintf(tctx, "open - 1 of %s failed (%s)", 
+		       fname, smbcli_errstr(cli1->tree)));
+
+	/* Next open with all access, but add delete on close. */
+	fnum2 = smbcli_nt_create_full(cli2->tree, fname, 0, 
+				      SEC_RIGHTS_FILE_ALL,
+				      FILE_ATTRIBUTE_NORMAL,
+				      NTCREATEX_SHARE_ACCESS_READ|
+				      NTCREATEX_SHARE_ACCESS_WRITE|
+				      NTCREATEX_SHARE_ACCESS_DELETE,
+				      NTCREATEX_DISP_OPEN,
+				      NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
+	
+	torture_assert(tctx, fnum2 != -1, talloc_asprintf(tctx, "open - 2 of %s failed (%s)", 
+		       fname, smbcli_errstr(cli2->tree)));
+
+	/* The delete on close bit is *not* reported as being set. */
+	correct &= check_delete_on_close(tctx, cli1, fnum1, fname, False, __location__);
+	correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__);
+
+	smbcli_close(cli1->tree, fnum1);
+
+	correct &= check_delete_on_close(tctx, cli2, fnum2, fname, False, __location__);
+
+	smbcli_close(cli2->tree, fnum2);
+
+	/* See if the file is deleted - should be.... */
+	fnum1 = smbcli_open(cli1->tree, fname, O_RDWR, DENY_NONE);
+	torture_assert(tctx, fnum1 == -1, talloc_asprintf(tctx, "open of %s succeeded (should fail) - %s", 
+		       fname, smbcli_errstr(cli1->tree)));
+
+	return correct;
+}
+
 /* Test 21 ... */
 static bool deltest21(struct torture_context *tctx)
 {
@@ -1337,7 +1397,7 @@
 
 	return correct;
 }
-	
+
 /*
   Test delete on close semantics.
  */
@@ -1367,6 +1427,7 @@
 	torture_suite_add_2smb_test(suite, "deltest18", deltest18);
 	torture_suite_add_2smb_test(suite, "deltest19", deltest19);
 	torture_suite_add_2smb_test(suite, "deltest20", deltest20);
+	torture_suite_add_2smb_test(suite, "deltest20a", deltest20a);
 	torture_suite_add_simple_test(suite, "deltest21", deltest21);
 	torture_suite_add_simple_test(suite, "deltest22", deltest22);
 



More information about the samba-cvs mailing list