pike.git / bin / test_pike.pike

version» Context lines:

pike.git/bin/test_pike.pike:1:   #!/usr/local/bin/pike    - /* $Id: test_pike.pike,v 1.35 2000/02/28 04:20:18 hubbe Exp $ */ + /* $Id: test_pike.pike,v 1.36 2000/03/01 20:30:10 hubbe Exp $ */      import Stdio;      #if !constant(_verify_internals)   #define _verify_internals()   #endif      #if !constant(_dmalloc_set_name)   void _dmalloc_set_name(mixed ... args) {}   #endif
pike.git/bin/test_pike.pike:129:   #endif    )),array opt)    {    switch(opt[0])    {    case "watchdog":   #ifdef WATCHDOG    int cnt=0;    int pid=(int)opt[1];    int last_time=time(); +  int exit_quietly;   #ifdef WATCHDOG_PIPE    thread_create(lambda() {    object o=Stdio.File("stdin");    while(strlen(o->read(1) || ""))    {   // werror("[WATCHDOG] Pong!\n");    last_time=time();    }   // werror("[WATCHDOG] exiting.\n"); -  exit(1); +  exit_quietly=1;    });   #endif      #ifdef WATCHDOG_SIGNAL    werror("Setting signal (1)\n");    if(signum("SIGQUIT")>=0)    {    werror("Setting signal (2)\n");    signal(signum("SIGQUIT"),lambda() {   // werror("[WATCHDOG] Pong!\n");    last_time=time();    });    }else{    exit(1);    }   #endif   // werror("[WATCHDOG] started, watching %d.\n",pid);       while(1)    { -  sleep(30); - #ifdef WATCHDOG_SIGNAL +  sleep(10); +  if(exit_quietly) exit(0); + #ifndef __NT__    if(!kill(pid, 0)) exit(0);   #endif   // werror("[WATCHDOG] t=%d\n",time()-last_time);       /* I hope 30 minutes per test is enough for everybody */    if(time() - last_time > 60 * 30)    {    werror("\n[WATCHDOG] Pike testsuite timeout, sending SIGABRT.\n");    kill(pid, signum("SIGABRT"));    for(int q=0;q<60;q++) if(!kill(pid,0)) exit(0); else sleep(1);