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

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: Addressed Craig's comments. 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'
frankf 2013/02/21 19:25:50 2 blank lines. Please run gpylint.
nilesh 2013/02/21 20:10:17 Done.
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 # Reset the test port allocation. It's important to do it before starting
30 # to dispatch any tests.
31 if not ports.ResetTestServerPortAllocation():
32 raise Exception('Failed to reset test server port.')
33
34 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(),
35 options.build_type)
36 options.test_suite = os.path.join(test_suite_dir,
37 'apks',
38 CONTENT_BROWSERTEST_SUITENAME + '.apk')
39
40 options.test_arguments = '--single_process %s' % options.test_arguments
41 # Constructs a new TestRunner with the current options.
42 def RunnerFactory(device):
43 return test_runner.TestRunner(
44 device,
45 options.test_suite,
46 options.test_arguments,
47 options.timeout,
48 options.cleanup_test_files,
49 options.tool,
50 options.build_type,
51 options.webkit,
52 constants.BROWSERTEST_TEST_PACKAGE_NAME,
53 constants.BROWSERTEST_TEST_ACTIVITY_NAME,
54 constants.BROWSERTEST_COMMAND_LINE_FILE)
55
56 # Get tests and split them up based on the number of devices.
57 if options.gtest_filter:
58 all_tests = [t for t in options.gtest_filter.split(':') if t]
59 else:
60 all_tests = gtest_dispatch.GetAllEnabledTests(RunnerFactory,
61 attached_devices)
62
63 # Run tests.
64 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices,
65 all_tests, options.build_type)
66 test_results.LogFull(
67 test_type='Unit test',
68 test_package=CONTENT_BROWSERTEST_SUITENAME,
69 build_type=options.build_type,
70 flakiness_server=options.flakiness_dashboard_server)
71 test_results.PrintAnnotation()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698