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

Unified Diff: build/android/pylib/base/base_test_runner.py

Issue 12378048: [Android] Switch instrumentation tests to the new shard/runner paradigm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add retries to the end of the queue instead of the beginning 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_sharder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/base/base_test_runner.py
diff --git a/build/android/pylib/base/base_test_runner.py b/build/android/pylib/base/base_test_runner.py
index a4172ddf33eac3d27932d7a48eced92ef10122fb..368ae9ecf487bf9539ec39459ce8f3cc1e64539a 100644
--- a/build/android/pylib/base/base_test_runner.py
+++ b/build/android/pylib/base/base_test_runner.py
@@ -32,7 +32,7 @@ class BaseTestRunner(object):
the Run() method will set up tests, run them and tear them down.
"""
- def __init__(self, device, tool, shard_index, build_type):
+ def __init__(self, device, tool, build_type):
"""
Args:
device: Tests will run on the device of this ID.
@@ -48,7 +48,6 @@ class BaseTestRunner(object):
self.forwarder_base_url = ('http://localhost:%d' %
self._forwarder_device_port)
self.flags = FlagChanger(self.adb)
- self.shard_index = shard_index
self.flags.AddFlags(['--disable-fre'])
self._spawning_server = None
self._spawner_forwarder = None
@@ -66,34 +65,23 @@ class BaseTestRunner(object):
'%d:%d' % (self.test_server_spawner_port,
self.test_server_port))
- def Run(self):
- """Calls subclass functions to set up tests, run them and tear them down.
+ def RunTest(self, test):
+ """Runs a test. Needs to be overridden.
+
+ Args:
+ test: A test to run.
Returns:
- Test results returned from RunTests().
+ Tuple containing: (test_result.TestResults, tests to rerun or None)
"""
- if not self.HasTests():
- return True
- self.SetUp()
- try:
- return self.RunTests()
- finally:
- self.TearDown()
+ raise NotImplementedError
def SetUp(self):
- """Called before tests run."""
+ """Run once before all tests are run."""
Forwarder.KillDevice(self.adb, self.tool)
- def HasTests(self):
- """Whether the test suite has tests to run."""
- return True
-
- def RunTests(self):
- """Runs the tests. Need to be overridden."""
- raise NotImplementedError
-
def TearDown(self):
- """Called when tests finish running."""
+ """Run once after all tests are run."""
self.ShutdownHelperToolsForTestSuite()
def CopyTestData(self, test_data_paths, dest_dir):
@@ -170,6 +158,8 @@ class BaseTestRunner(object):
# to as they are clients potentially with open connections and to allow for
# proper hand-shake/shutdown.
Forwarder.KillDevice(self.adb, self.tool)
+ if self._forwarder:
+ self._forwarder.Close()
if self._http_server:
self._http_server.ShutdownHttpServer()
if self._spawning_server:
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_sharder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698