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

vlendec at samba.org vlendec at samba.org
Wed Jul 12 16:36:50 GMT 2006


Author: vlendec
Date: 2006-07-12 16:36:50 +0000 (Wed, 12 Jul 2006)
New Revision: 16988

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

Log:
Extend locktest to enable cluster testing byte range locks. -l <unclist> will
redirect the first server/share via the unclist file.

Volker

Modified:
   branches/SAMBA_4_0/source/torture/locktest.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/locktest.c
===================================================================
--- branches/SAMBA_4_0/source/torture/locktest.c	2006-07-12 16:32:02 UTC (rev 16987)
+++ branches/SAMBA_4_0/source/torture/locktest.c	2006-07-12 16:36:50 UTC (rev 16988)
@@ -104,23 +104,51 @@
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct smbcli_state *connect_one(char *share, int snum)
+static struct smbcli_state *connect_one(char *share, int snum, int conn)
 {
 	struct smbcli_state *c;
 	fstring server, myname;
 	NTSTATUS status;
 	int retries = 10;
 
+	printf("connect_one(%s, %d, %d)\n", share, snum, conn);
+
 	fstrcpy(server,share+2);
 	share = strchr_m(server,'\\');
 	if (!share) return NULL;
 	*share = 0;
 	share++;
 
+	if (snum == 0) {
+		char **unc_list = NULL;
+		int num_unc_names;
+		const char *p;
+		p = lp_parm_string(-1, "torture", "unclist");
+		if (p) {
+			char *h, *s;
+			unc_list = file_lines_load(p, &num_unc_names, NULL);
+			if (!unc_list || num_unc_names <= 0) {
+				printf("Failed to load unc names list from '%s'\n", p);
+				exit(1);
+			}
+
+			if (!smbcli_parse_unc(unc_list[conn % num_unc_names],
+					      NULL, &h, &s)) {
+				printf("Failed to parse UNC name %s\n",
+				       unc_list[conn % num_unc_names]);
+				exit(1);
+			}
+			fstrcpy(server, h);
+			fstrcpy(share, s);
+		}
+	}
+
+
 	slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), snum);
 	cli_credentials_set_workstation(servers[snum], myname, CRED_SPECIFIED);
 
 	do {
+		printf("\\\\%s\\%s\n", server, share);
 		status = smbcli_full_connection(NULL, &c, 
 						server, 
 						share, NULL,
@@ -154,7 +182,7 @@
 			}
 			talloc_free(cli[server][conn]);
 		}
-		cli[server][conn] = connect_one(share[server], server);
+		cli[server][conn] = connect_one(share[server], server, conn);
 		if (!cli[server][conn]) {
 			DEBUG(0,("Failed to connect to %s\n", share[server]));
 			exit(1);
@@ -446,6 +474,7 @@
         -R range    set lock range\n\
         -B base     set lock base\n\
         -M min      set min lock length\n\
+        -l filename unclist file\n\
 ");
 }
 
@@ -487,7 +516,7 @@
 
 	seed = time(NULL);
 
-	while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:")) != EOF) {
+	while ((opt = getopt(argc, argv, "U:s:ho:aAW:OR:B:M:EZW:l:")) != EOF) {
 		switch (opt) {
 		case 'U':
 			if (username_count == 2) {
@@ -531,6 +560,9 @@
 		case 'E':
 			exact_error_codes = True;
 			break;
+		case 'l':
+			lp_set_cmdline("torture:unclist", optarg);
+			break;
 		case 'W':
 			lp_set_cmdline("workgroup", optarg);
 			break;



More information about the samba-cvs mailing list