From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Fri, 17 Oct 2008 18:00:58 +0000 (-0700)
Subject: fuse/runtests: made runtests exit code depend on success
X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty?a=commitdiff_plain;h=70222ecf1efc4e5550d7ec9700d59321d31290e6;p=tahoe-lafs%2Ftahoe-lafs.git

fuse/runtests: made runtests exit code depend on success

return an exit code of 0 only if no tests failed, and 1 in the case of
linkage error, test setup failure, or individual test case failure
---

diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py
index 591b9248..d0742477 100644
--- a/contrib/fuse/runtests.py
+++ b/contrib/fuse/runtests.py
@@ -141,7 +141,7 @@ def main(args):
         run_unit_tests([args[0]])
 
     if test_type in ('both', 'system'):
-        run_system_test(config)
+        return run_system_test(config)
 
 
 def run_unit_tests(argv):
@@ -154,7 +154,7 @@ def run_unit_tests(argv):
 
 
 def run_system_test(config):
-    SystemTest(config).run()
+    return SystemTest(config).run()
 
 
 ### System Testing:
@@ -190,12 +190,21 @@ class SystemTest (object):
         try:
             results = self.init_cli_layer()
             print '\n*** System Tests complete:'
+            total_failures = 0
             for result in results:
+                impl_name, failures, total = result
+                total_failures += failures
                 print 'Implementation %s: %d failed out of %d.' % result           
+            if total_failures:
+                print '%s total failures' % total_failures
+                return 1
+            else:
+                return 0
         except SetupFailure, sfail:
             print
             print sfail
             print '\n*** System Tests were not successfully completed.' 
+            return 1
 
     def maybe_wait(self, msg='waiting', or_if_webopen=False):
         if self.config['debug-wait'] or or_if_webopen and self.config['web-open']:
@@ -836,4 +845,4 @@ ExpectedStartOutput = r'STARTING (?P<path>.*?)\n(introducer|client) node probabl
 
 
 if __name__ == '__main__':
-    main(sys.argv)
+    sys.exit(main(sys.argv))