pike.git / bin / test_pike.pike

version» Context lines:

pike.git/bin/test_pike.pike:1:   #! /usr/bin/env pike    - /* $Id: test_pike.pike,v 1.96 2004/04/23 15:20:22 grubba Exp $ */ + /* $Id: test_pike.pike,v 1.97 2004/04/23 15:47:59 grubba Exp $ */      #if !constant(_verify_internals)   #define _verify_internals()   #endif      #if !constant(_dmalloc_set_name)   void _dmalloc_set_name(mixed ... args) {}   #endif      int foo(string opt)
pike.git/bin/test_pike.pike:205:      //   // Main program   //      int main(int argc, array(string) argv)   {    int e, verbose, prompt, successes, errors, t, check, asmdebug;    int skipped;    array(string) tests; +  array(string) forked;    program testprogram;    int start, fail, mem; -  int forked, loop=1; +  int loop=1;    int end=0x7fffffff;    string extra_info="";    int shift;      #if constant(System.getrlimit)    // Attempt to enable coredumps.    // Many Linux distributions default to having coredumps disabled.    catch {    [ int current, int max ] = System.getrlimit("core");    if ((current != -1) && ((current < max) || (max == -1))) {
pike.git/bin/test_pike.pike:298:       case "help":    write(doc);    return 0;       case "verbose": verbose+=foo(opt[1]); break;    case "prompt": prompt+=foo(opt[1]); break;    case "start": start=foo(opt[1]); start--; break;    case "end": end=foo(opt[1]); break;    case "fail": fail=1; break; -  case "forked": forked=1; break; +  case "forked": { +  array(string) orig_argv = backtrace()[0][3]; +  int i = search(orig_argv, argv[0]); +  if (i < 0) { +  werror("Forked operation failed: Failed to find %O in %O\n", +  argv[0], orig_argv); +  break; +  } +  forked = orig_argv[..i]; +  break; +  }    case "loop": loop=foo(opt[1]); break;    case "trace": t+=foo(opt[1]); break;    case "check": check+=foo(opt[1]); break;    case "asm": asmdebug+=foo(opt[1]); break;    case "mem": mem=1; break;       case "auto":    if(stringp(opt[1]))    testsuites=find_testsuites(opt[1]);    else
pike.git/bin/test_pike.pike:341: Inside #if defined(HAVE_DEBUG)
   destruct(o);    Tools.Hilfe.GenericHilfe(q,q);    }    }    },p);    }   #endif    }    }    +  if (forked) { +  if (!use_watchdog) forked += ({ "--no-watchdog" }); +  if (!maybe_tty) forked += ({ "--notty" }); +  if (verbose) forked += ({ "--verbose=" + verbose }); +  if (prompt) forked += ({ "--prompt=" + prompt }); +  if (start) forked += ({ "--start-test=" + (start+1) }); +  // FIXME: end handling is not quite correct. +  if (end != 0x7fffffff) forked += ({ "--end-after=" + end }); +  if (fail) forked += ({ "--fail" }); +  // forked is handled here. +  // loop is handled here. +  if (t) forked += ({ "--trace=" + t }); +  if (check) forked += ({ "--check=" + check }); +  if (asmdebug) forked += ({ "--asm=" + asmdebug }); +  if (mem) forked += ({ "--memory" }); +  // auto already handled. +  if (all_constants()->regression) forked += ({ "--regression" }); +  // debug port not propagated. +  //werror("forked:%O\n", forked); +  } +     add_constant("_verbose", verbose);    if(verbose)    write("Begin tests at "+ctime(time()));      #ifdef WATCHDOG    int watchdog_time=time();       if(use_watchdog && !forked)    {   #ifdef WATCHDOG_PIPE
pike.git/bin/test_pike.pike:391: Inside #if constant(_assembler_debug)
     #if constant(_assembler_debug)    if(asmdebug)    _assembler_debug(asmdebug);   #endif       while(loop--)    {    successes=errors=0;    if (forked) { -  array(string) args = ({ argv[0] }); -  if (!use_watchdog) args += ({ "--no-watchdog" }); -  if (!maybe_tty) args += ({ "--notty" }); -  if (verbose) args += ({ "--verbose=" + verbose }); -  if (prompt) args += ({ "--prompt=" + prompt }); -  if (start) args += ({ "--start-test=" + (start+1) }); -  // FIXME: end handling is not quite correct. -  if (end != 0x7fffffff) args += ({ "--end-after=" + end }); -  if (fail) args += ({ "--fail" }); -  // forked is handled here. -  // loop is handled here. -  if (t) args += ({ "--trace=" + t }); -  if (check) args += ({ "--check=" + check }); -  if (asmdebug) args += ({ "--asm=" + asmdebug }); -  if (mem) args += ({ "--memory" }); -  // auto already handled. -  if (all_constants()->regression) args += ({ "--regression" }); -  // debug port not propagated. -  werror("args:%O\n", args); +     foreach(testsuites, string testsuite) {    Stdio.File p = Stdio.File();    object pid = -  Process.create_process(args + ({ testsuite }), +  Process.create_process(forked + ({ testsuite }),    ([ "stdout":p->pipe(Stdio.PROP_IPC) ]));    string raw_results;    string results = lower_case(raw_results = p->read());    int err = pid->wait();    int total = 0;    int failed = 0;    int skip = 0;    if (((sscanf(results, "%*sfailed tests:%d", failed) != 2) +    (sscanf(results, "%*stotal tests:%d", total) != 2) +    (sscanf(results, "%*s(%d tests skipped)", skip) != 2)) == 3) {