Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """ Utilities for Valgrind build steps. """ | 5 """ Utilities for Valgrind build steps. """ |
| 6 | 6 |
| 7 from default_build_step_utils import DefaultBuildStepUtils | 7 from default_build_step_utils import DefaultBuildStepUtils |
| 8 from utils import shell_utils | 8 from utils import shell_utils |
| 9 | 9 |
| 10 import os | 10 import os |
| 11 | 11 |
| 12 | 12 |
| 13 class ValgrindBuildStepUtils(DefaultBuildStepUtils): | 13 class ValgrindBuildStepUtils(DefaultBuildStepUtils): |
| 14 def __init__(self, build_step_instance): | 14 def __init__(self, build_step_instance): |
| 15 DefaultBuildStepUtils.__init__(self, build_step_instance) | 15 DefaultBuildStepUtils.__init__(self, build_step_instance) |
| 16 classname = self._step.__class__.__name__ | 16 self._suppressions_file = os.path.join('tools', 'valgrind.supp') |
|
mtklein
2014/04/30 21:01:49
Wow, that's a pleasant change.
| |
| 17 if classname == 'RunTests': | |
| 18 self._suppressions_file = os.path.join('tests', 'valgrind.supp') | |
| 19 elif classname == 'RunGM': | |
| 20 self._suppressions_file = os.path.join('gm', 'valgrind.supp') | |
| 21 elif classname == 'RunBench': | |
| 22 self._suppressions_file = os.path.join('bench', 'valgrind.supp') | |
| 23 elif classname in ('RenderPictures', 'RenderPdfs', 'BenchPictures', | |
| 24 'RunDecodingTests'): | |
| 25 self._suppressions_file = os.path.join('tools', 'valgrind.supp') | |
| 26 else: | |
| 27 self._suppressions_file = None | |
| 28 | 17 |
| 29 def RunFlavoredCmd(self, app, args): | 18 def RunFlavoredCmd(self, app, args): |
| 30 """ Override this in new BuildStep flavors. """ | 19 """ Override this in new BuildStep flavors. """ |
| 31 cmd = ['valgrind', '--gen-suppressions=all', '--leak-check=full', | 20 cmd = ['valgrind', '--gen-suppressions=all', '--leak-check=full', |
| 32 '--track-origins=yes', '--error-exitcode=1', '--num-callers=40'] | 21 '--track-origins=yes', '--error-exitcode=1', '--num-callers=40'] |
| 33 if self._suppressions_file: | 22 if self._suppressions_file: |
| 34 cmd.append('--suppressions=%s' % self._suppressions_file) | 23 cmd.append('--suppressions=%s' % self._suppressions_file) |
| 35 | 24 |
| 36 cmd.append(self._PathToBinary(app)) | 25 cmd.append(self._PathToBinary(app)) |
| 37 cmd.extend(args) | 26 cmd.extend(args) |
| 38 return shell_utils.run(cmd) | 27 return shell_utils.run(cmd) |
| 39 | 28 |
| 40 def Compile(self, target): | 29 def Compile(self, target): |
| 41 os.environ['GYP_DEFINES'] = self._step.args['gyp_defines'] | 30 os.environ['GYP_DEFINES'] = self._step.args['gyp_defines'] |
| 42 print 'GYP_DEFINES="%s"' % os.environ['GYP_DEFINES'] | 31 print 'GYP_DEFINES="%s"' % os.environ['GYP_DEFINES'] |
| 43 make_cmd = 'make' | 32 make_cmd = 'make' |
| 44 if os.name == 'nt': | 33 if os.name == 'nt': |
| 45 make_cmd = 'make.bat' | 34 make_cmd = 'make.bat' |
| 46 cmd = [make_cmd, | 35 cmd = [make_cmd, |
| 47 target, | 36 target, |
| 48 'BUILDTYPE=%s' % self._step.configuration, | 37 'BUILDTYPE=%s' % self._step.configuration, |
| 49 ] | 38 ] |
| 50 cmd.extend(self._step.default_make_flags) | 39 cmd.extend(self._step.default_make_flags) |
| 51 cmd.extend(self._step.make_flags) | 40 cmd.extend(self._step.make_flags) |
| 52 shell_utils.run(cmd) | 41 shell_utils.run(cmd) |
| OLD | NEW |