[PATCH] run-tests: resurrect the wifexited polyfill (backout 6ab5a1c9ea3c)

Matt Harbison matt_harbison at yahoo.com
Mon May 18 20:52:43 UTC 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1431977682 14400
#      Mon May 18 15:34:42 2015 -0400
# Node ID 5f3094cb594217c66faa0eff35f5af26f1c035f6
# Parent  153b9c5235c2f3057f0faac1ce94df9ac02cd83f
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

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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)


More information about the Mercurial-devel mailing list