Move responsibility for extracting the exit status from executed tests
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 31 Oct 2008 06:08:28 +0000 (06:08 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 31 Oct 2008 06:08:28 +0000 (06:08 +0000)
from the TestCommon.py module to the wrapper classes in TestCmd.py
that we use as fallbacks if the subprocess module doesn't exist.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@3751 fdb21ef1-2011-0410-befe-b5e4ea1792b1

QMTest/TestCmd.py
QMTest/TestCommon.py

index 8bf054b37d15e166c231b8b1e0f8ec4567e4efdc..ce77a02e7eac0677bb8e15fe1d204f08b3af8e21 100644 (file)
@@ -181,8 +181,8 @@ version.
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 __author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.31.D001 2008/01/01 09:05:59 knight"
-__version__ = "0.31"
+__revision__ = "TestCmd.py 0.32.D001 2008/10/30 23:00:04 knight"
+__version__ = "0.32"
 
 import errno
 import os
@@ -265,7 +265,7 @@ def _caller(tblist, skip):
         arr = [(file, line, name, text)] + arr
     atfrom = "at"
     for file, line, name, text in arr[skip:]:
-        if name == "?":
+        if name in ("?", "<module>"):
             name = ""
         else:
             name = " (" + name + ")"
@@ -490,7 +490,13 @@ except ImportError:
                 self.stdout.close()
                 self.resultcode = self.stderr.close()
             def wait(self):
-                return self.resultcode
+                resultcode = self.resultcode
+                if os.WIFEXITED(resultcode):
+                    return os.WEXITSTATUS(resultcode)
+                elif os.WIFSIGNALED(resultcode):
+                    return os.WTERMSIG(resultcode)
+                else:
+                    return None
 
     else:
         try:
@@ -539,6 +545,14 @@ except ImportError:
                 self.stdin = self.tochild
                 self.stdout = self.fromchild
                 self.stderr = self.childerr
+            def wait(self, *args, **kw):
+                resultcode = apply(popen2.Popen3.wait, (self,)+args, kw)
+                if os.WIFEXITED(resultcode):
+                    return os.WEXITSTATUS(resultcode)
+                elif os.WIFSIGNALED(resultcode):
+                    return os.WTERMSIG(resultcode)
+                else:
+                    return None
 
     subprocess.Popen = Popen3
 
index 167f84da31c6bd121e555f63c66477ffb44723cc..263f22a3afbbefcc993f7d4c669c4623a3b1d2fc 100644 (file)
@@ -84,8 +84,8 @@ The TestCommon module also provides the following variables
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 __author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCommon.py 0.31.D001 2008/01/01 09:05:59 knight"
-__version__ = "0.31"
+__revision__ = "TestCommon.py 0.32.D001 2008/10/30 23:00:04 knight"
+__version__ = "0.32"
 
 import copy
 import os
@@ -220,13 +220,7 @@ if os.name == 'posix':
             return None
         return _status(self) != status
     def _status(self):
-        return self.status      # p.wait() has already retrieved the OS status from the status val; don't do it again here!
-#         if os.WIFEXITED(self.status):
-#             return os.WEXITSTATUS(self.status)
-#         elif os.WIFSIGNALED(self.status):
-#             return os.WTERMSIG(self.status)
-#         else:
-#             return None
+        return self.status
 elif os.name == 'nt':
     def _failed(self, status = 0):
         return not (self.status is None or status is None) and \