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.24 1999/05/12 04:38:05 hubbe Exp $ */ + /* $Id: test_pike.pike,v 1.25 1999/06/19 19:49:46 hubbe Exp $ */      import Stdio;      #if !efun(_verify_internals)   #define _verify_internals()   #endif      int foo(string opt)   {    if(opt=="" || !opt) return 1;
pike.git/bin/test_pike.pike:22:      void bzot(string test)   {    int line=1;    int tmp=strlen(test)-1;    while(test[tmp]=='\n') tmp--;    foreach(test[..tmp]/"\n",string s)    werror("%3d: %s\n",line++,s);   }    + array find_testsuites(string dir) + { +  array(string) ret=({}); +  if(array(string) s=get_dir(dir||".")) +  { +  foreach(s, string file) +  { +  string name=combine_path(dir||"",file); +  if(file_size(name)==-2) +  ret+=find_testsuites(name); +  } +  +  foreach(s, string file) +  { +  switch(file) +  { +  case "testsuite": +  case "module_testsuite": +  ret+=({ combine_path(dir||"",file) }); +  } +  } +  } +  return ret; + } +    int main(int argc, string *argv)   {    int e, verbose, successes, errors, t, check;    string *tests,tmp;    program testprogram;    int start, fail, mem;    int loop=1;    int end=0x7fffffff;    string extra_info="";    int shift;
pike.git/bin/test_pike.pike:44: Inside #if constant(signal) && constant(signum)
   if(signum("SIGQUIT")>=0)    {    signal(signum("SIGQUIT"),lambda()    {    master()->handle_error( ({"\nSIGQUIT recived, printing backtrace and continuing.\n",backtrace() }) );    });    }   #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(    ({"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"})}),   #ifdef HAVE_DEBUG    ({"debug",Getopt.MAY_HAVE_ARG,({"-d","--debug"})}),   #endif    )),array opt)    {    switch(opt[0])    {    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;    case "check": check+=foo(opt[1]); break;    case "mem": mem+=foo(opt[1]); break;    -  +  case "auto": +  testsuites=find_testsuites("."); +  break; +    #ifdef HAVE_DEBUG    case "debug":    {    object p=Stdio.Port();    p->bind(0);    werror("Debug port is: %s\n",p->query_address());    sscanf(p->query_address(),"%*s %d",int portno);    extra_info+=sprintf(" dport:%d",portno);    thread_create(lambda(object p){    while(p)
pike.git/bin/test_pike.pike:102: Inside #if defined(HAVE_DEBUG)
   destruct(o);    Tools.Hilfe.GenericHilfe(q,q);    }    }    },p);    }   #endif    }    }    -  argv=Getopt.get_args(argv,1); +  argv=Getopt.get_args(argv,1)+testsuites;    if(sizeof(argv)<1)    {    if(!tmp)    {    werror("No tests?\n");    exit(1);    }    }       while(loop--)