Index: build/android/pylib/browsertests/dispatch.py |
diff --git a/build/android/pylib/browsertests/dispatch.py b/build/android/pylib/browsertests/dispatch.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8f80f0072931330f319d22e8cc0edc01e8bff7be |
--- /dev/null |
+++ b/build/android/pylib/browsertests/dispatch.py |
@@ -0,0 +1,57 @@ |
+# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import logging |
+import os |
+ |
+from pylib import android_commands |
+from pylib import cmd_helper |
+from pylib import ports |
+from pylib.browsertests import test_sharder |
+ |
+CONTENT_BROWSERTEST_SUITENAME = 'content_browsertests' |
+ |
+def Dispatch(options): |
+ attached_devices = [] |
+ if options.test_device: |
+ attached_devices = [options.test_device] |
+ else: |
+ attached_devices = android_commands.GetAttachedDevices() |
+ |
+ if not attached_devices: |
+ logging.critical('A device must be attached and online.') |
+ return 1 |
+ |
+ if options.gtest_filter: |
craigdh
2013/02/20 23:45:30
You won't need this after merging with the new sha
|
+ logging.warning('Sharding is not possible with these configurations.') |
+ attached_devices = [attached_devices[0]] |
+ |
+ # Reset the test port allocation. It's important to do it before starting |
+ # to dispatch any tests. |
+ if not ports.ResetTestServerPortAllocation(): |
+ raise Exception('Failed to reset test server port.') |
+ |
+ test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(), |
+ options.build_type) |
+ options.test_suite = os.path.join(test_suite_dir, |
+ 'apks', |
+ CONTENT_BROWSERTEST_SUITENAME + '.apk') |
+ sharder = test_sharder.TestSharder( |
+ attached_devices, |
+ options.test_suite, |
+ options.gtest_filter, |
+ options.test_arguments, |
+ options.timeout, |
+ options.cleanup_test_files, |
+ options.tool, |
+ options.build_type, |
+ options.webkit) |
+ |
+ test_results = sharder.RunShardedTests() |
+ test_results.LogFull( |
+ test_type='Unit test', |
+ test_package=CONTENT_BROWSERTEST_SUITENAME, |
+ build_type=options.build_type, |
+ flakiness_server=options.flakiness_dashboard_server) |
+ test_results.PrintAnnotation() |