From 3e354912d8f195678b747f6ff56783fac4459589 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Thu, 14 Jun 2018 10:25:17 -0600 Subject: [PATCH] Python returns non-zero code on error If bld_lib.py or bld_exe.py fails, then marbl_testing_class.py returns a status of 1. (Similarly, if one of the stand-alone tests fail, the python returns 1). --- tests/python_for_tests/marbl_testing_class.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/python_for_tests/marbl_testing_class.py b/tests/python_for_tests/marbl_testing_class.py index 71d9e380..33eb9f06 100644 --- a/tests/python_for_tests/marbl_testing_class.py +++ b/tests/python_for_tests/marbl_testing_class.py @@ -142,7 +142,10 @@ def build_lib(self, loc_compiler=None): makecmd = 'make %s' % loc_compiler if self._mpitasks > 0: makecmd += ' USEMPI=TRUE' - sh_command('cd %s; %s' % (src_dir, makecmd)) + status_code = sh_command('cd %s; %s' % (src_dir, makecmd)) + if status_code != 0: + logging.error("ERROR building MARBL library") + sys.exit(1) # ----------------------------------------------- @@ -160,7 +163,10 @@ def build_exe(self, loc_compiler=None): makecmd = 'make %s' % loc_compiler if self._mpitasks > 0: makecmd += ' USEMPI=TRUE' - sh_command('cd %s; %s' % (drv_dir, makecmd)) + status_code = sh_command('cd %s; %s' % (drv_dir, makecmd)) + if status_code != 0: + logging.error("ERROR building MARBL stand-alone driver") + sys.exit(1) # ----------------------------------------------- @@ -205,7 +211,7 @@ def run_exe(self): status_code = sh_command(execmd) if status_code != 0: logging.error("ERROR in executable") - sys.exit(status_code) + sys.exit(1) # ----------------------------------------------- # PRIVATE ROUTINES