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.101 2004/05/23 01:57:36 nilsson Exp $ */ + /* $Id: test_pike.pike,v 1.102 2004/07/15 09:35:08 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:30:    lambda(string s) {    return sprintf("\\%o", s[0]);    })->feed(test)->drain()/"\n";    foreach(lines; int r; string line) {    werror("%3d: %s\n", r+1, line);    }    werror("\n");    return;   }    + void report_size() + { + #if 0 +  werror("\n"); +  Process.system(sprintf("/usr/proc/bin/pmap %d|tail -1", getpid())); + #endif + } +    array find_testsuites(string dir)   {    array(string) ret=({});    if(array(string) s=get_dir(dir||"."))    {    if(has_value(s,"no_testsuites")) return ret;    foreach(s, string file)    { -  +  string name=combine_path(dir||"",file); +  if(Stdio.is_dir(name)) { +  ret+=find_testsuites(name); +  continue; +  }    switch(file)    {    case "testsuite":    case "module_testsuite":    ret+=({ combine_path(dir||"",file) });    }    } -  -  foreach(s, string file) -  { -  string name=combine_path(dir||"",file); -  if(Stdio.is_dir(name)) -  ret+=find_testsuites(name); +     } -  } +     return ret;   }      array(string) read_tests( string fn ) {    string|array(string) tests = Stdio.read_file( fn );    if(!tests) {    werror("Failed to read test file %O, errno=%d.\n",    fn, errno());    exit(1);    }
pike.git/bin/test_pike.pike:480:    tests = read_tests( testsuite );       werror("Doing tests in %s (%d tests)\n", testsuite, sizeof(tests));    int qmade, qskipped, qmadep, qskipp;       int testno, testline;    for(e=start;e<sizeof(tests);e++)    {    signal_watchdog();    +  if (!((e-start) % 10)) +  report_size(); +     int skip=0, prev_errors = errors;    object o;    mixed a,b;       // Extra consistency checks?    if(check)    {    if(check>0 || (e % -check)==0 )    _verify_internals();    }
pike.git/bin/test_pike.pike:968:    else if(!qskipp) werror("Made all tests\n");    else if(!qmadep) werror("Skipped all tests\n");    else if(qmade) werror(" Made %d test%s.\n", qmade, qmade==1?"":"s");    else if(qskipped) werror(" Skipped %d test%s.\n", qskipped, qskipped==1?"":"s");    }    else {    werror("\n");    }    }    } +  report_size();    if(mem)    {    int total;    tests=0;    gc();    mapping tmp=_memory_usage();    werror(sprintf("%-10s: %6s %10s\n","Category","num","bytes"));    foreach(sort(indices(tmp)),string foo)    {    if(sscanf(foo,"%s_bytes",foo))