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

Side by Side Diff: build/android/pylib/base_test_runner.py

Issue 10896050: Android: Use external storage for test data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/test/test_support_android.cc ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import contextlib 5 import contextlib
6 import httplib 6 import httplib
7 import logging 7 import logging
8 import os 8 import os
9 import tempfile 9 import tempfile
10 import time 10 import time
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 test_data_paths: A list of files or directories relative to |dest_dir| 103 test_data_paths: A list of files or directories relative to |dest_dir|
104 which should be copied to the device. The paths must exist in 104 which should be copied to the device. The paths must exist in
105 |CHROME_DIR|. 105 |CHROME_DIR|.
106 dest_dir: Absolute path to copy to on the device. 106 dest_dir: Absolute path to copy to on the device.
107 """ 107 """
108 for p in test_data_paths: 108 for p in test_data_paths:
109 self.adb.PushIfNeeded( 109 self.adb.PushIfNeeded(
110 os.path.join(constants.CHROME_DIR, p), 110 os.path.join(constants.CHROME_DIR, p),
111 os.path.join(dest_dir, p)) 111 os.path.join(dest_dir, p))
112 112
113 def LinkSdCardPathsToTempDir(self, paths):
114 """Link |paths| which are under sdcard to constants.TEST_DATA_DIR.
115
116 For example, the test data '/sdcard/my_data' will be linked to
117 'TEST_DATA_DIR/my_data'.
118
119 Args:
120 paths: A list of files and directories relative to /sdcard.
121 """
122 links = set()
123 for path in paths:
124 link_name = os.path.dirname(path)
125 assert link_name, 'Linked paths must be in a subdir of /sdcard/.'
126 link_name = link_name.split('/')[0]
127 if link_name not in links:
128 mapped_device_path = constants.TEST_DATA_DIR + '/' + link_name
129 # Unlink the mapped_device_path at first in case it was mapped to
130 # a wrong path. Add option '-r' becuase the old path could be a dir.
131 self.adb.RunShellCommand('rm -r %s' % mapped_device_path)
132 self.adb.RunShellCommand(
133 'ln -s /sdcard/%s %s' % (link_name, mapped_device_path))
134 links.add(link_name)
135
136 def LaunchTestHttpServer(self, document_root, port=None, 113 def LaunchTestHttpServer(self, document_root, port=None,
137 extra_config_contents=None): 114 extra_config_contents=None):
138 """Launches an HTTP server to serve HTTP tests. 115 """Launches an HTTP server to serve HTTP tests.
139 116
140 Args: 117 Args:
141 document_root: Document root of the HTTP server. 118 document_root: Document root of the HTTP server.
142 port: port on which we want to the http server bind. 119 port: port on which we want to the http server bind.
143 extra_config_contents: Extra config contents for the HTTP server. 120 extra_config_contents: Extra config contents for the HTTP server.
144 """ 121 """
145 self._http_server = lighttpd_server.LighttpdServer( 122 self._http_server = lighttpd_server.LighttpdServer(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 # Wait for 2 seconds then restart. 204 # Wait for 2 seconds then restart.
228 time.sleep(2) 205 time.sleep(2)
229 if not server_ready: 206 if not server_ready:
230 logging.error(';'.join(error_msgs)) 207 logging.error(';'.join(error_msgs))
231 raise Exception('Can not start the test spawner server.') 208 raise Exception('Can not start the test spawner server.')
232 self._PushTestServerPortInfoToDevice() 209 self._PushTestServerPortInfoToDevice()
233 self._spawner_forwarder = Forwarder( 210 self._spawner_forwarder = Forwarder(
234 self.adb, 211 self.adb,
235 [(self.test_server_spawner_port, self.test_server_spawner_port)], 212 [(self.test_server_spawner_port, self.test_server_spawner_port)],
236 self.tool, '127.0.0.1', self.build_type) 213 self.tool, '127.0.0.1', self.build_type)
OLDNEW
« no previous file with comments | « base/test/test_support_android.cc ('k') | build/android/pylib/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698