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 classname = self._step.__class__.__name__ |
17 if classname == 'ValgrindRunTests': | 17 if classname == 'RunTests': |
18 self._suppressions_file = os.path.join('tests', 'valgrind.supp') | 18 self._suppressions_file = os.path.join('tests', 'valgrind.supp') |
19 elif classname == 'ValgrindRunGM': | 19 elif classname == 'RunGM': |
20 self._suppressions_file = os.path.join('gm', 'valgrind.supp') | 20 self._suppressions_file = os.path.join('gm', 'valgrind.supp') |
21 else: | 21 else: |
22 self._suppressions_file = None | 22 self._suppressions_file = None |
23 | 23 |
24 def RunFlavoredCmd(self, app, args): | 24 def RunFlavoredCmd(self, app, args): |
25 """ Override this in new BuildStep flavors. """ | 25 """ Override this in new BuildStep flavors. """ |
26 cmd = ['valgrind', '--gen-suppressions=all', '--leak-check=full', | 26 cmd = ['valgrind', '--gen-suppressions=all', '--leak-check=full', |
27 '--track-origins=yes', '--error-exitcode=1'] | 27 '--track-origins=yes', '--error-exitcode=1'] |
28 if self._suppressions_file: | 28 if self._suppressions_file: |
29 cmd.append('--suppressions=%s' % self._suppressions_file) | 29 cmd.append('--suppressions=%s' % self._suppressions_file) |
30 | 30 |
31 # For now, just run in debug mode. | |
32 self._step._configuration = 'Debug' | |
33 | |
34 cmd.append(self._PathToBinary(app)) | 31 cmd.append(self._PathToBinary(app)) |
35 cmd.extend(args) | 32 cmd.extend(args) |
36 return shell_utils.Bash(cmd) | 33 return shell_utils.Bash(cmd) |
37 | 34 |
38 def Compile(self, target): | 35 def Compile(self, target): |
39 | |
40 # For now, just run in debug mode. | |
41 self._step._configuration = 'Debug' | |
42 | |
43 os.environ['GYP_DEFINES'] = self._step.args['gyp_defines'] | 36 os.environ['GYP_DEFINES'] = self._step.args['gyp_defines'] |
44 print 'GYP_DEFINES="%s"' % os.environ['GYP_DEFINES'] | 37 print 'GYP_DEFINES="%s"' % os.environ['GYP_DEFINES'] |
45 make_cmd = 'make' | 38 make_cmd = 'make' |
46 if os.name == 'nt': | 39 if os.name == 'nt': |
47 make_cmd = 'make.bat' | 40 make_cmd = 'make.bat' |
48 cmd = [make_cmd, | 41 cmd = [make_cmd, |
49 target, | 42 target, |
50 'BUILDTYPE=%s' % self._step.configuration, | 43 'BUILDTYPE=%s' % self._step.configuration, |
51 ] | 44 ] |
52 cmd.extend(self._step.default_make_flags) | 45 cmd.extend(self._step.default_make_flags) |
53 cmd.extend(self._step.make_flags) | 46 cmd.extend(self._step.make_flags) |
54 shell_utils.Bash(cmd) | 47 shell_utils.Bash(cmd) |
OLD | NEW |