]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph_objectstore_tool.py main returns
authorLoic Dachary <ldachary@redhat.com>
Thu, 13 Nov 2014 18:14:49 +0000 (19:14 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sat, 15 Nov 2014 22:27:15 +0000 (23:27 +0100)
Instead of calling sys.exit() the main function returns the desired exit
code.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/ceph_objectstore_tool.py

index 95375143cd54f18a8a24d8964c89a986f8cb2de8..8ce2ac8d9e1672bf014c2bccb44da070fda31fc2 100755 (executable)
@@ -268,7 +268,7 @@ def main(argv):
             ret = call(cmd, shell=True, stderr=nullfd)
             if ret != 0:
                 logging.critical("Replicated pool object creation failed with {ret}".format(ret=ret))
-                sys.exit(1)
+                return 1
 
             db[nspace][NAME] = {}
 
@@ -345,7 +345,7 @@ def main(argv):
             ret = call(cmd, shell=True, stderr=nullfd)
             if ret != 0:
                 logging.critical("Erasure coded pool creation failed with {ret}".format(ret=ret))
-                sys.exit(1)
+                return 1
 
             db[nspace][NAME] = {}
 
@@ -376,7 +376,7 @@ def main(argv):
 
     if ERRORS:
         logging.critical("Unable to set up test")
-        sys.exit(1)
+        return 1
 
     ALLREPPGS = get_pgs(OSDDIR, REPID)
     logging.debug(ALLREPPGS)
@@ -706,7 +706,7 @@ def main(argv):
             ret = call(cmd, shell=True, stdout=tmpfd)
             if ret:
                 logging.critical("INTERNAL ERROR")
-                sys.exit(1)
+                return 1
             tmpfd.close()
             obj_locs = get_lines(TMPFILE)
             if len(obj_locs) == 0:
@@ -761,10 +761,11 @@ def main(argv):
 
     if ERRORS == 0:
         print "TEST PASSED"
-        sys.exit(0)
+        return 0
     else:
         print "TEST FAILED WITH {errcount} ERRORS".format(errcount=ERRORS)
-        sys.exit(1)
+        return 1
 
 if __name__ == "__main__":
-    main(sys.argv[1:])
+    status = main(sys.argv[1:])
+    sys.exit(status)