Changeset: 2b5846fa4836 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b5846fa4836
Modified Files:
        gdk/gdk_utils.mx
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Aug2011 branch.


diffs (truncated from 564 to 300 lines):

diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -275,7 +275,7 @@ BATSIGignore(int nr)
 static void
 BATSIGabort(int nr)
 {
-       GDKfatal("BATSIGabort: signal %d caught by thread " SZFMT "\n", nr, 
(size_t) MT_getpid());
+       GDKexit(3);             /* emulate Windows exit code without pop-up */
 }
 #endif
 
@@ -1672,6 +1672,7 @@ GDKinit(opt *set, int setlen)
 #ifdef WIN32
        (void) signal(SIGABRT, BATSIGabort);
        _set_abort_behavior(0, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);
+       _set_error_mode(_OUT_TO_STDERR);
 #endif
        GDKlockHome();
 
@@ -2203,8 +2204,8 @@ GDKfatal(const char *format, ...)
                abort();
 #else
                GDKexit(1);
+#endif
        }
-#endif
        return -1;
 }
 
diff --git 
a/sql/test/BugTracker-2011/Tests/div_zero_problem.Bug-2893.stable.out 
b/sql/test/BugTracker-2011/Tests/div_zero_problem.Bug-2893.stable.out
--- a/sql/test/BugTracker-2011/Tests/div_zero_problem.Bug-2893.stable.out
+++ b/sql/test/BugTracker-2011/Tests/div_zero_problem.Bug-2893.stable.out
@@ -19,8 +19,6 @@ stdout of test 'div_zero_problem.Bug-289
 
 Ready.
 
-Over..
-
 # 16:46:27 >  
 # 16:46:27 >  mclient -lsql -ftest -i -e --host=niels --port=33988 
 # 16:46:27 >  
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -207,20 +207,22 @@ F_SKIP = -1
 F_OK = 0
 F_WARN = 1
 F_SOCK = 2
-F_TIME = 3
-F_RECU = 4
-F_SEGV = 5
-F_ERROR = 6
+F_ERROR = 3
+F_TIME = 4
+F_ABRT = 5
+F_RECU = 6
+F_SEGV = 7
 
 FAILURES = {
-    F_SKIP  : "F_SKIP",
-    F_OK    : "F_OK",
-    F_WARN  : "F_WARN",
-    F_SOCK  : "F_SOCK",
-    F_TIME  : "F_TIME",
-    F_RECU  : "F_RECU",
-    F_SEGV  : "F_SEGV",
-    F_ERROR : "F_ERROR"
+    F_SKIP  : ("F_SKIP",  '-'),
+    F_OK    : ("F_OK",    'o'),
+    F_WARN  : ("F_WARN",  'x'),
+    F_SOCK  : ("F_SOCK",  'S'),
+    F_ERROR : ("F_ERROR", 'X'),
+    F_TIME  : ("F_TIME",  'T'),
+    F_ABRT  : ("F_ABRT",  'A'),
+    F_RECU  : ("F_RECU",  'R'),
+    F_SEGV  : ("F_SEGV",  'C'),
 }
 
 CONDITIONALS = {
@@ -447,6 +449,7 @@ purple = '#aa00aa'
 stylesheet = Element('style', None, Text('''
 .error     { font-weight: bold; font-style: italic; color: red; }
 .segfault  { font-weight: bold; font-style: italic; color: purple; }
+.abort     { font-weight: bold; font-style: italic; color: purple; }
 .recursion { font-weight: bold; font-style: italic; color: purple; }
 .timeout   { font-weight: bold; font-style: italic; color: purple; }
 .socket    { font-weight: bold; font-style: italic; color: purple; }
@@ -653,7 +656,7 @@ def CreateTstWhatXhtml (env, TST, stable
         f.close()
         diffclass = 'error'
         difftext = 'Major differences'
-    if diffclass == 'error' and SockTime in (F_SOCK, F_TIME, F_RECU, F_SEGV):
+    if diffclass == 'error' and SockTime in (F_SOCK, F_TIME, F_RECU, F_ABRT, 
F_SEGV):
         if SockTime == F_SOCK:
             diffclass = 'socket'
             difftext = difftext + ' (Socket)'
@@ -663,6 +666,9 @@ def CreateTstWhatXhtml (env, TST, stable
         if SockTime == F_RECU:
             diffclass = 'recursion'
             difftext = difftext + ' (Recursion)'
+        if SockTime == F_ABRT:
+            diffclass = 'abort'
+            difftext = difftext + ' (Aborted)'
         if SockTime == F_SEGV:
             diffclass = 'segfault'
             difftext = difftext + ' (Crash)'
@@ -869,6 +875,8 @@ def AddHref (href, target, linktext, dif
         klass = 'timeout'
     elif diff == F_SOCK:
         klass = 'socket'
+    elif diff == F_ABRT:
+        klass = 'abort'
     elif diff == F_SEGV:
         klass = 'segfault'
     elif diff == F_WARN:
@@ -917,7 +925,7 @@ def AddTstToHtmlIndex (env, TST, STABLEo
         ff.write("\n<!--MajorDiffs-->\n")
         ff.close()
         e = F_ERROR
-    if e == F_ERROR and SockTime in (F_SOCK, F_TIME, F_RECU, F_SEGV):
+    if e == F_ERROR and SockTime in (F_SOCK, F_TIME, F_RECU, F_ABRT, F_SEGV):
         e = SockTime
     if o == F_ERROR or e == F_ERROR:
         tstclass = 'error'
@@ -927,6 +935,8 @@ def AddTstToHtmlIndex (env, TST, STABLEo
         tstclass = 'timeout'
     elif e == F_SOCK:
         tstclass = 'socket'
+    elif e == F_ABRT:
+        tstclass = 'abort'
     elif e == F_SEGV:
         tstclass = 'segfault'
     elif o == F_WARN or e == F_WARN:
@@ -1310,6 +1320,61 @@ def expandvars(path, environ = os.enviro
             i = j
     return path
 
+def returnCode(proc, f = None):
+    '''Interpret the return code of a process.
+    If second arg sepcified, write a message to it.'''
+    if proc.killed:
+        # don't write for timeout, killProc did that already
+        return 'timeout'
+    if os.name == 'nt':
+        if proc.returncode == 3:
+            # heuristic: abort() causes exit code 3
+            if f is not None:
+                f.write('\nAborted\n')
+                f.flush()
+            return 'abort'
+        if proc.returncode == -1073741819: # 0xC0000005
+            if f is not None:
+                f.write('\nSegmentation fault\n')
+                f.flush()
+            return 'segfault'
+        if proc.returncode == -1073741510: # 0xC000013A
+            if f is not None:
+                f.write('\nInterrupt\n')
+                f.flush()
+            return 'interrupt'  # Interrupt
+        if proc.returncode != 0:
+            return 'error'
+    else:
+        if proc.returncode == -signal.SIGSEGV:
+            if f is not None:
+                f.write('\nSegmentation fault\n')
+                f.flush()
+            return 'segfault'   # Segmentation fault
+        if proc.returncode == -signal.SIGBUS:
+            if f is not None:
+                f.write('\nBus error\n')
+                f.flush()
+            return 'segfault'   # Bus error, treat as segfault
+        if proc.returncode == -signal.SIGABRT:
+            if f is not None:
+                f.write('\nAborted\n')
+                f.flush()
+            return 'abort'      # Aborted
+        if proc.returncode == -signal.SIGINT:
+            if f is not None:
+                f.write('\nInterrupt\n')
+                f.flush()
+            return 'interrupt'  # Interrupt
+        if proc.returncode < 0:
+            if f is not None:
+                f.write('\nSignal %d\n' % -proc.returncode)
+                f.flush()
+            return 'signal'     # some other signal
+        if proc.returncode > 0:
+            return 'error'
+    return None                 # no error
+
 def GetBitsAndOIDsAndModsAndStaticAndThreads(env) :
     rtrn = 0
     TSTPREF = env['TSTPREF']
@@ -1318,6 +1383,7 @@ def GetBitsAndOIDsAndModsAndStaticAndThr
     if procdebug:
         print 'GetBitsAndOIDsAndModsAndStaticAndThreads: starting process "%s" 
(inpipe, outpipe, errpipe)\n' % '" "'.join(cmd)
     proc = subprocess.Popen(cmd, stdin = subprocess.PIPE, stdout = 
subprocess.PIPE, stderr = subprocess.PIPE, universal_newlines = True)
+    proc.killed = False
     t = Timer(float(par['TIMEOUT']), killProc, args = [proc, proc.stderr, cmd])
     try:
         t.start()
@@ -1349,10 +1415,9 @@ def GetBitsAndOIDsAndModsAndStaticAndThr
         if procdebug:
             print 'GetBitsAndOIDsAndModsAndStaticAndThreads: process killed 
"%s"\n' % '" "'.join(cmd)
         raise
-    if proc.returncode < 0 or proc.returncode >= 256:
-        ErrExit('GetBitsAndOIDsAndModsAndStaticAndThreads: subcommand crashed')
-    elif proc.returncode != 0:
-        ErrExit('GetBitsAndOIDsAndModsAndStaticAndThreads: subcommand exited 
with error code %d' % proc.returncode)
+    returncode = returnCode(proc)
+    if returncode is not None:
+        ErrExit('GetBitsAndOIDsAndModsAndStaticAndThreads: subcommand failed: 
%s' % returncode)
     env['TST_MODS'] = []
     env['TST_BITS'] = ""
     env['TST_OIDS'] = ""
@@ -1698,19 +1763,21 @@ def RunTest(env, TST, BusyPorts, COND, o
         if not quiet:
             STDOUT.write(" %7.3fs " % TX)
 
-        timeout = F_OK
-        recursion = F_OK
-        segfaulted = F_OK
+        errcode = F_OK
+        if tres == 'timeout':
+            errcode = F_TIME
+        elif tres == 'recursion':
+            errcode = F_RECU
+        elif tres == 'segfault':
+            errcode = F_SEGV
+        elif tres == 'abort':
+            errcode = F_ABRT
+        elif tres == 'error':
+            errcode = F_WARN
+        elif tres is not None:
+            errcode = F_ERROR
 
-        if tres == 'timeout':
-            timeout = F_TIME
-        elif tres == 'recursion':
-            recursion = F_RECU
-        elif tres == 'segfault':
-            segfaulted = F_SEGV
-
-        sockerr = F_OK
-        sockerr = max(sockerr, CheckSocket3(env, "MAPI", TestErrFile))
+        sockerr = CheckSocket3(env, "MAPI", TestErrFile)
 
         #TODO:
         ##if [ ! -f $TSTTRGBASE/Tests/.old.left-over.tmp.bats. ] ; then  touch 
$TSTTRGBASE/Tests/.old.left-over.tmp.bats. ; fi
@@ -1727,24 +1794,30 @@ def RunTest(env, TST, BusyPorts, COND, o
         ##rm -f .new.left-over.tmp.bats. 
$TSTTRGBASE/Tests/.old.left-over.tmp.bats.
         ##if [ -f .all.left-over.tmp.bats. ] ; then  mv -f 
.all.left-over.tmp.bats. $TSTTRGBASE/Tests/.old.left-over.tmp.bats. ; fi
 
-        if timeout == F_TIME:
+        if tres == 'timeout':
             if quiet:
                 STDOUT.write("\n%s : Timeout!\n" % TST)
             elif verbose:
                 STDOUT.write("(Timeout!) ")
 
-        if recursion == F_RECU:
+        if tres == 'recursion':
             if quiet:
                 STDOUT.write("\n%s : Recursion!\n" % TST)
             elif verbose:
                 STDOUT.write("(Recursion!) ")
 
-        if segfaulted == F_SEGV:
+        if tres == 'segfault':
             if quiet:
                 STDOUT.write("\n%s : Crashed!\n" % TST)
             elif verbose:
                 STDOUT.write("(Crashed!) ")
 
+        if tres == 'signal':
+            if quiet:
+                STDOUT.write("\n%s : Signaled!\n" % TST)
+            elif verbose:
+                STDOUT.write("(Signaled!) ")
+
         if verbose:
             STDOUT.write("\n")
 
@@ -1775,8 +1848,8 @@ def RunTest(env, TST, BusyPorts, COND, o
         diff_html.write('<!--MajorDiffs-->\n')
         diff_html.close()
         timedout = True
-        if timeout == F_TIME or recursion == F_RECU or segfaulted == F_SEGV:
-            # test run timed out or crashed => expect major differences!
+        if tres is not None:
+            # test program exited with error => expect major differences!
             ACCURACYout = -1
         else:
             fs = open("%s%s.FILTERED" % (TST, STABLEout))
@@ -1845,8 +1918,8 @@ def RunTest(env, TST, BusyPorts, COND, o
         diff_html.write('<!--MajorDiffs-->\n')
         diff_html.close()
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to