pike.git / src / testsuite.in

version» Context lines:

pike.git/src/testsuite.in:1:   START_MARKER - test_true([["$Id: testsuite.in,v 1.899 2010/09/27 17:06:30 grubba Exp $"]]); + test_true([["$Id$"]]);      // This triggered a bug only if run sufficiently early.   test_compile_any([[#pike 7.2]])   test_compile_any([[#pike 7.4]])   test_compile_any([[#pike 7.0]])   test_compile_any([[#pike 0.6]])      cond([[all_constants()->_verify_internals]],   [[    test_do(_verify_internals())
pike.git/src/testsuite.in:279:    out = "foo";    else    out = "bar";    return out;    }   ]])      dnl number of variables/scope, number of scopes, expect_compiler_error   define(test_scopes,[[    test_any([[ -  write("Testing scoped variables $1:$2%s...\n", +  log_status("Testing scoped variables $1:$2%s...",    $3?" expecting a compilation error":"");    string line = sprintf("#line %d %O\n", __LINE__, __FILE__);    string s = "{\n" +    (map(indices(allocate($1)), lambda(int no) {    no++;    return sprintf(" int var_%d;\n"    " if (var_%d)\n"    " error(\"Variable var_%d not \"\n"    " \"initialized to zero: \"\n"    " \"%%O\\n\",\n"
pike.git/src/testsuite.in:2428:    es=res;    }   }    ");       // Compilation handler that hides compilation errors.    class handler    {    void compile_error(string file, int line, string err)    { -  // write("file: %O, line: %O, err: %O\n", file, line, err); +  // log_msg("file: %O, line: %O, err: %O\n", file, line, err);    }    };       // turn this on when the bug is found    // master()->set_inhibit_compile_errors(lambda(){});       //_optimizer_debug(2);    //_assembler_debug(20);       object orig_master = master();
pike.git/src/testsuite.in:3249:      test_tests([[      int errors;   int tests;      #define indent(X) (X)   #define FMT "%d:%d "      int maxdepth; - int quiet; +    string status_prefix="";      class Codec {    string nameof(mixed x)    {    return ([ trace:"efun:trace", write:"efun:write", `+:"efun:`+" ])[x];    }       function functionof(string x)    {
pike.git/src/testsuite.in:3283:   {    mixed tmp;    if(--depth<0)    {    string res="None";    tests++;       if(!(tests & 63))    {    __signal_watchdog(); -  if(!quiet) -  write("\r%s" FMT, status_prefix,maxdepth,tests); +  if (_verbose == 1) +  log_status("%s" FMT, status_prefix,maxdepth,tests);    }       string test=code*"\n"+"\n"    "mixed Q() { return "+acc+"();}\n"    "int main() { trace(9); write(\"%O\\n\","+acc+"()); }\n"    ;       mixed tmp, x;    mixed err=catch {    tmp=compile_string(test)();
pike.git/src/testsuite.in:3308:    res = "None";    tmp = decode_value(encode_value(tmp, Codec()), Codec());    res=tmp->Q();    if(res != ans)    throw("Test failed for encode/decode.");    x=Program.inherit_list(object_program(tmp));    };    if(err)    {    errors++; -  werror("\nTest failed:\n" +  log_msg("Test failed:\n"    "----------------------------------\n"    "%s\n"    "---------------------------------\n"    "expected answer: %O\n"    "Answer received: %O\n",test,ans,res);    if(!stringp(err) || !has_prefix(err, "Test failed"))    {    string tmp=master()->describe_backtrace(err);    array s=tmp/"\n";    s=s[..20]; -  write("%s\n",s*"\n"); +  log_msg("%s\n",s*"\n");    }    if (res == "None") {    // Probable decode error; try to get some debug.    catch { -  write("Encoding...\n"); +  log_msg("Encoding...\n");    string encoded = ((function)encode_value)(tmp, Codec(), 6); -  write("Decoding...\n"); +  log_msg("Decoding...\n");    tmp = ((function)decode_value)(encoded, Codec(), 6); -  write("Strange... No error thrown...\n"); +  log_msg("Strange... No error thrown...\n");    };    }    return;    }    }else{    low_generate(depth,    code+    ({sprintf("string F%d(){ return %s()+\"F%d\"; }",cnt,acc,cnt)}),    sprintf("F%d",cnt),    sprintf("%sF%d",ans,cnt),
pike.git/src/testsuite.in:3365:    code+({sprintf("inherit %s;",classname) }),    rest,    ans,    cnt);    }    }   }      array(int) a()   { -  write("\nTesting vtables and scope access.\n"); +  log_status("Testing vtables and scope access.\n");    -  quiet = !_verbose; -  +     int total_tests;    for(maxdepth=1;maxdepth<9 && !errors;maxdepth++)    {    low_generate(maxdepth,    ({ "string X(){return \"X\";}" }),    "X",    "X",0);       status_prefix+=sprintf(FMT,maxdepth,tests); -  if(quiet) -  write("%d .. ",maxdepth); -  else -  write("\r%s",status_prefix); +  if (_verbose == 1) +  log_status(status_prefix);    total_tests+=tests;    tests=0;    }    -  write("\n"); +     return ({ total_tests-errors, errors });   }      ]])               test_true([[Program.implements( class { int x; string y; void foo(int x) {} },    class { void foo(mixed z) {} int x; })]])
pike.git/src/testsuite.in:5030:   #ifndef __NT__   // Using a named pipe here to make open() block. That doesn't exist on NT.      object t = class {   void log (function f, string msg)   {   #if 0    if (f == test) msg = "[T] " + msg;    else if (f == thread_disabler) msg = " " * 20 + "[D] " + msg;    else if (f == mutex_locker) msg = " " * 40 + "[L] " + msg; -  write (msg); +  log_msg (msg);   #endif   }      mixed err;      string fifo = "/tmp/testpipe." + getpid();      int started;   Thread.Mutex start_lock = Thread.Mutex();   Thread.Mutex locker_lock = Thread.Mutex();
pike.git/src/testsuite.in:10365:    allocate(10, thread_create)(lambda() {    int i;    for(i = 0; i < 1000; i++) {    compile_string(file);    // These watchdog calls shouldn't be necessary - the timeframe    // is at least 20 minutes between two calls, so doing these can    // extend the test time to up to 20000 minutes before the    // watchdog kicks in.. /mast    //if (!(i%10))    // __signal_watchdog(); -  //if (!(i % 100)) -  // write ("%s: %O at %d\n", ctime (time())[..<1], this_thread(), i); +  if (!(i % 100)) +  log_status ("%s: %O at %d", ctime (time())[..<1], this_thread(), i);    }    } )->wait();       return 0;    ]], 0)      cond_end // thread_create      // - copy_value   test_eq(copy_value(1),1)