From d8f50a931fbae28b2b91a3492b54336a618fbdc0 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Thu, 7 Oct 2010 11:24:28 -0700 Subject: [PATCH] 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 --- bin/cros_au_test_harness.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py index 7646588ccf..a495f06f9b 100755 --- a/bin/cros_au_test_harness.py +++ b/bin/cros_au_test_harness.py @@ -124,7 +124,7 @@ class RealAUTest(unittest.TestCase, AUTest): ], enter_chroot=False) - def NotVerifyImage(self): + def VerifyImage(self): """Verifies an image using run_remote_tests.sh with verification suite.""" RunCommand([ '%s/run_remote_tests.sh' % self.crosutils, @@ -229,10 +229,12 @@ if __name__ == '__main__': if not board: parser.error('Need board to convert base image to vm.') + return_code = 0 + # Only run the test harness we care about. if options.type == 'vm': suite = unittest.TestLoader().loadTestsFromTestCase(VirtualAUTest) - unittest.TextTestRunner(verbosity=2).run(suite) + return_code = unittest.TextTestRunner(verbosity=2).run(suite) elif options.type == 'real': if not options.remote: parser.error('Real tests require a remote test machine.') @@ -240,6 +242,8 @@ if __name__ == '__main__': remote = options.remote suite = unittest.TestLoader().loadTestsFromTestCase(RealAUTest) - unittest.TextTestRunner(verbosity=2).run(suite) + return_code = unittest.TextTestRunner(verbosity=2).run(suite) else: parser.error('Could not parse harness type %s.' % options.type) + + sys.exit(return_code)