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

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

Issue 23444021: Re-land r22016 "Archive webkit_tests results on android bots if requested" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the path to archive_layout_test_results.py Created 7 years, 3 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 | build/android/buildbot/bb_utils.py » ('j') | 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 hashlib 8 import hashlib
9 import multiprocessing 9 import multiprocessing
10 import os 10 import os
11 import random 11 import random
12 import shutil 12 import shutil
13 import sys 13 import sys
14 14
15 import bb_utils 15 import bb_utils
16 import bb_annotations 16 import bb_annotations
17 17
18 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 18 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
19 import provision_devices 19 import provision_devices
20 from pylib import android_commands 20 from pylib import android_commands
21 from pylib import constants 21 from pylib import constants
22 from pylib.gtest import gtest_config 22 from pylib.gtest import gtest_config
23 23
24 CHROME_SRC_DIR = bb_utils.CHROME_SRC
25 CHROME_OUT_DIR = bb_utils.CHROME_OUT_DIR
24 sys.path.append(os.path.join( 26 sys.path.append(os.path.join(
25 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) 27 CHROME_SRC_DIR, 'third_party', 'android_testrunner'))
26 import errors 28 import errors
27 29
28 30
29 CHROME_SRC = constants.DIR_SOURCE_ROOT 31 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave')
30 LOGCAT_DIR = os.path.join(CHROME_SRC, 'out', 'logcat') 32 LOGCAT_DIR = os.path.join(bb_utils.CHROME_OUT_DIR, 'logcat')
31 33
32 # Describes an instrumation test suite: 34 # Describes an instrumation test suite:
33 # test: Name of test we're running. 35 # test: Name of test we're running.
34 # apk: apk to be installed. 36 # apk: apk to be installed.
35 # apk_package: package for the apk to be installed. 37 # apk_package: package for the apk to be installed.
36 # test_apk: apk to run tests on. 38 # test_apk: apk to run tests on.
37 # test_data: data folder in format destination:source. 39 # test_data: data folder in format destination:source.
38 # host_driven_root: The host-driven test root directory. 40 # host_driven_root: The host-driven test root directory.
39 # annotation: Annotation of the tests to include. 41 # annotation: Annotation of the tests to include.
40 # exclude_annotation: The annotation of the tests to exclude. 42 # exclude_annotation: The annotation of the tests to exclude.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 """Run layout tests on an actual device.""" 215 """Run layout tests on an actual device."""
214 bb_annotations.PrintNamedStep('webkit_tests') 216 bb_annotations.PrintNamedStep('webkit_tests')
215 cmd_args = [ 217 cmd_args = [
216 '--no-show-results', 218 '--no-show-results',
217 '--no-new-test-results', 219 '--no-new-test-results',
218 '--full-results-html', 220 '--full-results-html',
219 '--clobber-old-results', 221 '--clobber-old-results',
220 '--exit-after-n-failures', '5000', 222 '--exit-after-n-failures', '5000',
221 '--exit-after-n-crashes-or-timeouts', '100', 223 '--exit-after-n-crashes-or-timeouts', '100',
222 '--debug-rwt-logging', 224 '--debug-rwt-logging',
223 '--results-directory', '..layout-test-results', 225 '--results-directory', '../layout-test-results',
224 '--target', options.target, 226 '--target', options.target,
225 '--builder-name', options.build_properties.get('buildername', ''), 227 '--builder-name', options.build_properties.get('buildername', ''),
226 '--build-number', str(options.build_properties.get('buildnumber', '')), 228 '--build-number', str(options.build_properties.get('buildnumber', '')),
227 '--master-name', options.build_properties.get('mastername', ''), 229 '--master-name', options.build_properties.get('mastername', ''),
228 '--build-name', options.build_properties.get('buildername', ''), 230 '--build-name', options.build_properties.get('buildername', ''),
229 '--platform=android'] 231 '--platform=android']
230 232
231 for flag in 'test_results_server', 'driver_name', 'additional_drt_flag': 233 for flag in 'test_results_server', 'driver_name', 'additional_drt_flag':
232 if flag in options.factory_properties: 234 if flag in options.factory_properties:
233 cmd_args.extend(['--%s' % flag.replace('_', '-'), 235 cmd_args.extend(['--%s' % flag.replace('_', '-'),
234 options.factory_properties.get(flag)]) 236 options.factory_properties.get(flag)])
235 237
236 for f in options.factory_properties.get('additional_expectations', []): 238 for f in options.factory_properties.get('additional_expectations', []):
237 cmd_args.extend( 239 cmd_args.extend(
238 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) 240 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)])
239 241
240 # TODO(dpranke): Remove this block after 242 # TODO(dpranke): Remove this block after
241 # https://codereview.chromium.org/12927002/ lands. 243 # https://codereview.chromium.org/12927002/ lands.
242 for f in options.factory_properties.get('additional_expectations_files', []): 244 for f in options.factory_properties.get('additional_expectations_files', []):
243 cmd_args.extend( 245 cmd_args.extend(
244 ['--additional-expectations=%s' % os.path.join(CHROME_SRC, *f)]) 246 ['--additional-expectations=%s' % os.path.join(CHROME_SRC_DIR, *f)])
245 247
246 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args) 248 RunCmd(['webkit/tools/layout_tests/run_webkit_tests.py'] + cmd_args)
247 249
250 if options.factory_properties.get('archive_webkit_results', False):
251 bb_annotations.PrintNamedStep('archive_webkit_results')
252 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'chromium',
253 'archive_layout_test_results.py'),
254 '--results-dir', '../layout-test-results',
255 '--target', options.target,
256 '--build-dir', CHROME_OUT_DIR,
257 '--build-number', str(options.build_properties.get('buildnumber', '')),
258 '--builder-name', options.build_properties.get('buildername', '')])
259
248 260
249 def SpawnLogcatMonitor(): 261 def SpawnLogcatMonitor():
250 shutil.rmtree(LOGCAT_DIR, ignore_errors=True) 262 shutil.rmtree(LOGCAT_DIR, ignore_errors=True)
251 bb_utils.SpawnCmd([ 263 bb_utils.SpawnCmd([
252 os.path.join(CHROME_SRC, 'build', 'android', 'adb_logcat_monitor.py'), 264 os.path.join(CHROME_SRC_DIR, 'build', 'android', 'adb_logcat_monitor.py'),
253 LOGCAT_DIR]) 265 LOGCAT_DIR])
254 266
255 # Wait for logcat_monitor to pull existing logcat 267 # Wait for logcat_monitor to pull existing logcat
256 RunCmd(['sleep', '5']) 268 RunCmd(['sleep', '5'])
257 269
258 def ProvisionDevices(options): 270 def ProvisionDevices(options):
259 bb_annotations.PrintNamedStep('provision_devices') 271 bb_annotations.PrintNamedStep('provision_devices')
260 272
261 if not bb_utils.TESTING: 273 if not bb_utils.TESTING:
262 # Restart adb to work around bugs, sleep to wait for usb discovery. 274 # Restart adb to work around bugs, sleep to wait for usb discovery.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 'https://storage.googleapis.com/%s/index.html' % gs_path) 353 'https://storage.googleapis.com/%s/index.html' % gs_path)
342 354
343 355
344 def GenerateJavaCoverageReport(options): 356 def GenerateJavaCoverageReport(options):
345 """Generates an HTML coverage report using EMMA and uploads it.""" 357 """Generates an HTML coverage report using EMMA and uploads it."""
346 bb_annotations.PrintNamedStep('java_coverage_report') 358 bb_annotations.PrintNamedStep('java_coverage_report')
347 359
348 coverage_html = os.path.join(options.coverage_dir, 'coverage_html') 360 coverage_html = os.path.join(options.coverage_dir, 'coverage_html')
349 RunCmd(['build/android/generate_emma_html.py', 361 RunCmd(['build/android/generate_emma_html.py',
350 '--coverage-dir', options.coverage_dir, 362 '--coverage-dir', options.coverage_dir,
351 '--metadata-dir', os.path.join(CHROME_SRC, 'out', options.target), 363 '--metadata-dir', os.path.join(CHROME_OUT_DIR, options.target),
352 '--cleanup', 364 '--cleanup',
353 '--output', os.path.join(coverage_html, 'index.html')]) 365 '--output', os.path.join(coverage_html, 'index.html')])
354 UploadCoverageData(options, coverage_html, 'java') 366 UploadCoverageData(options, coverage_html, 'java')
355 367
356 368
357 def LogcatDump(options): 369 def LogcatDump(options):
358 # Print logcat, kill logcat monitor 370 # Print logcat, kill logcat monitor
359 bb_annotations.PrintNamedStep('logcat_dump') 371 bb_annotations.PrintNamedStep('logcat_dump')
360 logcat_file = os.path.join(CHROME_SRC, 'out', options.target, 'full_log') 372 logcat_file = os.path.join(CHROME_OUT_DIR, options.target, 'full_log')
361 with open(logcat_file, 'w') as f: 373 with open(logcat_file, 'w') as f:
362 RunCmd([ 374 RunCmd([
363 os.path.join(CHROME_SRC, 'build', 'android', 'adb_logcat_printer.py'), 375 os.path.join(CHROME_SRC_DIR, 'build', 'android',
376 'adb_logcat_printer.py'),
364 LOGCAT_DIR], stdout=f) 377 LOGCAT_DIR], stdout=f)
365 RunCmd(['cat', logcat_file]) 378 RunCmd(['cat', logcat_file])
366 379
367 380
368 def GenerateTestReport(options): 381 def GenerateTestReport(options):
369 bb_annotations.PrintNamedStep('test_report') 382 bb_annotations.PrintNamedStep('test_report')
370 for report in glob.glob( 383 for report in glob.glob(
371 os.path.join(CHROME_SRC, 'out', options.target, 'test_logs', '*.log')): 384 os.path.join(CHROME_OUT_DIR, options.target, 'test_logs', '*.log')):
372 RunCmd(['cat', report]) 385 RunCmd(['cat', report])
373 os.remove(report) 386 os.remove(report)
374 387
375 388
376 def MainTestWrapper(options): 389 def MainTestWrapper(options):
377 try: 390 try:
378 # Spawn logcat monitor 391 # Spawn logcat monitor
379 SpawnLogcatMonitor() 392 SpawnLogcatMonitor()
380 393
381 # Run all device setup steps 394 # Run all device setup steps
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 if args: 454 if args:
442 return sys.exit('Unused args %s' % args) 455 return sys.exit('Unused args %s' % args)
443 456
444 unknown_tests = set(options.test_filter) - VALID_TESTS 457 unknown_tests = set(options.test_filter) - VALID_TESTS
445 if unknown_tests: 458 if unknown_tests:
446 return sys.exit('Unknown tests %s' % list(unknown_tests)) 459 return sys.exit('Unknown tests %s' % list(unknown_tests))
447 460
448 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) 461 setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
449 if options.coverage_bucket: 462 if options.coverage_bucket:
450 setattr(options, 'coverage_dir', 463 setattr(options, 'coverage_dir',
451 os.path.join(CHROME_SRC, 'out', options.target, 'coverage')) 464 os.path.join(CHROME_OUT_DIR, options.target, 'coverage'))
452 465
453 MainTestWrapper(options) 466 MainTestWrapper(options)
454 467
455 468
456 if __name__ == '__main__': 469 if __name__ == '__main__':
457 sys.exit(main(sys.argv)) 470 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/buildbot/bb_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698