diff --git a/bin/test_pike.pike b/bin/test_pike.pike index 1156ad05baaf2af8566008897186b1d3673ce44e..e19d1aeef1c140d70f18124d91b0db865dc6775f 100755 --- a/bin/test_pike.pike +++ b/bin/test_pike.pike @@ -1,6 +1,6 @@ #!/usr/local/bin/pike -/* $Id: test_pike.pike,v 1.40 2000/03/27 20:29:45 hubbe Exp $ */ +/* $Id: test_pike.pike,v 1.41 2000/03/29 04:52:50 hubbe Exp $ */ import Stdio; @@ -83,6 +83,9 @@ array find_testsuites(string dir) return ret; } +// 20 minutes should be enough.. +#define WATCHDOG_TIMEOUT 60*20 + #if constant(thread_create) #define WATCHDOG #define WATCHDOG_PIPE @@ -98,6 +101,25 @@ object watchdog_pipe; #ifdef WATCHDOG object watchdog; int use_watchdog=1; +int watchdog_time; + +void signal_watchdog() +{ +#ifdef WATCHDOG + if(use_watchdog && time() - watchdog_time > 30) + { + watchdog_time=time(); +// werror("{WATCHDOG} Ping!\n"); +#ifdef WATCHDOG_PIPE + watchdog_pipe->write("x",1); +#endif + +#ifdef WATCHDOG_SIGNAL + watchdog->kill(signum("SIGQUIT")); +#endif + } +#endif +} #endif int main(int argc, string *argv) @@ -196,7 +218,7 @@ int main(int argc, string *argv) // werror("[WATCHDOG] t=%d\n",time()-last_time); /* I hope 30 minutes per test is enough for everybody */ - if(time() - last_time > 60 * 30) + if(time() - last_time > WATCHDOG_TIMEOUT) { werror("\n[WATCHDOG] Pike testsuite timeout, sending SIGABRT.\n"); kill(pid, signum("SIGABRT")); @@ -289,6 +311,9 @@ int main(int argc, string *argv) backtrace()[0][3] + ({ "--watchdog="+getpid() }) ); #endif } + add_constant("__signal_watchdog",signal_watchdog); +#else + add_constant("__signal_watchdog",lambda(){}); #endif argv=Getopt.get_args(argv,1)+testsuites; @@ -321,21 +346,7 @@ int main(int argc, string *argv) for(e=start;e<sizeof(tests);e++) { -#ifdef WATCHDOG - if(use_watchdog && time() - watchdog_time > 30) - { - watchdog_time=time(); -// werror("{WATCHDOG} Ping!\n"); -#ifdef WATCHDOG_PIPE - watchdog_pipe->write("x",1); -#endif - -#ifdef WATCHDOG_SIGNAL - watchdog->kill(signum("SIGQUIT")); -#endif - } -#endif - + signal_watchdog(); int skip=0; string test,condition; diff --git a/src/testsuite.in b/src/testsuite.in index 340ea2d7e84c62c8496e4dbbfa41d0ab33989bf9..433d2c0f9df39ef63bf667d1e73c22a2cc492a43 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.287 2000/03/26 01:56:54 mast Exp $"]]); +test_true([["$Id: testsuite.in,v 1.288 2000/03/29 04:53:01 hubbe Exp $"]]); cond([[all_constants()->_verify_internals]], [[ @@ -4346,12 +4346,12 @@ cond([[ file_stat("/bin/cat") && file_stat("/dev/null") && (cpp("__NT__")/"\n")[ return kill(o->pid(), 9); ]],0); - test_any([[ int e; for(e=0;e<1000;e++) if(Process.create_process(({"/bin/cat","/dev/null"}))->wait()) return e; return -1;]],-1) + test_any([[ for(int x=0;x<10;x++) { for(int e=0;e<100;e++) if(Process.create_process(({"/bin/cat","/dev/null"}))->wait()) return e; __signal_watchdog(); } return -1;]],-1) ]]) cond([[ file_stat("/bin/cat") && file_stat("/dev/null") && all_constants()->thread_create && (cpp("__NT__")/"\n")[1]=="__NT__" ]], [[ - test_any([[return allocate(10,thread_create)(lambda() { int e; for(e=0;e<500;e++) if(Process.create_process(({"/bin/cat","/dev/null"}))->wait()) return e; return -1;})->wait() - ({-1})]],({})) + test_any([[return allocate(10,thread_create)(lambda() { for(int x=0;x<10;x++) { for(int e=0;e<50;e++) if(Process.create_process(({"/bin/cat","/dev/null"}))->wait()) return e; __signal_watchdog(); } return -1;})->wait() - ({-1})]],({})) ]]) cond([[ file_stat("/bin/cat") && file_stat("/dev/null") && all_constants()->thread_create && (cpp("__NT__")/"\n")[1]=="__NT__" ]], @@ -4372,6 +4372,7 @@ cond([[ file_stat("/bin/cat") && file_stat("/dev/null") && all_constants()->thre for(int e=0;e<50;e++) Stdio.Port()->bind(0); for(int e=0;e<10;e++) fifo->write(1); fnord->wait(); + __signal_watchdog(); } ]]) ]]) @@ -4392,6 +4393,7 @@ int gnapp(int t) kill( o->pid(), 9 ); o->wait(); } + __signal_watchdog(); // werror("%d",t); } return -1;