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.71 2002/08/20 23:07:33 nilsson Exp $ */ + /* $Id: test_pike.pike,v 1.72 2002/10/01 21:28:44 nilsson 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:115:   #else   // ... unless we're running dmalloc   #define WATCHDOG_TIMEOUT 60*80   #endif      #if constant(thread_create)   #define WATCHDOG   #define WATCHDOG_PIPE   object watchdog_pipe;   #else - #if constant(signal) && constant(signum) + #if constant(kill)   #define WATCHDOG   #define WATCHDOG_SIGNAL   #endif   #endif      #ifdef WATCHDOG   object watchdog;   int use_watchdog=1;   int watchdog_time;   
pike.git/bin/test_pike.pike:158: Inside #if defined(WATCHDOG) and #if defined(WATCHDOG_PIPE)
   int exit_quietly;   #ifdef WATCHDOG_PIPE    thread_create(lambda() {    object o=Stdio.File("stdin");    while(strlen(o->read(1) || ""))    {    last_time=time();    }    exit_quietly=1;    }); - #endif + #endif // WATCHDOG_PIPE      #ifdef WATCHDOG_SIGNAL    werror("Setting signal (1)\n");    if(signum("SIGQUIT")>=0)    {    werror("Setting signal (2)\n");    signal( signum("SIGQUIT"),    lambda() {    last_time=time();    });    }    else {    exit(1);    } - #endif + #endif // WATCHDOG_SIGNAL       while(1)    {    sleep(10);    if(exit_quietly) _exit(0);   #ifndef __NT__    if(!kill(pid, 0)) _exit(0);   #endif       /* I hope 30 minutes per test is enough for everybody */
pike.git/bin/test_pike.pike:209: Inside #if defined(WATCHDOG)
   kill(pid, signum("SIGKILL"));    kill(pid, signum("SIGKILL"));    for(int q=0;q<60;q++) if(!kill(pid,0)) _exit(0); else sleep(1);    werror("\n"    "[WATCHDOG] Giving up, must be a device wait.. :(\n");    _exit(0);    }    }   #else    _exit(1); - #endif + #endif // else WATCHDOG   }      //   // Main program   //      int main(int argc, array(string) argv)   {    int e, verbose, prompt, successes, errors, t, check;    int skipped;    array(string) tests;    program testprogram;    int start, fail, mem;    int loop=1;    int end=0x7fffffff;    string extra_info="";    int shift;    - #if constant(signal) && constant(signum) +     if(signum("SIGQUIT")>=0)    {    signal(signum("SIGQUIT"),lambda()    {    master()->handle_error( ({"\nSIGQUIT recived, printing backtrace and continuing.\n",backtrace() }) );       mapping x=_memory_usage();    foreach(sort(indices(x)),string p)    {    if(sscanf(p,"%s_bytes",p))    {    werror("%20ss: %8d %8d Kb\n",p,    x["num_"+p+"s"],    x[p+"_bytes"]/1024);    }    }    });    } - #endif +        array(string) args=backtrace()[0][3];    array(string) testsuites=({});    args=args[..sizeof(args)-1-argc]; -  add_constant("RUNPIKE",Array.map(args,Process.sh_quote)*" "); +  add_constant("RUNPIKE", 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.MAY_HAVE_ARG,({"-v","--verbose"})}),    ({"prompt",Getopt.NO_ARG,({"-p","--prompt"})}),    ({"start",Getopt.HAS_ARG,({"-s","--start-test"})}),    ({"end",Getopt.HAS_ARG,({"-e","--end-after"})}),    ({"fail",Getopt.NO_ARG,({"-f","--fail"})}),
pike.git/bin/test_pike.pike:360: Inside #if defined(WATCHDOG)
  #endif      #ifdef WATCHDOG_SIGNAL    watchdog=Process.create_process(    backtrace()[0][3] + ({ "--watchdog="+getpid() }) );   #endif    }    add_constant("__signal_watchdog",signal_watchdog);   #else    add_constant("__signal_watchdog",lambda(){}); - #endif + #endif // else WATCHDOG_PIPE       testsuites += Getopt.get_args(argv, 1)[1..];    if(!sizeof(testsuites))    {    werror("No tests found. Use --help for more information.\n");    exit(1);    }       while(loop--)    {
pike.git/bin/test_pike.pike:450:       if (testfile) {    array split = testfile / ":";    testline = (int) split[-1];    testfile = split[..sizeof (split) - 2] * ":";    }       string pad_on_error = "\n";    if(istty())    { -  if(!verbose) { +  if(verbose<2) {    werror("test %d, line %d\r", e+1, testline);    pad_on_error = " \r";    }    }    else if(verbose){    if(skip) {    if(qmade) werror(" Made %d test%s.\n", qmade, qmade==1?"":"s");    qmade=0;    qskipp=1;    qskipped++;
pike.git/bin/test_pike.pike:864: Inside #if defined(WATCHDOG_SIGNAL)
   {    watchdog->kill(signum("SIGKILL"));    watchdog->wait();    }   #endif      #ifdef WATCHDOG_PIPE    if(use_watchdog)    {    destruct(watchdog_pipe); - #if constant(signum) +     catch { watchdog->kill(signum("SIGKILL")); }; - #endif +     watchdog->wait();    }   #endif       return errors;   }      constant doc = #"   Usage: test_pike [args] [testfiles]