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.102 2004/07/15 09:35:08 grubba Exp $ */ + /* $Id: test_pike.pike,v 1.103 2004/08/31 13:45:48 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:305:       case "watchdog":    run_watchdog( (int)opt[1] );    break;       case "notty":    maybe_tty = 0;    break;       case "help": -  write(doc); +  stdout->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": {    array(string) orig_argv = backtrace()[0][3];    int i = search(orig_argv, argv[0]);
pike.git/bin/test_pike.pike:387:    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);    }    +  // Move stdout to a higher fd, so that close on exec works. +  // This makes sure the original stdout gets closed even if +  // some subprocess hangs. +  Stdio.File stdout = Stdio.stdout->dup(); +  Stdio.stderr->dup2(Stdio.stdout); +  stdout->set_close_on_exec(1); +     add_constant("_verbose", verbose);    if(verbose) -  write("Begin tests at "+ctime(time())); +  stdout->write("Begin tests at "+ctime(time()));      #ifdef WATCHDOG    int watchdog_time=time();       if(use_watchdog && !forked)    {   #ifdef WATCHDOG_PIPE    object watchdog_tmp=Stdio.File();    watchdog_pipe=watchdog_tmp->pipe(Stdio.PROP_IPC);    watchdog=Process.create_process(
pike.git/bin/test_pike.pike:1002:    tmp[foo+"_bytes"]));    total+=tmp[foo+"_bytes"];    }    }    werror( "%-10s: %6s %10d\n",    "Total", "", total );    }    }    if(errors || verbose>1)    { -  write("Failed tests: "+errors+".\n"); +  stdout->write("Failed tests: "+errors+".\n");    }    -  write("Total tests: %d (%d tests skipped)\n",successes+errors,skipped); +  stdout->write(sprintf("Total tests: %d (%d tests skipped)\n", +  successes+errors, skipped));    if(verbose) -  write("Finished tests at "+ctime(time())); +  stdout->write("Finished tests at "+ctime(time()));      #if 1    if(verbose && sizeof(all_constants())!=sizeof(const_names)) {    multiset const_names = (multiset)const_names;    foreach(indices(all_constants()), string const)    if( !const_names[const] )    werror("Leaked constant %O\n", const);    }   #endif