Bug 1156885 - Fix and validate perfherder output;r=jmaher
authorWilliam Lachance <wlachance@mozilla.com>
Tue, 01 Mar 2016 15:47:48 -0500
changeset 323036 83058edfb8f2645f5523a01a4140ee268f3a562e
parent 323035 b891c43b673e4dd1c4115c59a2b913c2ad5fd18a
child 323037 af6363aa513b304758521d03e3e5286ece7fed23
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1156885
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1156885 - Fix and validate perfherder output;r=jmaher MozReview-Commit-ID: K7SxuEa8dKe
build/util/count_ctors.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/build/util/count_ctors.py
+++ b/build/util/count_ctors.py
@@ -1,11 +1,13 @@
+
 #!/usr/bin/python
+import json
+import re
 import subprocess
-import re
 import sys
 
 def count_ctors(filename):
     proc = subprocess.Popen(
         ['readelf', '-W', '-S', filename], stdout=subprocess.PIPE)
 
     # Some versions of ld produce both .init_array and .ctors.  So we have
     # to check for both.
@@ -42,11 +44,20 @@ def count_ctors(filename):
 
     # We didn't find anything; somebody switched initialization mechanisms on
     # us, or the binary is completely busted.  Complain either way.
     print >>sys.stderr, "Couldn't find .init_array or .ctors in", filename
     sys.exit(1)
 
 if __name__ == '__main__':
     for f in sys.argv[1:]:
-        output = {"framework": {"name": "build_metrics"}, "suites": [{"name": "compiler_metrics", "subtests": [{"name": "num_constructors", "value": count_ctors(f)}] } ]}
-        print "PERFHERDER_DATA: %s" % output
+        perfherder_data = {
+            "framework": {"name": "build_metrics"},
+            "suites": [{
+                "name": "compiler_metrics",
+                "subtests": [{
+                    "name": "num_constructors",
+                    "value": count_ctors(f)
+                }]}
+            ]
+        }
+        print "PERFHERDER_DATA: %s" % json.dumps(perfherder_data)
 
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1218,27 +1218,30 @@ or run without that action (ie: --no-{ac
                 self.warning(ERROR_MSGS['comments_undetermined'])
             self.set_buildbot_property('got_revision',
                                        rev[:12],
                                        write_to_file=True)
 
     def _count_ctors(self):
         """count num of ctors and set testresults."""
         dirs = self.query_abs_dirs()
+        python_path = os.path.join(dirs['abs_work_dir'], 'venv', 'bin',
+                                   'python')
         abs_count_ctors_path = os.path.join(dirs['abs_src_dir'],
                                             'build',
                                             'util',
                                             'count_ctors.py')
         abs_libxul_path = os.path.join(dirs['abs_obj_dir'],
                                        'dist',
                                        'bin',
                                        'libxul.so')
 
-        cmd = ['python', abs_count_ctors_path, abs_libxul_path]
-        self.get_output_from_command(cmd, cwd=dirs['abs_src_dir'])
+        cmd = [python_path, abs_count_ctors_path, abs_libxul_path]
+        self.get_output_from_command(cmd, cwd=dirs['abs_src_dir'],
+                                     throw_exception=True)
 
     def _generate_properties_file(self, path):
         # TODO it would be better to grab all the properties that were
         # persisted to file rather than use whats in the buildbot_properties
         # live object so we become less action dependant.
         all_current_props = dict(
             chain(self.buildbot_config['properties'].items(),
                   self.buildbot_properties.items())