diff options
author | Steven Knight <knight@baldmt.com> | 2008-10-31 06:08:28 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2008-10-31 06:08:28 (GMT) |
commit | 7af32467718be561f1ccfc4ba643625cdf87d54f (patch) | |
tree | 59367af192a53a2627d742d3d9905598152e00ba | |
parent | 826b8777978674a0459ed736d37f8a1b33a1ca0b (diff) | |
download | SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.zip SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.tar.gz SCons-7af32467718be561f1ccfc4ba643625cdf87d54f.tar.bz2 |
Move responsibility for extracting the exit status from executed tests
from the TestCommon.py module to the wrapper classes in TestCmd.py
that we use as fallbacks if the subprocess module doesn't exist.
-rw-r--r-- | QMTest/TestCmd.py | 22 | ||||
-rw-r--r-- | QMTest/TestCommon.py | 12 |
2 files changed, 21 insertions, 13 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 8bf054b..ce77a02 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -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 diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py index 167f84d..263f22a 100644 --- a/QMTest/TestCommon.py +++ b/QMTest/TestCommon.py @@ -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 \ |