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

Unified Diff: build/android/pylib/uiautomator/setup.py

Issue 18770008: [Android] Redesigns the sharder to allow replicated vs distributed tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-adds -f short form to gtest_filter switch Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/uiautomator/dispatch.py ('k') | build/android/pylib/uiautomator/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/uiautomator/setup.py
diff --git a/build/android/pylib/uiautomator/dispatch.py b/build/android/pylib/uiautomator/setup.py
similarity index 29%
rename from build/android/pylib/uiautomator/dispatch.py
rename to build/android/pylib/uiautomator/setup.py
index fafb2ac7ccf8360292effe1d1200f9d8a58a2645..baa216eaae5820c34f67eba7c699b6bb24f256ab 100644
--- a/build/android/pylib/uiautomator/dispatch.py
+++ b/build/android/pylib/uiautomator/setup.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Dispatches the uiautomator tests."""
+"""Generates test runner factory and tests for uiautomator tests."""
import logging
import os
@@ -10,48 +10,49 @@ import os
from pylib import android_commands
from pylib import constants
from pylib.base import base_test_result
-from pylib.base import shard
from pylib.utils import report_results
import test_package
import test_runner
-def Dispatch(options):
- """Dispatches uiautomator tests onto connected device(s).
-
- If possible, this method will attempt to shard the tests to
- all connected devices. Otherwise, dispatch and run tests on one device.
+def Setup(uiautomator_jar, uiautomator_info_jar, annotations,
+ exclude_annotations, test_filter, package_name, build_type, test_data,
+ save_perf_json, screenshot_failures, tool, disable_assertions,
+ push_deps, cleanup_test_files):
+ """Runs uiautomator tests on connected device(s).
Args:
- options: Command line options.
+ uiautomator_jar: Location of the jar file with the uiautomator test suite.
+ uiautomator_info_jar: Info jar accompanying the jar.
+ annotations: Annotations for the tests.
+ exclude_annotations: Any annotations to exclude from running.
+ test_filter: Filter string for tests.
+ package_name: Application package name under test.
+ build_type: 'Release' or 'Debug'.
+ test_data: Location of the test data.
+ save_perf_json: Whether or not to save the JSON file from UI perf tests.
+ screenshot_failures: Take a screenshot for a test failure
+ tool: Name of the Valgrind tool.
+ disable_assertions: Whether to disable java assertions on the device.
+ push_deps: If True, push all dependencies to the device.
+ cleanup_test_files: Whether or not to cleanup test files on device.
Returns:
- A tuple of (base_test_result.TestRunResults object, exit code)
-
- Raises:
- Exception: when there are no attached devices.
+ A tuple of (TestRunnerFactory, tests).
"""
test_pkg = test_package.TestPackage(
- options.uiautomator_jar, options.uiautomator_info_jar)
+ uiautomator_jar, uiautomator_info_jar)
tests = test_pkg._GetAllMatchingTests(
- options.annotations, options.exclude_annotations, options.test_filter)
+ annotations, exclude_annotations, test_filter)
+
if not tests:
logging.error('No uiautomator tests to run with current args.')
- return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE)
-
- attached_devices = android_commands.GetAttachedDevices()
- if not attached_devices:
- raise Exception('There are no devices online.')
-
- if options.test_device:
- assert options.test_device in attached_devices
- attached_devices = [options.test_device]
def TestRunnerFactory(device, shard_index):
return test_runner.TestRunner(
- options, device, shard_index, test_pkg, [])
+ package_name, build_type, test_data, save_perf_json,
+ screenshot_failures, tool, False, disable_assertions, push_deps,
+ cleanup_test_files, device, shard_index, test_pkg, [])
- return shard.ShardAndRunTests(TestRunnerFactory, attached_devices,
- tests, options.build_type,
- num_retries=options.num_retries)
+ return (TestRunnerFactory, tests)
« no previous file with comments | « build/android/pylib/uiautomator/dispatch.py ('k') | build/android/pylib/uiautomator/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698