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

Side by Side Diff: build/android/buildbot/bb_tests.py

Issue 11827031: Fix adb_logcat_monitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import collections 6 import collections
7 import glob 7 import glob
8 import json 8 import json
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 I_TEST('AndroidWebView', 45 I_TEST('AndroidWebView',
46 'AndroidWebView.apk', 46 'AndroidWebView.apk',
47 'org.chromium.android_webview', 47 'org.chromium.android_webview',
48 'AndroidWebViewTest', 48 'AndroidWebViewTest',
49 'webview:android_webview/test/data/device_files'), 49 'webview:android_webview/test/data/device_files'),
50 ]) 50 ])
51 51
52 VALID_TESTS = set(['ui', 'unit', 'webkit', 'webkit_layout']) 52 VALID_TESTS = set(['ui', 'unit', 'webkit', 'webkit_layout'])
53 53
54 54
55 def RunCmd(command, flunk_on_failure=True): 55 def SpawnCmd(command):
56 """Run a command relative to the chrome source root.""" 56 """Spawn a process without waiting for termination."""
57
58 # Add adb binary to path. In the future, might use build_internal copy. 57 # Add adb binary to path. In the future, might use build_internal copy.
59 env = dict(os.environ) 58 env = dict(os.environ)
60 env['PATH'] = os.pathsep.join([ 59 env['PATH'] = os.pathsep.join([
61 env['PATH'], os.path.join(constants.ANDROID_SDK_ROOT, 'platform-tools')]) 60 env['PATH'], os.path.join(constants.ANDROID_SDK_ROOT, 'platform-tools')])
61 print '>', ' '.join(map(pipes.quote, command))
62 sys.stdout.flush()
63 if TESTING:
64 class MockPopen(object):
65 @staticmethod
66 def wait():
67 return 0
68 return MockPopen()
62 69
63 command_str = ' '.join(map(pipes.quote, command)) 70 return subprocess.Popen(command, cwd=CHROME_SRC, env=env)
64 print '>', command_str 71
65 if not TESTING: 72 def RunCmd(command, flunk_on_failure=True):
66 code = subprocess.Popen(command, cwd=CHROME_SRC, env=env).wait() 73 """Run a command relative to the chrome source root."""
67 else: 74 code = SpawnCmd(command).wait()
68 code = 0 75 print '<', ' '.join(map(pipes.quote, command))
69 print '<', command_str
70 if code != 0: 76 if code != 0:
71 print 'ERROR: non-zero status %d from %s' % (code, command) 77 print 'ERROR: non-zero status %d from %s' % (code, command)
72 if flunk_on_failure: 78 if flunk_on_failure:
73 buildbot_report.PrintError() 79 buildbot_report.PrintError()
74 else: 80 else:
75 buildbot_report.PrintWarning() 81 buildbot_report.PrintWarning()
76 return code 82 return code
77 83
78 84
79 def RunTestSuites(options, suite): 85 def RunTestSuites(options, suite):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 165
160 if not options.test_filter: 166 if not options.test_filter:
161 return 167 return
162 168
163 # Device check and alert emails 169 # Device check and alert emails
164 RunCmd(['build/android/device_status_check.py'], flunk_on_failure=False) 170 RunCmd(['build/android/device_status_check.py'], flunk_on_failure=False)
165 171
166 # Spawn logcat monitor 172 # Spawn logcat monitor
167 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat') 173 logcat_dir = os.path.join(CHROME_SRC, 'out/logcat')
168 shutil.rmtree(logcat_dir, ignore_errors=True) 174 shutil.rmtree(logcat_dir, ignore_errors=True)
169 if not TESTING: 175 SpawnCmd(['build/android/adb_logcat_monitor.py', logcat_dir])
170 subprocess.Popen(
171 ['build/android/adb_logcat_monitor.py', logcat_dir], cwd=CHROME_SRC)
172 176
173 if 'unit' in options.test_filter: 177 if 'unit' in options.test_filter:
174 RunTestSuites(options, None) 178 RunTestSuites(options, None)
175 if 'ui' in options.test_filter: 179 if 'ui' in options.test_filter:
176 for test in INSTRUMENTATION_TESTS.itervalues(): 180 for test in INSTRUMENTATION_TESTS.itervalues():
177 RunInstrumentationSuite(options, test) 181 RunInstrumentationSuite(options, test)
178 if 'webkit' in options.test_filter: 182 if 'webkit' in options.test_filter:
179 RunTestSuites(options, 'webkit_unit_tests') 183 RunTestSuites(options, 'webkit_unit_tests')
180 RunTestSuites(options, 'TestWebKitAPI') 184 RunTestSuites(options, 'TestWebKitAPI')
181 RunWebkitLint(options.target) 185 RunWebkitLint(options.target)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if unknown_tests: 239 if unknown_tests:
236 return ParserError('Unknown tests %s' % list(unknown_tests)) 240 return ParserError('Unknown tests %s' % list(unknown_tests))
237 241
238 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) 242 setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
239 243
240 MainTestWrapper(options) 244 MainTestWrapper(options)
241 245
242 246
243 if __name__ == '__main__': 247 if __name__ == '__main__':
244 sys.exit(main(sys.argv)) 248 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698