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

tridge at samba.org tridge at samba.org
Sun Jun 12 01:28:21 GMT 2005


Author: tridge
Date: 2005-06-12 01:28:20 +0000 (Sun, 12 Jun 2005)
New Revision: 7494

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

Log:
added --maximum-runtime to smbtorture as well. I have seen smbtorture
get stuck waiting on no file descriptors, with no timeout, so it sits
forever. I need to fix that bug separately, but to prevent build farm
machines being totally stuck, this timeout will be used.

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


Changeset:
Modified: branches/SAMBA_4_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/torture.c	2005-06-12 00:17:23 UTC (rev 7493)
+++ branches/SAMBA_4_0/source/torture/torture.c	2005-06-12 01:28:20 UTC (rev 7494)
@@ -2515,6 +2515,12 @@
 	return NT_STATUS_IS_OK(status);
 }
 
+static void max_runtime_handler(int sig)
+{
+	DEBUG(0,("maximum runtime exceeded for smbtorture - terminating\n"));
+	exit(1);
+}
+
 /****************************************************************************
   main program
 ****************************************************************************/
@@ -2523,6 +2529,7 @@
 	int opt, i;
 	char *p;
 	BOOL correct = True;
+	int max_runtime=0;
 	int argc_new;
 	char **argv_new;
 	poptContext pc;
@@ -2542,6 +2549,8 @@
 		{"failures",	'f', POPT_ARG_INT,  &torture_failures, 	0,	"failures", 	NULL},
 		{"parse-dns",	'D', POPT_ARG_STRING,	NULL, 	OPT_DNS,	"parse-dns", 	NULL},
 		{"dangerous",	'X', POPT_ARG_NONE,	NULL,   OPT_DANGEROUS,	"dangerous", 	NULL},
+		{"maximum-runtime", 0, POPT_ARG_INT, &max_runtime, 0, 
+		 "set maximum time for smbtorture to live", "seconds"},
 		POPT_COMMON_SAMBA
 		POPT_COMMON_CONNECTION
 		POPT_COMMON_CREDENTIALS
@@ -2585,6 +2594,16 @@
 		}
 	}
 
+	if (max_runtime) {
+		/* this will only work if nobody else uses alarm(),
+		   which means it won't work for some tests, but we
+		   can't use the event context method we use for smbd
+		   as so many tests create their own event
+		   context. This will at least catch most cases. */
+		signal(SIGALRM, max_runtime_handler);
+		alarm(max_runtime);
+	}
+
 	lp_load(dyn_CONFIGFILE,True,False,False);
 	load_interfaces();
 



More information about the samba-cvs mailing list