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

Side by Side Diff: infra/bots/recipe_modules/flavor/coverage_flavor.py

Issue 2217523002: [recipes] Fixes for Coverage bot (Closed) Base URL: https://skia.googlesource.com/skia.git@merge_buildbot_spec_sub2
Patch Set: Fix compile env Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | infra/bots/recipe_modules/vars/api.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 import datetime 6 import datetime
7 import default_flavor 7 import default_flavor
8 import posixpath 8 import posixpath
9 9
10 10
11 """Utils for running coverage tests.""" 11 """Utils for running coverage tests."""
12 12
13 13
14 class CoverageFlavorUtils(default_flavor.DefaultFlavorUtils): 14 class CoverageFlavorUtils(default_flavor.DefaultFlavorUtils):
15 15
16 def step(self, name, cmd, **kwargs): 16 def step(self, name, cmd, **kwargs):
17 """Run the given step through coverage.""" 17 """Run the given step through coverage."""
18 compile_target = 'dm' 18 compile_target = 'dm'
19 build_cmd = [self.m.vars.skia_dir.join('tools', 'llvm_coverage_build'), 19 build_cmd = [self.m.vars.skia_dir.join('tools', 'llvm_coverage_build'),
20 compile_target] 20 compile_target]
21 self.m.run(self.m.step, 21 build_env = kwargs.pop('env', {})
22 'build %s' % compile_target, 22 # We have to use Clang 3.6 because earlier versions do not support the
23 cmd=build_cmd, 23 # compile flags we use and 3.7 and 3.8 hit asserts during compilation.
24 cwd=self.m.path['checkout']) 24 build_env['CC'] = '/usr/bin/clang-3.6'
25 build_env['CXX'] = '/usr/bin/clang++-3.6'
26 build_env['GYP_DEFINES'] = (
27 'skia_arch_type=x86_64 '
28 'skia_clang_build=1 '
29 'skia_gpu=0 '
30 'skia_warnings_as_errors=0')
31 self.m.step('build %s' % compile_target,
32 cmd=build_cmd,
33 cwd=self.m.path['checkout'],
34 env=build_env,
35 **kwargs)
25 36
26 # Slice out the 'key' and 'properties' arguments to be reused. 37 # Slice out the 'key' and 'properties' arguments to be reused.
27 key = [] 38 key = []
28 properties = [] 39 properties = []
29 current = None 40 current = None
30 for i in xrange(0, len(cmd)): 41 for i in xrange(0, len(cmd)):
31 if isinstance(cmd[i], basestring) and cmd[i] == '--key': 42 if isinstance(cmd[i], basestring) and cmd[i] == '--key':
32 current = key 43 current = key
33 elif isinstance(cmd[i], basestring) and cmd[i] == '--properties': 44 elif isinstance(cmd[i], basestring) and cmd[i] == '--properties':
34 current = properties 45 current = properties
35 elif isinstance(cmd[i], basestring) and cmd[i].startswith('--'): 46 elif isinstance(cmd[i], basestring) and cmd[i].startswith('--'):
36 current = None 47 current = None
37 if current is not None: 48 if current is not None:
38 current.append(cmd[i]) 49 current.append(cmd[i])
39 50
40 results_dir = self.m.vars.skia_out.join('coverage_results') 51 results_dir = self.m.vars.skia_out.join('coverage_results')
41 self.create_clean_host_dir(results_dir) 52 self.create_clean_host_dir(results_dir)
42 53
43 # Run DM under coverage. 54 # Run DM under coverage.
44 report_file_basename = '%s.cov' % self.m.vars.got_revision 55 report_file_basename = '%s.cov' % self.m.vars.got_revision
45 report_file = results_dir.join(report_file_basename) 56 report_file = results_dir.join(report_file_basename)
46 args = [ 57 args = [
47 'python', 58 'python',
48 self.m.vars.skia_dir.join('tools', 'llvm_coverage_run.py'), 59 self.m.vars.skia_dir.join('tools', 'llvm_coverage_run.py'),
49 ] + cmd + ['--outResultsFile', report_file] 60 ] + cmd + ['--outResultsFile', report_file]
50 self.m.run(self.m.step, name=name, cmd=args, 61 self.m.run(self.m.step, name=name, cmd=args,
51 cwd=self.m.path['checkout'], **kwargs) 62 cwd=self.m.path['checkout'], **kwargs)
52 63
53 # Generate nanobench-style JSON output from the coverage report. 64 # Generate nanobench-style JSON output from the coverage report.
54 nanobench_json = results_dir.join('nanobench_%s.json' % ( 65 nanobench_json = results_dir.join('nanobench_%s.json' % (
55 self.m.vars.got_revision)) 66 self.m.vars.got_revision))
56 line_by_line_basename = ('coverage_by_line_%s.json' % ( 67 line_by_line_basename = ('coverage_by_line_%s.json' % (
57 self.m.vars.got_revision)) 68 self.m.vars.got_revision))
58 line_by_line = results_dir.join(line_by_line_basename) 69 line_by_line = results_dir.join(line_by_line_basename)
59 args = [ 70 args = [
60 'python', 71 'python',
61 self.m.vars.skia_dir.join('tools', 'parse_llvm_coverage.py'), 72 self.m.vars.skia_dir.join('tools', 'parse_llvm_coverage.py'),
62 '--report', report_file, '--nanobench', nanobench_json, 73 '--report', report_file, '--nanobench', nanobench_json,
63 '--linebyline', line_by_line] 74 '--linebyline', line_by_line]
64 args.extend(key) 75 args.extend(key)
65 args.extend(properties) 76 args.extend(properties)
66 self.m.run( 77 self.m.run(
67 self.m.step, 78 self.m.step,
68 'Generate Coverage Data', 79 'Generate Coverage Data',
69 cmd=args, cwd=self.m.path['checkout']) 80 cmd=args, cwd=self.m.path['checkout'])
70 81
71 # Copy files from results_dir into swarming_out_dir. 82 # Copy files from results_dir into swarming_out_dir.
72 for r in self.m.file.listdir('results_dir', results_dir): 83 for r in self.m.file.listdir('results_dir', results_dir):
73 self.m.file.copy( 84 self.m.file.copy(
74 'Copy to swarming out', results_dir.join(r), 85 'Copy to swarming out', results_dir.join(r),
75 self.m.vars.swarming_out_dir) 86 self.m.vars.swarming_out_dir)
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipe_modules/vars/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698