Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 1465343002: [Android] Add context manager to record logcat during step(s). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 re 5 import re
6 import string 6 import string
7 7
8 8
9 class Test(object): 9 class Test(object):
10 """ 10 """
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 kwargs['tool'] = self._android_tool 299 kwargs['tool'] = self._android_tool
300 else: 300 else:
301 kwargs['xvfb'] = True 301 kwargs['xvfb'] = True
302 kwargs['test_type'] = self.name 302 kwargs['test_type'] = self.name
303 kwargs['annotate'] = 'gtest' 303 kwargs['annotate'] = 'gtest'
304 kwargs['test_launcher_summary_output'] = gtest_results_file 304 kwargs['test_launcher_summary_output'] = gtest_results_file
305 kwargs.update(self._runtest_kwargs) 305 kwargs.update(self._runtest_kwargs)
306 306
307 try: 307 try:
308 if is_android: 308 if is_android:
309 api.chromium_android.run_test_suite(self.target_name, **kwargs) 309 with api.chromium_android.logcat(self.name):
310 api.chromium_android.run_test_suite(self.target_name, **kwargs)
310 elif self._use_isolate: 311 elif self._use_isolate:
311 api.isolate.runtest(self.target_name, self._revision, 312 api.isolate.runtest(self.target_name, self._revision,
312 self._webkit_revision, **kwargs) 313 self._webkit_revision, **kwargs)
313 else: 314 else:
314 api.chromium.runtest(self.target_name, revision=self._revision, 315 api.chromium.runtest(self.target_name, revision=self._revision,
315 webkit_revision=self._webkit_revision, **kwargs) 316 webkit_revision=self._webkit_revision, **kwargs)
316 finally: 317 finally:
317 step_result = api.step.active_result 318 step_result = api.step.active_result
318 self._test_runs[suffix] = step_result 319 self._test_runs[suffix] = step_result
319 320
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 self._test_apk = test_apk or suite_defaults.get('test_apk') 1588 self._test_apk = test_apk or suite_defaults.get('test_apk')
1588 self._tool = tool 1589 self._tool = tool
1589 self._verbose = verbose 1590 self._verbose = verbose
1590 1591
1591 #override 1592 #override
1592 def run_tests(self, api, suffix, json_results_file): 1593 def run_tests(self, api, suffix, json_results_file):
1593 mock_test_results = { 1594 mock_test_results = {
1594 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]}, 1595 'per_iteration_data': [{'TestA': [{'status': 'SUCCESS'}]},
1595 {'TestB': [{'status': 'FAILURE'}]}] 1596 {'TestB': [{'status': 'FAILURE'}]}]
1596 } 1597 }
1597 api.chromium_android.run_instrumentation_suite( 1598 with api.chromium_android.logcat(self.name):
1598 self.name, 1599 api.chromium_android.run_instrumentation_suite(
1599 test_apk=api.chromium_android.apk_path(self._test_apk), 1600 self.name,
1600 apk_under_test=api.chromium_android.apk_path(self._apk_under_test), 1601 test_apk=api.chromium_android.apk_path(self._test_apk),
1601 suffix=suffix, 1602 apk_under_test=api.chromium_android.apk_path(self._apk_under_test),
1602 isolate_file_path=self.isolate_file_path, 1603 suffix=suffix,
1603 flakiness_dashboard=self._flakiness_dashboard, 1604 isolate_file_path=self.isolate_file_path,
1604 annotation=self._annotation, except_annotation=self._except_annotation, 1605 flakiness_dashboard=self._flakiness_dashboard,
1605 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool, 1606 annotation=self._annotation,
1606 host_driven_root=self._host_driven_root, 1607 except_annotation=self._except_annotation,
1607 json_results_file=json_results_file, 1608 screenshot=self._screenshot, verbose=self._verbose, tool=self._tool,
1608 step_test_data=lambda: api.json.test_api.output(mock_test_results)) 1609 host_driven_root=self._host_driven_root,
1610 json_results_file=json_results_file,
1611 step_test_data=lambda: api.json.test_api.output(mock_test_results))
1609 1612
1610 1613
1611 class BlinkTest(Test): 1614 class BlinkTest(Test):
1612 # TODO(dpranke): This should be converted to a PythonBasedTest, although it 1615 # TODO(dpranke): This should be converted to a PythonBasedTest, although it
1613 # will need custom behavior because we archive the results as well. 1616 # will need custom behavior because we archive the results as well.
1614 def __init__(self, extra_args=None): 1617 def __init__(self, extra_args=None):
1615 super(BlinkTest, self).__init__() 1618 super(BlinkTest, self).__init__()
1616 self._extra_args = extra_args 1619 self._extra_args = extra_args
1617 1620
1618 name = 'webkit_tests' 1621 name = 'webkit_tests'
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 def run(self, api, suffix): 1792 def run(self, api, suffix):
1790 api.chromium_android.coverage_report(upload=False) 1793 api.chromium_android.coverage_report(upload=False)
1791 api.chromium_android.get_changed_lines_for_revision() 1794 api.chromium_android.get_changed_lines_for_revision()
1792 api.chromium_android.incremental_coverage_report() 1795 api.chromium_android.incremental_coverage_report()
1793 1796
1794 1797
1795 GOMA_TESTS = [ 1798 GOMA_TESTS = [
1796 GTestTest('base_unittests'), 1799 GTestTest('base_unittests'),
1797 GTestTest('content_unittests'), 1800 GTestTest('content_unittests'),
1798 ] 1801 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698