run-tests: resurrect the wifexited polyfill (backout 6ab5a1c9ea3c)
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 18 May 2015 15:34:42 -0400
changeset 25177 c3459555318e
parent 25176 665a9deae8dd
child 25178 ebc41dae840a
run-tests: resurrect the wifexited polyfill (backout 6ab5a1c9ea3c) Python 2.7.3 on Windows doesn't have os.WIFEXITED, and the test output looked like this before I interrupted it. $ ./run-tests.py --local -j2 -t700 EEEEEEEEEEEEEEEEEEEEEE
tests/run-tests.py
--- a/tests/run-tests.py	Mon May 18 02:53:08 2015 +0900
+++ b/tests/run-tests.py	Mon May 18 15:34:42 2015 -0400
@@ -103,6 +103,9 @@
 
     _strpath = _bytespath
 
+# For Windows support
+wifexited = getattr(os, "WIFEXITED", lambda x: False)
+
 def checkportisavailable(port):
     """return true if a port seems free to bind on localhost"""
     try:
@@ -804,7 +807,7 @@
             raise
 
         ret = proc.wait()
-        if os.WIFEXITED(ret):
+        if wifexited(ret):
             ret = os.WEXITSTATUS(ret)
 
         if proc.timeout:
@@ -905,7 +908,7 @@
                       self._testtmp, 0, self._getenv())
         stdout, stderr = proc.communicate()
         ret = proc.wait()
-        if os.WIFEXITED(ret):
+        if wifexited(ret):
             ret = os.WEXITSTATUS(ret)
         if ret == 2:
             print(stdout)