From: stevenknight Date: Fri, 31 Oct 2008 06:08:28 +0000 (+0000) Subject: Move responsibility for extracting the exit status from executed tests X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9abbc95fca2f0d34bd67f98d8fc6853de7dfd0ef;p=scons.git 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. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3751 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 8bf054b3..ce77a02e 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -181,8 +181,8 @@ version. # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. __author__ = "Steven Knight " -__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 ("?", ""): 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 167f84da..263f22a3 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 " -__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 \