Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62634 - trunk/tools/build/v2/test
From: ghost_at_[hidden]
Date: 2010-06-09 03:09:30


Author: vladimir_prus
Date: 2010-06-09 03:09:29 EDT (Wed, 09 Jun 2010)
New Revision: 62634
URL: http://svn.boost.org/trac/boost/changeset/62634

Log:
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.

Added:
   trunk/tools/build/v2/test/exit_status.py (contents, props changed)
Text files modified:
   trunk/tools/build/v2/test/BoostBuild.py | 6 ++----
   trunk/tools/build/v2/test/gcc_runtime.py | 2 +-
   trunk/tools/build/v2/test/test_all.py | 3 ++-
   3 files changed, 5 insertions(+), 6 deletions(-)

Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py (original)
+++ trunk/tools/build/v2/test/BoostBuild.py 2010-06-09 03:09:29 EDT (Wed, 09 Jun 2010)
@@ -131,8 +131,6 @@
     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 @@
 
             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):

Added: trunk/tools/build/v2/test/exit_status.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/exit_status.py 2010-06-09 03:09:29 EDT (Wed, 09 Jun 2010)
@@ -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()

Modified: trunk/tools/build/v2/test/gcc_runtime.py
==============================================================================
--- trunk/tools/build/v2/test/gcc_runtime.py (original)
+++ trunk/tools/build/v2/test/gcc_runtime.py 2010-06-09 03:09:29 EDT (Wed, 09 Jun 2010)
@@ -23,7 +23,7 @@
 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)
 

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2010-06-09 03:09:29 EDT (Wed, 09 Jun 2010)
@@ -201,7 +201,8 @@
           "use_requirements",
           "using",
           "wrapper",
- "wrong_project"
+ "wrong_project",
+ "exit_status",
           ]
 
 if os.name == 'posix':


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk