Branch: Tag:

2000-03-29

2000-03-29 04:53:01 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

better watchdog (good dog)

Rev: bin/test_pike.pike:1.41
Rev: src/testsuite.in:1.288

1:   #!/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:    return ret;   }    + // 20 minutes should be enough.. + #define WATCHDOG_TIMEOUT 60*20 +    #if constant(thread_create)   #define WATCHDOG   #define WATCHDOG_PIPE
98: Inside #if defined(WATCHDOG)
  #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)   {    int e, verbose, successes, errors, t, check;
196: Inside #if defined(WATCHDOG)
  // 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: Inside #if defined(WATCHDOG)
   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:       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 +  signal_watchdog();    - #ifdef WATCHDOG_SIGNAL -  watchdog->kill(signum("SIGQUIT")); - #endif -  } - #endif -  -  +     int skip=0;    string test,condition;    string|int type;