summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-02-17 04:20:54 (GMT)
committerSteven Knight <knight@baldmt.com>2002-02-17 04:20:54 (GMT)
commitfa56e3e7937cacbd9ff8c5f9455c65c935d43e37 (patch)
tree959d68cfec39696e6d46855b7491ffe1e5f406bc
parent1b7469b4c6ac5c93974e8b2b895869b678881af6 (diff)
downloadSCons-fa56e3e7937cacbd9ff8c5f9455c65c935d43e37.zip
SCons-fa56e3e7937cacbd9ff8c5f9455c65c935d43e37.tar.gz
SCons-fa56e3e7937cacbd9ff8c5f9455c65c935d43e37.tar.bz2
Exit status portability on Windows NT.
-rw-r--r--etc/TestSCons.py36
1 files changed, 29 insertions, 7 deletions
diff --git a/etc/TestSCons.py b/etc/TestSCons.py
index 64f9279..d90949e 100644
--- a/etc/TestSCons.py
+++ b/etc/TestSCons.py
@@ -28,6 +28,24 @@ class TestNoResult(Exception):
def __init__(self, args=None):
self.args = args
+if os.name == 'posix':
+ def _failed(self, status = 0):
+ if self.status is None:
+ return None
+ if os.WIFSIGNALED(status):
+ return None
+ return _status(self) != status
+ def _status(self):
+ if os.WIFEXITED(self.status):
+ return os.WEXITSTATUS(self.status)
+ else:
+ return None
+elif os.name == 'nt':
+ def _failed(self, status = 0):
+ return not self.status is None and self.status != status
+ def _status(self):
+ return self.status
+
class TestSCons(TestCmd.TestCmd):
"""Class for testing SCons.
@@ -71,8 +89,8 @@ class TestSCons(TestCmd.TestCmd):
def run(self, stdout = None, stderr = '', status = 0, **kw):
"""Runs SCons.
- This is the same as the base TestCmd.run() method, with
- the addition of
+ This is the same as the base TestCmd.run() method, with
+ the addition of:
stdout The expected standard output from
the command. A value of None means
@@ -84,7 +102,6 @@ class TestSCons(TestCmd.TestCmd):
status The expected exit status from the
command.
-
By default, this does not test standard output (stdout = None),
and expects that error output is empty (stderr = "").
@@ -97,8 +114,13 @@ class TestSCons(TestCmd.TestCmd):
print "STDERR ============"
print self.stderr()
raise
- if not self.status is None and self.status>>8 != status:
- print "%s returned %d" % (self.program, self.status >> 8)
+ if _failed(self, status):
+ expect = ''
+ if status != 0:
+ expect = " (expected %d)" % status
+ print "%s returned %d%s" % (self.program, _status(self), expect)
+ print "STDOUT ============"
+ print self.stdout()
print "STDERR ============"
print self.stderr()
raise TestFailed
@@ -113,12 +135,12 @@ class TestSCons(TestCmd.TestCmd):
print stderr
raise TestFailed
if not stderr is None and not self.match(self.stderr(), stderr):
+ print "STDOUT ==================="
+ print self.stdout()
print "Expected STDERR =========="
print stderr
print "Actual STDERR ============"
print self.stderr()
- print "STDOUT ==================="
- print self.stdout()
raise TestFailed
def up_to_date(self, arguments = None, **kw):