pike.git / src / testsuite.in

version» Context lines:

pike.git/src/testsuite.in:1:   START_MARKER - test_true([["$Id: testsuite.in,v 1.782 2007/06/09 22:46:09 nilsson Exp $"]]); + test_true([["$Id: testsuite.in,v 1.783 2007/06/17 23:14:08 mast Exp $"]]);      // 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:221:    out = "foo";    else    out = "bar";    return out;    }   ]])      dnl number of variables/scope, number of scopes, expect_compiler_error   define(test_scopes,[[    test_any([[ -  werror("Testing scoped variables $1:$2%s...\n", +  write("Testing scoped variables $1:$2%s...\n",    $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:888:       void destroy()    {    count--;    if (count != c)    error ("Destruct out of sequence, "    "%d destructed when %d should be.\n", c, count);    object x = foo && Foo(0);    x = 0;    // Cause call to destruct_objects_to_destruct. -  for (int j = 0; j < 10; j++) werror (""); +  for (int j = 0; j < 10; j++) write ("");    }    }       mixed eat_stack(int|void probe)    {    // Avoid eating as much C-stack by releasing the    // catch at every level.    if (probe) return 1;    if (catch(eat_stack(1))) return 1;    mixed err = 1;    if ((err = eat_stack()) != 10)    return intp(err) && err > 0 ? err + 1 : err;    if (err = catch {       Foo foo;    for(int i=0; i < 10000; i++)    foo = Foo(foo);    foo = 0;    // Cause call to destruct_objects_to_destruct. -  for (int j = 0; j < 10; j++) werror (""); +  for (int j = 0; j < 10; j++) write ("");       }) return err;    }       static void create()    {    if (mixed err = eat_stack()) {    catch (err[1] = err[1][sizeof (err[1]) - 50..]);    throw (err);    }
pike.git/src/testsuite.in:2089:    es=res;    }   }    ");       // Compilation handler that hides compilation errors.    class handler    {    void compile_error(string file, int line, string err)    { -  // werror("file: %O, line: %O, err: %O\n", file, line, err); +  // write("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:2813:   #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", werror:"efun:werror", `+:"efun:`+" ])[x]; +  return ([ trace:"efun:trace", write:"efun:write", `+:"efun:`+" ])[x];    }       function functionof(string x)    { -  return ([ "efun:trace":trace, "efun:werror":werror, "efun:`+":`+ ])[x] || +  return ([ "efun:trace":trace, "efun:write":write, "efun:`+":`+ ])[x] ||    0;    }       mixed encode_object (object o) {}    void decode_object (object o, mixed d) {}   }      void low_generate(int depth,    array(string) code,    string acc,
pike.git/src/testsuite.in:2842:    mixed tmp;    if(--depth<0)    {    string res="None";    tests++;       if(!(tests & 63))    {    __signal_watchdog();    if(!quiet) -  werror("\r%s" FMT, status_prefix,maxdepth,tests); +  write("\r%s" FMT, status_prefix,maxdepth,tests);    }       string test=code*"\n"+"\n"    "mixed Q() { return "+acc+"();}\n" -  "int main() { trace(9); werror(\"%O\\n\","+acc+"()); }\n" +  "int main() { trace(9); write(\"%O\\n\","+acc+"()); }\n"    ;       mixed tmp, x;    mixed err=catch {    tmp=compile_string(test)();    res=tmp->Q();    if(res != ans)    throw("Test failed");    res = "None";    tmp = decode_value(encode_value(tmp, Codec()), Codec());
pike.git/src/testsuite.in:2877:    "----------------------------------\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]; -  werror("%s\n",s*"\n"); +  write("%s\n",s*"\n");    }    if (res == "None") {    // Probable decode error; try to get some debug.    catch { -  werror("Encoding...\n"); +  write("Encoding...\n");    string encoded = ((function)encode_value)(tmp, Codec(), 6); -  werror("Decoding...\n"); +  write("Decoding...\n");    tmp = ((function)decode_value)(encoded, Codec(), 6); -  werror("Strange... No error thrown...\n"); +  write("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:2923:    code+({sprintf("inherit %s;",classname) }),    rest,    ans,    cnt);    }    }   }      array(int) a()   { -  werror("\nTesting vtables and scope access.\n"); +  write("\nTesting 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) -  werror("%d .. ",maxdepth); +  write("%d .. ",maxdepth);    else -  werror("\r%s",status_prefix); +  write("\r%s",status_prefix);    total_tests+=tests;    tests=0;    }    -  werror("\n"); +  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:4459:   #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; -  werror (msg); +  write (msg);   #endif   }      mixed err;      string fifo = "/tmp/testpipe." + getpid();      int started;   Thread.Mutex start_lock = Thread.Mutex();   Thread.Mutex locker_lock = Thread.Mutex();