Boost logo

Boost-Commit :

From: dave_at_[hidden]
Date: 2007-11-13 13:26:34


Author: dave
Date: 2007-11-13 13:26:33 EST (Tue, 13 Nov 2007)
New Revision: 41065
URL: http://svn.boost.org/trac/boost/changeset/41065

Log:
Handle error return codes from os.system "properly." We still don't
have a policy about dealing with signals, but at least no errors will
be silently ignored.

Text files modified:
   branches/bitten/tools/regression/src/regression.py | 21 ++++++++++++++-------
   branches/bitten/tools/regression/xsl_reports/utils/checked_system.py | 9 +++++++--
   2 files changed, 21 insertions(+), 9 deletions(-)

Modified: branches/bitten/tools/regression/src/regression.py
==============================================================================
--- branches/bitten/tools/regression/src/regression.py (original)
+++ branches/bitten/tools/regression/src/regression.py 2007-11-13 13:26:33 EST (Tue, 13 Nov 2007)
@@ -138,7 +138,7 @@
         self.mail=None
         self.smtp_login=None
         self.skip_tests=False
- self.exit_code=0
+ self.exit_status=0
         self.reflect_test_status=False
         ( _opt_, self.actions ) = opt.parse_args(None,self)
         if not self.actions or self.actions == []:
@@ -320,8 +320,10 @@
         try:
             self.log( '...in (%s).' % os.getcwd() )
         
- exit_code = self._system( [ test_cmd ] )
- self.exit_code = self.exit_code or exit_code
+ exit_status = self._system( [ test_cmd ] )
+ self.exit_status = self.exit_status or exit_status
+ if exit_status:
+ self.log('test run exited with status %s.' % exit_status)
         finally:
             os.chdir( cd )
 
@@ -493,8 +495,13 @@
             if hasattr(self,action_m):
                 getattr(self,action_m)()
                 
- if self.exit_code != 0 and self.reflect_test_status:
- sys.exit(self.exit_code)
+ if self.exit_status != 0:
+ if self.reflect_test_status:
+ self.log('exiting with status: %s' % self.exit_status)
+ sys.exit(self.exit_status)
+ else:
+ self.log(
+ '*** warning: tests failed with exit status: %s, but exiting cleanly' % self.exit_status)
 
     def platform_name(self):
         # See http://article.gmane.org/gmane.comp.lib.boost.testing/933
@@ -623,11 +630,11 @@
 
     def _system( self, cmds ):
         self.log('running system commands in %s: %s' % (os.getcwd(), cmds))
- utils.system( cmds )
+ return utils.system( cmds )
         
     def _checked_system( self, cmds ):
         self.log('running checked system commands in %s: %s' % (os.getcwd(), cmds))
- utils.checked_system( cmds )
+ return utils.checked_system( cmds )
         
     def bjam_build_cmd( self, *rest ):
         if sys.platform == 'win32':

Modified: branches/bitten/tools/regression/xsl_reports/utils/checked_system.py
==============================================================================
--- branches/bitten/tools/regression/xsl_reports/utils/checked_system.py (original)
+++ branches/bitten/tools/regression/xsl_reports/utils/checked_system.py 2007-11-13 13:26:33 EST (Tue, 13 Nov 2007)
@@ -12,8 +12,13 @@
         return rc
     else:
         rc = os.system( '&&'.join( commands ) )
- return rc
-
+ if os.WIFEXITED(rc):
+ return os.WEXITSTATUS(rc)
+ elif os.WIFSIGNALED(rc):
+ return -os.WTERMSIG(rc)
+ elif os.WIFSTOPPED(rc):
+ return -os.WSTOPSIG(rc)
+ return 0
     
 def checked_system( commands, valid_return_codes = [ 0 ] ):
     rc = system( commands )


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