OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 from slave import recipe_api | 5 from slave import recipe_api |
6 | 6 |
7 class AndroidApi(recipe_api.RecipeApi): | 7 class AndroidApi(recipe_api.RecipeApi): |
8 def __init__(self, **kwargs): | 8 def __init__(self, **kwargs): |
9 super(AndroidApi, self).__init__(**kwargs) | 9 super(AndroidApi, self).__init__(**kwargs) |
10 self._env = dict() | 10 self._env = dict() |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 yield self.m.step( | 97 yield self.m.step( |
98 'get_internal_names', | 98 'get_internal_names', |
99 [self.c.internal_dir('build', 'dump_internal_names.py'), | 99 [self.c.internal_dir('build', 'dump_internal_names.py'), |
100 '--output-json', self.m.json.output()] | 100 '--output-json', self.m.json.output()] |
101 ) | 101 ) |
102 | 102 |
103 self._internal_names = self.m.step_history.last_step().json.output | 103 self._internal_names = self.m.step_history.last_step().json.output |
104 | 104 |
105 def envsetup(self): | 105 def envsetup(self): |
106 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] | 106 envsetup_cmd = [self.m.path.checkout('build', 'android', 'envsetup.sh')] |
107 if self.c.target_arch: | 107 if self.target_arch: |
108 envsetup_cmd += ['--target-arch=%s' % self.c.target_arch] | 108 envsetup_cmd += ['--target-arch=%s' % self.target_arch] |
109 | 109 |
110 cmd = ([self.m.path.build('scripts', 'slave', 'env_dump.py'), | 110 cmd = ([self.m.path.build('scripts', 'slave', 'env_dump.py'), |
111 '--output-json', self.m.json.output()] + envsetup_cmd) | 111 '--output-json', self.m.json.output()] + envsetup_cmd) |
112 yield self.m.step('envsetup', cmd, env=self.get_env()) | 112 yield self.m.step('envsetup', cmd, env=self.get_env()) |
113 | 113 |
114 env_diff = self.m.step_history.last_step().json.output | 114 env_diff = self.m.step_history.last_step().json.output |
115 for key, value in env_diff.iteritems(): | 115 for key, value in env_diff.iteritems(): |
116 if key.startswith('GYP_'): | 116 if key.startswith('GYP_'): |
117 continue | 117 continue |
118 else: | 118 else: |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 yield self.m.step( | 303 yield self.m.step( |
304 'stack_tool_for_tombstones', | 304 'stack_tool_for_tombstones', |
305 [self.m.path.checkout('build', 'android', 'tombstones.py'), | 305 [self.m.path.checkout('build', 'android', 'tombstones.py'), |
306 '-a', '-s', '-w'], always_run=True, env=self.get_env()) | 306 '-a', '-s', '-w'], always_run=True, env=self.get_env()) |
307 if self.c.asan_symbolize: | 307 if self.c.asan_symbolize: |
308 yield self.m.step( | 308 yield self.m.step( |
309 'stack_tool_for_asan', | 309 'stack_tool_for_asan', |
310 [self.m.path.checkout('build', 'android', 'asan_symbolize.py'), | 310 [self.m.path.checkout('build', 'android', 'asan_symbolize.py'), |
311 '-l', log_file], always_run=True, env=self.get_env()) | 311 '-l', log_file], always_run=True, env=self.get_env()) |
312 | 312 |
| 313 @property |
| 314 def target_arch(self): |
| 315 """Convert from recipe arch to android arch.""" |
| 316 return { |
| 317 'intel': 'x86', |
| 318 'arm': 'arm', |
| 319 'mips': 'mips', |
| 320 }.get(self.m.chromium.c.TARGET_ARCH, '') |
| 321 |
313 def test_report(self): | 322 def test_report(self): |
314 return self.m.python.inline( | 323 return self.m.python.inline( |
315 'test_report', | 324 'test_report', |
316 """ | 325 """ |
317 import glob, os, sys | 326 import glob, os, sys |
318 for report in glob.glob(sys.argv[1]): | 327 for report in glob.glob(sys.argv[1]): |
319 with open(report, 'r') as f: | 328 with open(report, 'r') as f: |
320 for l in f.readlines(): | 329 for l in f.readlines(): |
321 print l | 330 print l |
322 os.remove(report) | 331 os.remove(report) |
323 """, | 332 """, |
324 args=[self.m.path.checkout('out', self.m.chromium.c.BUILD_CONFIG, | 333 args=[self.m.path.checkout('out', self.m.chromium.c.BUILD_CONFIG, |
325 'test_logs', '*.log')], | 334 'test_logs', '*.log')], |
326 always_run=True | 335 always_run=True |
327 ) | 336 ) |
328 | 337 |
329 def cleanup_build(self): | 338 def cleanup_build(self): |
330 return self.m.step( | 339 return self.m.step( |
331 'cleanup_build', | 340 'cleanup_build', |
332 ['rm', '-rf'] + self._cleanup_list, | 341 ['rm', '-rf'] + self._cleanup_list, |
333 always_run=True) | 342 always_run=True) |
334 | 343 |
335 def common_tree_setup_steps(self): | 344 def common_tree_setup_steps(self): |
336 yield self.init_and_sync() | 345 yield self.init_and_sync() |
337 yield self.envsetup() | 346 yield self.envsetup() |
338 yield self.clean_local_files() | 347 yield self.clean_local_files() |
339 if self.c.INTERNAL and self.c.run_tree_truth: | 348 if self.c.INTERNAL and self.c.run_tree_truth: |
340 yield self.run_tree_truth() | 349 yield self.run_tree_truth() |
341 | 350 |
342 def common_tests_setup_steps(self): | 351 def common_tests_setup_steps(self): |
343 yield self.spawn_logcat_monitor() | 352 yield self.spawn_logcat_monitor() |
344 yield self.detect_and_setup_devices() | 353 yield self.detect_and_setup_devices() |
345 | 354 |
346 def common_tests_final_steps(self): | 355 def common_tests_final_steps(self): |
347 yield self.logcat_dump() | 356 yield self.logcat_dump() |
348 yield self.stack_tool_steps() | 357 yield self.stack_tool_steps() |
349 yield self.test_report() | 358 yield self.test_report() |
350 yield self.cleanup_build() | 359 yield self.cleanup_build() |
OLD | NEW |