Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: infra/bots/recipe_modules/skia/coverage_flavor.py

Issue 2175373002: Move Skia recipes from build repo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address more comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/bots/recipe_modules/skia/cmake_flavor.py ('k') | infra/bots/recipe_modules/skia/default_flavor.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/bots/recipe_modules/skia/coverage_flavor.py
diff --git a/infra/bots/recipe_modules/skia/coverage_flavor.py b/infra/bots/recipe_modules/skia/coverage_flavor.py
new file mode 100644
index 0000000000000000000000000000000000000000..5fd853363dc1616f8c2f55c48bfd8b465757f0ff
--- /dev/null
+++ b/infra/bots/recipe_modules/skia/coverage_flavor.py
@@ -0,0 +1,76 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+import datetime
+import default_flavor
+import posixpath
+import ssh_devices
+
+
+"""Utils for running coverage tests."""
+
+
+class CoverageFlavorUtils(default_flavor.DefaultFlavorUtils):
+
+ def step(self, name, cmd, **kwargs):
+ """Run the given step through coverage."""
+ compile_target = 'dm'
+ build_cmd = [self._skia_api.skia_dir.join('tools', 'llvm_coverage_build'),
+ compile_target]
+ self._skia_api.run(self._skia_api.m.step,
+ 'build %s' % compile_target,
+ cmd=build_cmd,
+ cwd=self._skia_api.m.path['checkout'])
+
+ # Slice out the 'key' and 'properties' arguments to be reused.
+ key = []
+ properties = []
+ current = None
+ for i in xrange(0, len(cmd)):
+ if isinstance(cmd[i], basestring) and cmd[i] == '--key':
+ current = key
+ elif isinstance(cmd[i], basestring) and cmd[i] == '--properties':
+ current = properties
+ elif isinstance(cmd[i], basestring) and cmd[i].startswith('--'):
+ current = None
+ if current is not None:
+ current.append(cmd[i])
+
+ results_dir = self._skia_api.skia_out.join('coverage_results')
+ self.create_clean_host_dir(results_dir)
+
+ # Run DM under coverage.
+ report_file_basename = '%s.cov' % self._skia_api.got_revision
+ report_file = results_dir.join(report_file_basename)
+ args = [
+ 'python',
+ self._skia_api.skia_dir.join('tools', 'llvm_coverage_run.py'),
+ ] + cmd + ['--outResultsFile', report_file]
+ self._skia_api.run(self._skia_api.m.step, name=name, cmd=args,
+ cwd=self._skia_api.m.path['checkout'], **kwargs)
+
+ # Generate nanobench-style JSON output from the coverage report.
+ nanobench_json = results_dir.join('nanobench_%s.json' % (
+ self._skia_api.got_revision))
+ line_by_line_basename = ('coverage_by_line_%s.json' % (
+ self._skia_api.got_revision))
+ line_by_line = results_dir.join(line_by_line_basename)
+ args = [
+ 'python',
+ self._skia_api.skia_dir.join('tools', 'parse_llvm_coverage.py'),
+ '--report', report_file, '--nanobench', nanobench_json,
+ '--linebyline', line_by_line]
+ args.extend(key)
+ args.extend(properties)
+ self._skia_api.run(
+ self._skia_api.m.step,
+ 'Generate Coverage Data',
+ cmd=args, cwd=self._skia_api.m.path['checkout'])
+
+ # Copy files from results_dir into swarming_out_dir.
+ for r in self._skia_api.m.file.listdir('results_dir', results_dir):
+ self._skia_api.m.file.copy(
+ 'Copy to swarming out', results_dir.join(r),
+ self._skia_api.swarming_out_dir)
« no previous file with comments | « infra/bots/recipe_modules/skia/cmake_flavor.py ('k') | infra/bots/recipe_modules/skia/default_flavor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698