summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-12 01:28:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:00 -0500
commit82da98a1da265438778d38dbafe4aaebbc27dd0d (patch)
tree154a2af9b2d541c2ce637b5202777d2826864a1a
parentea7942d468dc6de98ee20d16acf73c06b5c8b365 (diff)
downloadsamba-82da98a1da265438778d38dbafe4aaebbc27dd0d.tar.gz
samba-82da98a1da265438778d38dbafe4aaebbc27dd0d.tar.bz2
samba-82da98a1da265438778d38dbafe4aaebbc27dd0d.zip
r7494: 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. (This used to be commit 5cccf0a770e0c1069f940fa8f4853f64327dc90c)
-rw-r--r--source4/torture/torture.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 3d1353450d..98519a3797 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -2515,6 +2515,12 @@ static BOOL is_binding_string(const char *binding_string)
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 @@ static BOOL is_binding_string(const char *binding_string)
int opt, i;
char *p;
BOOL correct = True;
+ int max_runtime=0;
int argc_new;
char **argv_new;
poptContext pc;
@@ -2542,6 +2549,8 @@ static BOOL is_binding_string(const char *binding_string)
{"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 @@ static BOOL is_binding_string(const char *binding_string)
}
}
+ 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();