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

Side by Side Diff: build/android/pylib/base/test_dispatcher.py

Issue 19537004: [Android] Converts host driven tests to common test_dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharding_refactoring
Patch Set: Converts --official-build into a boolean flag Created 7 years, 4 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
OLDNEW
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 """Dispatches tests, either sharding or replicating them. 5 """Dispatches tests, either sharding or replicating them.
6 6
7 To dispatch, performs the following steps: 7 To dispatch, performs the following steps:
8 * Create a test collection factory, using the given tests 8 * Create a test collection factory, using the given tests
9 - If sharding: test collection factory returns the same shared test collection 9 - If sharding: test collection factory returns the same shared test collection
10 to all test runners 10 to all test runners
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if not tests: 364 if not tests:
365 logging.error('No tests to run.') 365 logging.error('No tests to run.')
366 return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE) 366 return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE)
367 367
368 if shard: 368 if shard:
369 # Generate a shared _TestCollection object for all test runners, so they 369 # Generate a shared _TestCollection object for all test runners, so they
370 # draw from a common pool of tests. 370 # draw from a common pool of tests.
371 shared_test_collection = _TestCollection([_Test(t) for t in tests]) 371 shared_test_collection = _TestCollection([_Test(t) for t in tests])
372 test_collection_factory = lambda: shared_test_collection 372 test_collection_factory = lambda: shared_test_collection
373 tag_results_with_device = False 373 tag_results_with_device = False
374 log_string = 'sharded across devices'
374 else: 375 else:
375 # Generate a unique _TestCollection object for each test runner, but use 376 # Generate a unique _TestCollection object for each test runner, but use
376 # the same set of tests. 377 # the same set of tests.
377 test_collection_factory = lambda: _TestCollection([_Test(t) for t in tests]) 378 test_collection_factory = lambda: _TestCollection([_Test(t) for t in tests])
378 tag_results_with_device = True 379 tag_results_with_device = True
380 log_string = 'replicated on each device'
379 381
380 devices = _GetAttachedDevices(wait_for_debugger, test_device) 382 devices = _GetAttachedDevices(wait_for_debugger, test_device)
381 383
382 logging.info('Will run %d tests: %s', len(tests), str(tests)) 384 logging.info('Will run %d tests (%s): %s', len(tests), log_string, str(tests))
383 runners = _CreateRunners(runner_factory, devices, setup_timeout) 385 runners = _CreateRunners(runner_factory, devices, setup_timeout)
384 try: 386 try:
385 return _RunAllTests(runners, test_collection_factory, 387 return _RunAllTests(runners, test_collection_factory,
386 num_retries, test_timeout, tag_results_with_device) 388 num_retries, test_timeout, tag_results_with_device)
387 finally: 389 finally:
388 try: 390 try:
389 _TearDownRunners(runners, setup_timeout) 391 _TearDownRunners(runners, setup_timeout)
390 except android_commands.errors.DeviceUnresponsiveError as e: 392 except android_commands.errors.DeviceUnresponsiveError as e:
391 logging.warning('Device unresponsive during TearDown: [%s]', e) 393 logging.warning('Device unresponsive during TearDown: [%s]', e)
OLDNEW
« no previous file with comments | « build/android/pylib/base/sharded_tests_queue.py ('k') | build/android/pylib/host_driven/java_unittest_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698