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.31 1999/12/10 00:51:43 grubba Exp $ */ + /* $Id: test_pike.pike,v 1.32 2000/01/30 23:44:40 hubbe Exp $ */      import Stdio;      #if !constant(_verify_internals)   #define _verify_internals()   #endif      #if !constant(_dmalloc_set_name)   void _dmalloc_set_name(mixed ... args) {}   #endif      int foo(string opt)   {    if(opt=="" || !opt) return 1;    return (int)opt;   }    -  + int istty_cache; + int istty() + { + #ifdef __NT__ +  return 1; + #else +  if(!istty_cache) +  { +  istty_cache=!!Stdio.stdin->tcgetattr(); +  if(!istty_cache) istty_cache=-1; +  } +  return istty_cache>0; + #endif + } +    mapping(string:int) cond_cache=([]);      #if constant(thread_create)   #define HAVE_DEBUG   #endif      void bzot(string test)   {    int line=1;    int tmp=strlen(test)-1;
pike.git/bin/test_pike.pike:89:    ({"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 "notty": +  istty_cache=-1; +  break; +     case "help":    werror("Usage: "+argv[e]+" [-v | --verbose] [-h | --help] [-t <testno>] <testfile>\n");    return 0;       case "verbose": verbose+=foo(opt[1]); break;    case "start": start=foo(opt[1]); start--; break;    case "end": end=foo(opt[1]); break;    case "fail": fail+=foo(opt[1]); break;    case "loop": loop+=foo(opt[1]); break;    case "trace": t+=foo(opt[1]); break;
pike.git/bin/test_pike.pike:168:    }       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++)    { +  if(istty()) +  {    werror("%6d\r",e+1); -  +  }else{ +  switch( (e-start) % 50) +  { +  case 0: +  werror("%5d: ",e); +  break;    -  +  case 9: +  case 19: +  case 29: +  case 39: +  werror(". "); +  break; +  +  default: +  werror("."); +  break; +  +  case 49: +  werror(".\n"); +  } +  } +     string test,condition;    string|int type;    object o;    mixed a,b;       if(check) _verify_internals();    if(check>3) {    gc();    _verify_internals();    }
pike.git/bin/test_pike.pike:402:       if(check > 2) _verify_internals();       if(fail && errors)    exit(1);       if(!--end) exit(0);       a=b=0;    } +  +  if(istty()) +  {    werror(" \r"); -  +  }else{ +  werror("\n");    } -  +  }    if(mem)    {    int total;    tests=0;    gc();    mapping tmp=_memory_usage();    write(sprintf("%-10s: %6s %10s\n","Category","num","bytes"));    foreach(sort(indices(tmp)),string foo)    {    if(sscanf(foo,"%s_bytes",foo))