ソースを参照

Continuous benchmarking: Generate and email metadata file. (#2322)

A Shawn Bandy 8 年 前
コミット
90abcd049d

+ 4 - 1
toolset/benchmark/benchmarker.py

@@ -112,12 +112,15 @@ class Benchmarker:
   # running benchmarks against them.
   ############################################################
   def run(self):
+    ##########################
+    # Generate metadata
+    ##########################
+    self.run_list_test_metadata()
     ##########################
     # Get a list of all known
     # tests that we can run.
     ##########################
     all_tests = self.__gather_tests
-
     ##########################
     # Setup client/server
     ##########################

+ 22 - 1
toolset/lifecycle/post-run-tests/email-results.py

@@ -16,6 +16,16 @@ import zipfile
 import os
 import subprocess
 import tempfile
+
+#
+# finds a file of the given name in the tree below path
+# http://stackoverflow.com/a/1724723
+#
+def find(name, path):
+    for root, dirs, files in os.walk(path):
+        if name in files:
+            return os.path.join(root, name)
+
 #
 # Generate body of email and attach to message
 #
@@ -52,7 +62,6 @@ message.attach(resultsZipped)
 #
 # Attach the .commit file
 #
-
 commitFileLocation = os.environ['TFB_REPOPARENT'] + "/" \
     + os.environ['TFB_REPONAME'] + "/results/.commit"
 attachment = MIMEBase('application', 'octet-stream')
@@ -61,6 +70,18 @@ encoders.encode_base64(attachment)
 attachment.add_header('Content-Disposition', 'attachment; filename=".commit"')
 message.attach(attachment)
 
+#
+# Find and attach the metadata file
+#
+metadataLocation = find("test_metadata.json", os.environ['TFB_REPOPARENT'] + "/" \
+    + os.environ['TFB_REPONAME'] + "/results")
+if metadataLocation is not None:
+  attachment = MIMEBase('application', 'octet-stream')
+  attachment.set_payload(open(metadataLocation, "rb").read())
+  encoders.encode_base64(attachment)
+  attachment.add_header('Content-Disposition', 'attachment; filename="test_metadata.json"')
+  message.attach(attachment)
+
 
 #
 # Send the message and close the collection