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

Side by Side Diff: build/android/pylib/browsertests/dispatch.py

Issue 12263024: Android: Add test runner scripts to run content_browsertests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused browsertests/test_sharder.py Created 7 years, 10 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
OLDNEW
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging
6 import os
7
8 from pylib import android_commands
9 from pylib import cmd_helper
10 from pylib import constants
11 from pylib import ports
12 from pylib.base import shard
13 from pylib.gtest import test_runner
14 from pylib.gtest import dispatch as gtest_dispatch
15
16 CONTENT_BROWSERTEST_SUITENAME = 'content_browsertests'
17
18 def Dispatch(options):
19 attached_devices = []
20 if options.test_device:
21 attached_devices = [options.test_device]
22 else:
23 attached_devices = android_commands.GetAttachedDevices()
24
25 if not attached_devices:
26 logging.critical('A device must be attached and online.')
27 return 1
28
29 if options.gtest_filter:
craigdh 2013/02/21 00:26:02 This isn't needed.
nilesh 2013/02/21 18:04:13 Removed.
30 logging.warning('Sharding is not possible with these configurations.')
31 attached_devices = [attached_devices[0]]
32
33 # Reset the test port allocation. It's important to do it before starting
34 # to dispatch any tests.
35 if not ports.ResetTestServerPortAllocation():
36 raise Exception('Failed to reset test server port.')
37
38 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(),
39 options.build_type)
40 options.test_suite = os.path.join(test_suite_dir,
41 'apks',
42 CONTENT_BROWSERTEST_SUITENAME + '.apk')
43
44 options.test_arguments = '--single_process %s' % options.test_arguments
45 # Constructs a new TestRunner with the current options.
46 def RunnerFactory(device):
47 return test_runner.TestRunner(
48 device,
49 options.test_suite,
50 options.test_arguments,
51 options.timeout,
52 options.cleanup_test_files,
53 options.tool,
54 options.build_type,
55 options.webkit,
56 constants.BROWSERTEST_TEST_PACKAGE_NAME,
57 constants.BROWSERTEST_TEST_ACTIVITY_NAME,
58 constants.BROWSERTEST_COMMAND_LINE_FILE)
59
60 # Get tests and split them up based on the number of devices.
61 if options.gtest_filter:
62 all_tests = [t for t in options.gtest_filter.split(':') if t]
63 else:
64 all_tests = gtest_dispatch.GetAllEnabledTests(RunnerFactory,
65 attached_devices)
66
67 # Run tests.
68 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices,
69 all_tests, options.build_type)
70 test_results.LogFull(
71 test_type='Unit test',
72 test_package=CONTENT_BROWSERTEST_SUITENAME,
73 build_type=options.build_type,
74 flakiness_server=options.flakiness_dashboard_server)
75 test_results.PrintAnnotation()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698