2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Fix detection of exit status. We use close on pipe to get return status

and if program does exit(1) we get '1'. The code for checking was
using os.WIFSIGNALLED, and that returns true for '1' -- it seems like
it is expecting result of os.system, which would be 256, or something.


[SVN r62634]
This commit is contained in:
Vladimir Prus
2010-06-09 07:09:29 +00:00
parent 12fa2689f0
commit 9c9c533b93
4 changed files with 31 additions and 6 deletions

View File

@@ -131,8 +131,6 @@ 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):
@@ -458,8 +456,8 @@ class Tester(TestCmd.TestCmd):
annotation("failure", '"%s" returned %d%s'
% (kw['program'], _status(self), expect))
annotation("reason", "error returned by bjam")
annotation("reason", "unexpected status returned by bjam")
self.fail_test(1)
if not (stdout is None) and not match(self.stdout(), stdout):

26
v2/test/exit_status.py Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/python
# Copyright (C) Vladimir Prus 2010.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Test that build failure results in non-zero exit status
import BoostBuild
# Create a temporary working directory.
t = BoostBuild.Tester()
# Create the needed files.
t.write("jamroot.jam", """
exe hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main() {
""")
t.run_build_system(status=1)
t.cleanup()

View File

@@ -23,7 +23,7 @@ t.write("hello.cpp", """
int main() { }
""")
t.run_build_system("runtime-link=static", status=1)
t.run_build_system("runtime-link=static")
t.fail_test(string.find(t.stdout(),
"On gcc, DLL can't be build with '<runtime-link>static'") == -1)

View File

@@ -201,7 +201,8 @@ tests = [ "absolute_sources",
"use_requirements",
"using",
"wrapper",
"wrong_project"
"wrong_project",
"exit_status",
]
if os.name == 'posix':