Changeset: 8919f0a7a873 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8919f0a7a873
Modified Files:
        testing/Mtest.py.in
Branch: Jan2014
Log Message:

Deal better with server crash during startup phase.


diffs (77 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2752,13 +2752,15 @@ def DoIt(env, SERVER, CALL, TST, EXT, PR
                 pSrvr.stdin.close()
                 CollectIt(pSrvr.stdout, SrvrOut)
                 pSrvr.wait()
-                time.sleep(120)
-                pSrvr, pSrvrTimer = LaunchIt(Srvr, 
'\nio.printf("\\nReady.\\n");\n', SrvrOut, SrvrErr, TIMEOUT)
-                ln="dummy"
-                while 0 < len(ln) and ln[:6] != 'Ready.':
-                    ln=pSrvr.stdout.readline()
-                    SrvrOut.write(ln)
-                    SrvrOut.flush()
+                pSrvrTimer.cancel()
+                if returnCode(pSrvr) == 'error':
+                    time.sleep(120)
+                    pSrvr, pSrvrTimer = LaunchIt(Srvr, 
'\nio.printf("\\nReady.\\n");\n', SrvrOut, SrvrErr, TIMEOUT)
+                    ln="dummy"
+                    while 0 < len(ln) and ln[:6] != 'Ready.':
+                        ln=pSrvr.stdout.readline()
+                        SrvrOut.write(ln)
+                        SrvrOut.flush()
                 if ln[:6] != 'Ready.':
                     ServerReady = False
 
@@ -2769,14 +2771,16 @@ def DoIt(env, SERVER, CALL, TST, EXT, PR
                     pSrvr.stdin.close()
                     CollectIt(pSrvr.stdout, SrvrOut)
                     pSrvr.wait()
-                    time.sleep(120)
-                    ServerReady = True
-                    pSrvr, pSrvrTimer = LaunchIt(Srvr, 
'\nio.printf("\\nReady.\\n");\n', SrvrOut, SrvrErr, TIMEOUT)
-                    ln="dummy"
-                    while 0 < len(ln) and ln[:6] != 'Ready.':
-                        ln=pSrvr.stdout.readline()
-                        SrvrOut.write(ln)
-                        SrvrOut.flush()
+                    pSrvrTimer.cancel()
+                    if returnCode(pSrvr) == 'error':
+                        time.sleep(120)
+                        ServerReady = True
+                        pSrvr, pSrvrTimer = LaunchIt(Srvr, 
'\nio.printf("\\nReady.\\n");\n', SrvrOut, SrvrErr, TIMEOUT)
+                        ln="dummy"
+                        while 0 < len(ln) and ln[:6] != 'Ready.':
+                            ln=pSrvr.stdout.readline()
+                            SrvrOut.write(ln)
+                            SrvrOut.flush()
                     if ln[:6] != 'Ready.':
                         ServerReady = False
 
@@ -2882,15 +2886,16 @@ def DoIt(env, SERVER, CALL, TST, EXT, PR
                 SrvrOut.flush()
                 EPILOGUE.close()
 
-            try:
-                pSrvr.stdin.write('clients.quit();\n')
-                pSrvr.stdin.flush()
-            except IOError:
-                pass
-            try:
-                pSrvr.stdin.close()
-            except IOError, (IOerrNo, IOerrStr):
-                Warn("Closing input pipe in DoIt failed with #%d: '%s'." % 
(IOerrNo, IOerrStr))
+            if ServerReady:
+                try:
+                    pSrvr.stdin.write('clients.quit();\n')
+                    pSrvr.stdin.flush()
+                except IOError:
+                    pass
+                try:
+                    pSrvr.stdin.close()
+                except IOError, (IOerrNo, IOerrStr):
+                    Warn("Closing input pipe in DoIt failed with #%d: '%s'." % 
(IOerrNo, IOerrStr))
 
             CollectIt(pSrvr.stdout, SrvrOut)
             pSrvr.wait()
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to