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