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

Unified Diff: build/android/base_test_runner.py

Issue 9494007: Upstream test sharder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: N emulators launched asynchronously Created 8 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/base_test_sharder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/base_test_runner.py
diff --git a/build/android/base_test_runner.py b/build/android/base_test_runner.py
index bb0316bb146ec7deab831c75472983a0b9f12b7f..5f25694bc5118dd062ca4d1a845b0951267c66f2 100644
--- a/build/android/base_test_runner.py
+++ b/build/android/base_test_runner.py
@@ -19,12 +19,17 @@ TEST_SYNC_SERVER_PORT = 8003
class BaseTestRunner(object):
- """Base class for running tests on a single device."""
+ """Base class for running tests on a single device.
- def __init__(self, device):
+ A subclass should implement RunTests() with no parameter, so that calling
+ the Run() method will set up tests, run them and tear them down.
+ """
+
+ def __init__(self, device, shard_index):
"""
Args:
device: Tests will run on the device of this ID.
+ shard_index: Index number of the shard on which the test suite will run.
"""
self.device = device
self.adb = android_commands.AndroidCommands(device=device)
@@ -41,17 +46,28 @@ class BaseTestRunner(object):
self.forwarder_base_url = ('http://localhost:%d' %
self._forwarder_device_port)
self.flags = FlagChanger(self.adb)
+ self.shard_index = shard_index
- def RunTests(self):
- # TODO(bulach): this should actually do SetUp / RunTestsInternal / TearDown.
- # Refactor the various subclasses to expose a RunTestsInternal without
- # any params.
- raise NotImplementedError
+ def Run(self):
+ """Calls subclass functions to set up tests, run them and tear them down.
+
+ Returns:
+ Test results returned from RunTests().
+ """
+ self.SetUp()
+ try:
+ return self.RunTests()
+ finally:
+ self.TearDown()
def SetUp(self):
"""Called before tests run."""
pass
+ def RunTests(self):
+ """Runs the tests. Need to be overridden."""
+ raise NotImplementedError
+
def TearDown(self):
"""Called when tests finish running."""
self.ShutdownHelperToolsForTestSuite()
« no previous file with comments | « no previous file | build/android/base_test_sharder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698