]> git-server-git.apps.pok.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)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 18:44:17 +0000 (10:44 -0800)
Instead of calling sys.exit() the main function returns the desired exit
code.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
(cherry picked from commit 0f3d7b1315f2b5595047d8bd13949ed0d9194bfa)

src/test/ceph_objectstore_tool.py

index a83092558882e04aed78f6d1c0a86a03a9ccd36c..8136ed0899e25f6c8110ab2fa0370cb3fd33f62f 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)