Propagate return code correctly from tests.

Change-Id: I28c5f3e48646ec24813ef86f4cd16aac120cba5b

BUG=
TEST=Introduced artificial bug and checked return code
from test.

Review URL: http://codereview.chromium.org/3593010
This commit is contained in:
Chris Sosa 2010-10-07 11:24:28 -07:00
parent 224f7548b5
commit d8f50a931f

View File

@ -124,7 +124,7 @@ class RealAUTest(unittest.TestCase, AUTest):
], enter_chroot=False) ], enter_chroot=False)
def NotVerifyImage(self): def VerifyImage(self):
"""Verifies an image using run_remote_tests.sh with verification suite.""" """Verifies an image using run_remote_tests.sh with verification suite."""
RunCommand([ RunCommand([
'%s/run_remote_tests.sh' % self.crosutils, '%s/run_remote_tests.sh' % self.crosutils,
@ -229,10 +229,12 @@ if __name__ == '__main__':
if not board: if not board:
parser.error('Need board to convert base image to vm.') parser.error('Need board to convert base image to vm.')
return_code = 0
# Only run the test harness we care about. # Only run the test harness we care about.
if options.type == 'vm': if options.type == 'vm':
suite = unittest.TestLoader().loadTestsFromTestCase(VirtualAUTest) suite = unittest.TestLoader().loadTestsFromTestCase(VirtualAUTest)
unittest.TextTestRunner(verbosity=2).run(suite) return_code = unittest.TextTestRunner(verbosity=2).run(suite)
elif options.type == 'real': elif options.type == 'real':
if not options.remote: if not options.remote:
parser.error('Real tests require a remote test machine.') parser.error('Real tests require a remote test machine.')
@ -240,6 +242,8 @@ if __name__ == '__main__':
remote = options.remote remote = options.remote
suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest)
unittest.TextTestRunner(verbosity=2).run(suite) return_code = unittest.TextTestRunner(verbosity=2).run(suite)
else: else:
parser.error('Could not parse harness type %s.' % options.type) parser.error('Could not parse harness type %s.' % options.type)
sys.exit(return_code)