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.36 2000/03/01 20:30:10 hubbe Exp $ */ + /* $Id: test_pike.pike,v 1.37 2000/03/07 08:14:57 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:66:    {    case "testsuite":    case "module_testsuite":    ret+=({ combine_path(dir||"",file) });    }    }    }    return ret;   }    -  +    #if constant(thread_create)   #define WATCHDOG -  +  + object watchdog; +    #define WATCHDOG_PIPE -  + object watchdog_pipe;   #else   #if constant(signal) && constant(signum)   #define WATCHDOG   #define WATCHDOG_SIGNAL   #endif   #endif    -  +  + #ifdef WATCHDOG + int use_watchdog=1; + #endif +    int main(int argc, string *argv)   {    int e, verbose, successes, errors, t, check;    int skipped;    string *tests,tmp;    program testprogram;    int start, fail, mem;    int loop=1;    int end=0x7fffffff;    string extra_info="";
pike.git/bin/test_pike.pike:105: Inside #if constant(signal) && constant(signum)
   });    }   #endif       string *args=backtrace()[0][3];    array(string) testsuites=({});    args=args[..sizeof(args)-1-argc];    add_constant("RUNPIKE",Array.map(args,Process.sh_quote)*" ");       foreach(Getopt.find_all_options(argv,aggregate( +  ({"no-watchdog",Getopt.NO_ARG,({"--no-watchdog"})}),    ({"watchdog",Getopt.HAS_ARG,({"--watchdog"})}),    ({"help",Getopt.NO_ARG,({"-h","--help"})}),    ({"verbose",Getopt.NO_ARG,({"-v","--verbose"})}),    ({"start",Getopt.HAS_ARG,({"-s","--start-test"})}),    ({"end",Getopt.HAS_ARG,({"--end-after"})}),    ({"fail",Getopt.MAY_HAVE_ARG,({"-f","--fail"})}),    ({"loop",Getopt.MAY_HAVE_ARG,({"-l","--loop"})}),    ({"trace",Getopt.MAY_HAVE_ARG,({"-t","--trace"})}),    ({"check",Getopt.MAY_HAVE_ARG,({"-c","--check"})}),    ({"mem",Getopt.MAY_HAVE_ARG,({"-m","--mem","--memory"})}),    ({"auto",Getopt.MAY_HAVE_ARG,({"-a","--auto"})}),    ({"notty",Getopt.NO_ARG,({"-t","--notty"})}),   #ifdef HAVE_DEBUG    ({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}),   #endif    )),array opt)    {    switch(opt[0])    { -  +  case "no-watchdog": +  use_watchdog=0; +  break; +     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) || ""))
pike.git/bin/test_pike.pike:245: Inside #if defined(HAVE_DEBUG)
   }    },p);    }   #endif    }    }      #ifdef WATCHDOG    int watchdog_time=time();    +  if(use_watchdog) +  {   #ifdef WATCHDOG_PIPE    object watchdog_tmp=Stdio.File(); -  object watchdog_pipe=watchdog_tmp->pipe(Stdio.PROP_IPC); -  object watchdog=Process.create_process( +  watchdog_pipe=watchdog_tmp->pipe(Stdio.PROP_IPC); +  watchdog=Process.create_process(    backtrace()[0][3] + ({ "--watchdog="+getpid() }),    (["stdin":watchdog_tmp ]));    destruct(watchdog_tmp);   #endif      #ifdef WATCHDOG_SIGNAL -  object watchdog=Process.create_process( +  watchdog=Process.create_process(    backtrace()[0][3] + ({ "--watchdog="+getpid() }) );   #endif -  +  }   #endif       argv=Getopt.get_args(argv,1)+testsuites;    if(sizeof(argv)<1)    {    if(!tmp)    {    werror("No tests?\n");    exit(1);    }
pike.git/bin/test_pike.pike:292:       tests=tmp/"\n....\n";    tmp=0;    tests=tests[0..sizeof(tests)-2];       werror("Doing tests in %s (%d tests)\n",argv[f],sizeof(tests));       for(e=start;e<sizeof(tests);e++)    {   #ifdef WATCHDOG -  if(time() - watchdog_time > 30) +  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
pike.git/bin/test_pike.pike:618:    }    }    if(errors || verbose)    {    werror("Failed tests: "+errors+".\n");    }       werror("Total tests: %d (%d tests skipped)\n",successes+errors,skipped);      #ifdef WATCHDOG_SIGNAL +  if(use_watchdog)    watchdog->kill(signum("SIGKILL"));   #endif       return errors;   }