Bug 1493943 - Don't download grcov twice on Windows. r=jmaher
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Wed, 26 Sep 2018 15:23:19 +0100
changeset 438307 5b7e939320afea6d684f01db96d9dfa262fb7e4a
parent 438306 f5baad77e684203185b7cc17e60aaf794058d7bb
child 438308 8cb351adc7d35a62d80c57e0e7868ca61fb04b20
push id108280
push usermcastelluccio@mozilla.com
push dateWed, 26 Sep 2018 14:41:23 +0000
treeherdermozilla-inbound@5b7e939320af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1493943
milestone64.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 1493943 - Don't download grcov twice on Windows. r=jmaher DONTBUILD as this is ccov only.
testing/mozharness/mozharness/mozilla/testing/codecoverage.py
--- a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
+++ b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py
@@ -55,21 +55,30 @@ code_coverage_config_options = [
 
 
 class CodeCoverageMixin(SingleTestMixin):
     """
     Mixin for setting GCOV_PREFIX during test execution, packaging up
     the resulting .gcda files and uploading them to blobber.
     """
     gcov_dir = None
+    grcov_dir = None
+    grcov_bin = None
     jsvm_dir = None
     prefix = None
     per_test_reports = {}
 
     def __init__(self, **kwargs):
+        if mozinfo.os == 'linux' or mozinfo.os == 'mac':
+            self.grcov_bin = 'grcov'
+        elif mozinfo.os == 'win':
+            self.grcov_bin = 'grcov.exe'
+        else:
+            raise Exception('Unexpected OS: {}'.format(mozinfo.os))
+
         super(CodeCoverageMixin, self).__init__(**kwargs)
 
     @property
     def code_coverage_enabled(self):
         try:
             return bool(self.config.get('code_coverage'))
         except (AttributeError, KeyError, TypeError):
             return False
@@ -144,17 +153,17 @@ class CodeCoverageMixin(SingleTestMixin)
         self.java_coverage_output_dir = tempfile.mkdtemp()
 
     @PostScriptAction('download-and-extract')
     def setup_coverage_tools(self, action, success=None):
         if not self.code_coverage_enabled and not self.java_code_coverage_enabled:
             return
 
         self.grcov_dir = os.environ['MOZ_FETCHES_DIR']
-        if not os.path.isfile(os.path.join(self.grcov_dir, 'grcov')):
+        if not os.path.isfile(os.path.join(self.grcov_dir, self.grcov_bin)):
             self.fetch_content()
 
         if self.code_coverage_enabled:
             self._setup_cpp_js_coverage_tools()
 
         if self.java_code_coverage_enabled:
             self._setup_java_coverage_tools()
 
@@ -285,17 +294,17 @@ class CodeCoverageMixin(SingleTestMixin)
 
         from lcov_rewriter import LcovFileRewriter
         jsvm_files = [os.path.join(jsvm_dir, e) for e in os.listdir(jsvm_dir)]
         rewriter = LcovFileRewriter(os.path.join(self.grcov_dir, 'chrome-map.json'))
         rewriter.rewrite_files(jsvm_files, jsvm_output_file, '')
 
         # Run grcov on the zipped .gcno and .gcda files.
         grcov_command = [
-            os.path.join(self.grcov_dir, 'grcov'),
+            os.path.join(self.grcov_dir, self.grcov_bin),
             '-t', output_format,
             '-p', self.prefix,
             '--ignore-dir', 'gcc*',
             '--ignore-dir', 'vs2017_*',
             os.path.join(self.grcov_dir, 'target.code-coverage-gcno.zip'), gcov_dir
         ]
 
         if 'coveralls' in output_format:
@@ -517,17 +526,17 @@ class CodeCoverageMixin(SingleTestMixin)
         jacoco_command = ['java', '-jar', self.jacoco_jar, 'report'] + \
             report_files + \
             ['--classfiles', self.classfiles_dir,
              '--name', 'geckoview-junit',
              '--xml', os.path.join(xml_path, 'geckoview-junit.xml')]
         self.run_command(jacoco_command, halt_on_failure=True)
 
         grcov_command = [
-            os.path.join(self.grcov_dir, 'grcov'),
+            os.path.join(self.grcov_dir, self.grcov_bin),
             '-t', 'lcov',
             xml_path,
         ]
         tmp_output_file, _ = self.get_output_from_command(
             grcov_command,
             silent=True,
             save_tmpfiles=True,
             return_type='files',