OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import default_flavor | 5 import default_flavor |
6 import subprocess | 6 import subprocess |
7 | 7 |
8 # Data should go under in _data_dir, which may be preserved across runs. | 8 # Data should go under in _data_dir, which may be preserved across runs. |
9 _data_dir = '/sdcard/revenge_of_the_skiabot/' | 9 _data_dir = '/sdcard/revenge_of_the_skiabot/' |
10 # Executables go under _bin_dir, which, well, allows executable files. | 10 # Executables go under _bin_dir, which, well, allows executable files. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 infra_step=True) | 72 infra_step=True) |
73 self._run('gn gen', 'gn', 'gen', self.out_dir, '--args=' + gn_args) | 73 self._run('gn gen', 'gn', 'gen', self.out_dir, '--args=' + gn_args) |
74 self._run('ninja', 'ninja', '-C', self.out_dir) | 74 self._run('ninja', 'ninja', '-C', self.out_dir) |
75 | 75 |
76 def install(self): | 76 def install(self): |
77 self._adb('mkdir ' + self.device_dirs.resource_dir, | 77 self._adb('mkdir ' + self.device_dirs.resource_dir, |
78 'shell', 'mkdir', '-p', self.device_dirs.resource_dir) | 78 'shell', 'mkdir', '-p', self.device_dirs.resource_dir) |
79 | 79 |
80 def cleanup_steps(self): | 80 def cleanup_steps(self): |
81 if self._ever_ran_adb: | 81 if self._ever_ran_adb: |
82 self._adb('dump log', 'logcat', '-d') | 82 self.m.python.inline('dump log', """ |
| 83 import os |
| 84 import subprocess |
| 85 import sys |
| 86 out = sys.argv[1] |
| 87 log = subprocess.check_output(['adb', 'logcat', '-d']) |
| 88 for line in log.split('\\n'): |
| 89 tokens = line.split() |
| 90 if len(tokens) == 11 and tokens[-7] == 'F' and tokens[-3] == 'pc': |
| 91 addr, path = tokens[-2:] |
| 92 local = os.path.join(out, os.path.basename(path)) |
| 93 if os.path.exists(local): |
| 94 sym = subprocess.check_output(['addr2line', '-Cfpe', local, addr]) |
| 95 line = line.replace(addr, addr + ' ' + sym.strip()) |
| 96 print line |
| 97 """, |
| 98 args=[self.m.vars.skia_out.join(self.m.vars.configuration)], |
| 99 infra_step=True) |
83 self._adb('reboot', 'reboot') | 100 self._adb('reboot', 'reboot') |
84 self._adb('kill adb server', 'kill-server') | 101 self._adb('kill adb server', 'kill-server') |
85 | 102 |
86 def step(self, name, cmd, env=None, **kwargs): | 103 def step(self, name, cmd, env=None, **kwargs): |
87 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) | 104 app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0]) |
88 self._adb('push %s' % cmd[0], | 105 self._adb('push %s' % cmd[0], |
89 'push', app, _bin_dir) | 106 'push', app, _bin_dir) |
90 | 107 |
91 sh = '%s.sh' % cmd[0] | 108 sh = '%s.sh' % cmd[0] |
92 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), | 109 self.m.run.writefile(self.m.vars.tmp_dir.join(sh), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 def read_file_on_device(self, path): | 155 def read_file_on_device(self, path): |
139 return self._adb('read %s' % path, | 156 return self._adb('read %s' % path, |
140 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout | 157 'shell', 'cat', path, stdout=self.m.raw_io.output()).stdout |
141 | 158 |
142 def remove_file_on_device(self, path): | 159 def remove_file_on_device(self, path): |
143 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) | 160 self._adb('rm %s' % path, 'shell', 'rm', '-f', path) |
144 | 161 |
145 def create_clean_device_dir(self, path): | 162 def create_clean_device_dir(self, path): |
146 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) | 163 self._adb('rm %s' % path, 'shell', 'rm', '-rf', path) |
147 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) | 164 self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path) |
OLD | NEW |