Browse Source

If mode==verify, return non-zero if any verifications fail

Hamilton Turner 11 years ago
parent
commit
bb80e8fd6a
2 changed files with 11 additions and 1 deletions
  1. 1 1
      toolset/benchmark/benchmarker.py
  2. 10 0
      toolset/benchmark/framework_test.py

+ 1 - 1
toolset/benchmark/benchmarker.py

@@ -653,7 +653,7 @@ class Benchmarker:
         ##########################
         ##########################
         # Verify URLs
         # Verify URLs
         ##########################
         ##########################
-        test.verify_urls(out, err)
+        passed_verify = test.verify_urls(out, err)
         out.flush()
         out.flush()
         err.flush()
         err.flush()
 
 

+ 10 - 0
toolset/benchmark/framework_test.py

@@ -341,8 +341,11 @@ class FrameworkTest:
   # curl the URL and check for it's return status. 
   # curl the URL and check for it's return status. 
   # For each url, a flag will be set on this object for whether
   # For each url, a flag will be set on this object for whether
   # or not it passed
   # or not it passed
+  # Returns True if all verifications succeeded
   ############################################################
   ############################################################
   def verify_urls(self, out, err):
   def verify_urls(self, out, err):
+    result = True
+
     # JSON
     # JSON
     if self.runTests[self.JSON]:
     if self.runTests[self.JSON]:
       out.write(textwrap.dedent("""
       out.write(textwrap.dedent("""
@@ -361,6 +364,7 @@ class FrameworkTest:
       else:
       else:
         self.json_url_passed = False
         self.json_url_passed = False
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
     # DB
     # DB
@@ -391,6 +395,7 @@ class FrameworkTest:
         out.write("\n\n")
         out.write("\n\n")
       else:
       else:
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
     # Query
     # Query
@@ -452,6 +457,7 @@ class FrameworkTest:
         out.write("\n\n")
         out.write("\n\n")
       else:
       else:
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
     # Fortune
     # Fortune
@@ -472,6 +478,7 @@ class FrameworkTest:
       else:
       else:
         self.fortune_url_passed = False
         self.fortune_url_passed = False
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
     # Update
     # Update
@@ -492,6 +499,7 @@ class FrameworkTest:
       else:
       else:
         self.update_url_passed = False
         self.update_url_passed = False
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
     # plaintext
     # plaintext
@@ -512,8 +520,10 @@ class FrameworkTest:
       else:
       else:
         self.plaintext_url_passed = False
         self.plaintext_url_passed = False
         out.write("FAIL\n\n")
         out.write("FAIL\n\n")
+        result = False
       out.flush
       out.flush
 
 
+    return result
   ############################################################
   ############################################################
   # End verify_urls
   # End verify_urls
   ############################################################
   ############################################################