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

Unified Diff: build/android/pylib/run_java_tests.py

Issue 10957052: Adapt python scripts to use the new Forwarder2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
« build/android/pylib/forwarder.py ('K') | « build/android/pylib/forwarder.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/run_java_tests.py
diff --git a/build/android/pylib/run_java_tests.py b/build/android/pylib/run_java_tests.py
index bef6d7a1de736e9c341632a91d45803917c810fb..f08adb3a554237a50be9191fc632442cc41c30f4 100644
--- a/build/android/pylib/run_java_tests.py
+++ b/build/android/pylib/run_java_tests.py
@@ -40,6 +40,8 @@ def _TestNameToExpectation(test_name):
return '.'.join(test_name.replace('#', '.').split('.')[-2:])
+# TODO(jaydeepmehta): FilterTests should be moved to a common file for
bulach 2012/09/24 10:40:49 ditto :) in fact, I think we can remove this, ther
felipeg 2012/09/25 03:27:21 Done.
+# all integration tests.
def FilterTests(test_names, pattern_list, inclusive):
"""Filters |test_names| using a list of patterns.
@@ -65,7 +67,7 @@ def FilterTests(test_names, pattern_list, inclusive):
class TestRunner(BaseTestRunner):
"""Responsible for running a series of tests connected to a single device."""
- _DEVICE_DATA_DIR = constants.TEST_DATA_DIR + '/chrome/test/data'
+ _DEVICE_DATA_DIR = 'chrome/test/data'
_EMMA_JAR = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''),
'external/emma/lib/emma.jar')
_COVERAGE_MERGED_FILENAME = 'unittest_coverage.es'
@@ -130,8 +132,7 @@ class TestRunner(BaseTestRunner):
self.ports_to_forward = ports_to_forward
self.test_results = TestResults()
- # List of forwarders created by this instance of TestRunner.
- self.forwarders = []
+ self.forwarder = None
if self.coverage:
if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME):
@@ -162,11 +163,17 @@ class TestRunner(BaseTestRunner):
logging.warning('Already copied test files to device %s, skipping.',
self.device)
return
- host_test_files_path = (constants.CHROME_DIR +
- '/chrome/test/data/android/device_files')
- if os.path.exists(host_test_files_path):
- self.adb.PushIfNeeded(host_test_files_path,
- TestRunner._DEVICE_DATA_DIR)
+ host_test_files = [
+ ('android_webview/test/data/device_files', 'webview'),
+ ('content/test/data/android/device_files', 'content'),
+ ('chrome/test/data/android/device_files', 'chrome')
+ ]
+ for (host_src, dst_layer) in host_test_files:
+ host_test_files_path = constants.CHROME_DIR + '/' + host_src
+ if os.path.exists(host_test_files_path):
+ self.adb.PushIfNeeded(host_test_files_path,
+ self.adb.GetExternalStorage() + '/' +
+ TestRunner._DEVICE_DATA_DIR + '/' + dst_layer)
if self.install_apk:
for apk in self.apks:
self.adb.ManagedInstall(apk.GetApkPath(),
@@ -237,15 +244,19 @@ class TestRunner(BaseTestRunner):
def _TakeScreenshot(self, test):
"""Takes a screenshot from the device."""
- screenshot_tool = os.path.join(os.getenv('ANDROID_HOST_OUT'), 'bin',
- 'screenshot2')
+ screenshot_tool = os.path.join(constants.CHROME_DIR,
bulach 2012/09/24 10:40:49 don't quite understand this diff, you probably nee
felipeg 2012/09/25 03:27:21 yep, sorry It was some confusion in my git client
+ 'third_party/android_tools/sdk/tools/monkeyrunner')
+ screenshot_script = os.path.join(constants.CHROME_DIR,
+ 'build/android/monkeyrunner_screenshot.py')
screenshot_path = os.path.join(constants.CHROME_DIR,
'out_screenshots')
if not os.path.exists(screenshot_path):
os.mkdir(screenshot_path)
screenshot_name = os.path.join(screenshot_path, test + '.png')
logging.info('Taking screenshot named %s', screenshot_name)
- cmd_helper.RunCmd([screenshot_tool, '-s', self.device, screenshot_name])
+ cmd_helper.RunCmd([screenshot_tool, screenshot_script,
+ '--serial', self.device,
+ '--file', screenshot_name])
def SetUp(self):
"""Sets up the test harness and device before all tests are run."""
@@ -267,19 +278,20 @@ class TestRunner(BaseTestRunner):
self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR),
(constants.LIGHTTPD_RANDOM_PORT_FIRST +
self.shard_index))
-
+ print "====================================== " + str(self.ports_to_forward)
bulach 2012/09/24 10:40:49 spurious?
felipeg 2012/09/25 03:27:21 Done.
+ port_pairs = []
if self.ports_to_forward:
for port in self.ports_to_forward:
- self.forwarders.append(Forwarder(
- self.adb, [(port, port)], self.tool, '127.0.0.1', self.build_type))
+ port_pairs.append([(port, port)])
+ self.forwarder = Forwarder(
+ self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type)
self.CopyTestFilesOnce()
self.flags.AddFlags(['--enable-test-intents'])
def TearDown(self):
"""Cleans up the test harness and saves outstanding data from test run."""
- if self.forwarders:
- for forwarder in self.forwarders:
- forwarder.Close()
+ if self.forwarder:
+ forwarder.Close()
self.GenerateCoverageReportIfNeeded()
super(TestRunner, self).TearDown()
@@ -353,6 +365,7 @@ class TestRunner(BaseTestRunner):
raw_test_name = test.split('#')[1]
# Wait and grab annotation data so we can figure out which traces to parse
+ # TODO(tonyg): Is there an error log line to watch for here?
bulach 2012/09/24 10:40:49 :)
felipeg 2012/09/25 03:27:21 Done.
regex = self.adb.WaitForLogMatch(re.compile('\*\*PERFANNOTATION\(' +
raw_test_name +
'\)\:(.*)'), None)
« build/android/pylib/forwarder.py ('K') | « build/android/pylib/forwarder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698