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

Side by Side Diff: build/android/single_test_runner.py

Issue 9185043: Increase Android test robustness. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove 'ALWAYS' Created 8 years, 11 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 | « build/android/run_tests.py ('k') | build/android/test_package.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) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 logging 5 import logging
6 import os 6 import os
7 import sys 7 import sys
8 8
9 from base_test_runner import BaseTestRunner 9 from base_test_runner import BaseTestRunner
10 import debug_info 10 import debug_info
(...skipping 13 matching lines...) Expand all
24 timeout: Timeout for each test. 24 timeout: Timeout for each test.
25 rebaseline: Whether or not to run tests in isolation and update the filter. 25 rebaseline: Whether or not to run tests in isolation and update the filter.
26 performance_test: Whether or not performance test(s). 26 performance_test: Whether or not performance test(s).
27 cleanup_test_files: Whether or not to cleanup test files on device. 27 cleanup_test_files: Whether or not to cleanup test files on device.
28 tool: Name of the Valgrind tool. 28 tool: Name of the Valgrind tool.
29 dump_debug_info: Whether or not to dump debug information. 29 dump_debug_info: Whether or not to dump debug information.
30 """ 30 """
31 31
32 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, 32 def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout,
33 rebaseline, performance_test, cleanup_test_files, tool, 33 rebaseline, performance_test, cleanup_test_files, tool,
34 dump_debug_info=False): 34 dump_debug_info=False,
35 fast_and_loose=False):
35 BaseTestRunner.__init__(self, device) 36 BaseTestRunner.__init__(self, device)
36 self._running_on_emulator = self.device.startswith('emulator') 37 self._running_on_emulator = self.device.startswith('emulator')
37 self._gtest_filter = gtest_filter 38 self._gtest_filter = gtest_filter
38 self._test_arguments = test_arguments 39 self._test_arguments = test_arguments
39 self.test_results = TestResults() 40 self.test_results = TestResults()
40 if dump_debug_info: 41 if dump_debug_info:
41 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device, 42 self.dump_debug_info = debug_info.GTestDebugInfo(self.adb, device,
42 os.path.basename(test_suite), gtest_filter) 43 os.path.basename(test_suite), gtest_filter)
43 else: 44 else:
44 self.dump_debug_info = None 45 self.dump_debug_info = None
46 self.fast_and_loose = fast_and_loose
45 47
46 self.test_package = TestPackageExecutable(self.adb, device, 48 self.test_package = TestPackageExecutable(self.adb, device,
47 test_suite, timeout, rebaseline, performance_test, cleanup_test_files, 49 test_suite, timeout, rebaseline, performance_test, cleanup_test_files,
48 tool, self.dump_debug_info) 50 tool, self.dump_debug_info)
49 51
50 def _GetHttpServerDocumentRootForTestSuite(self): 52 def _GetHttpServerDocumentRootForTestSuite(self):
51 """Returns the document root needed by the test suite.""" 53 """Returns the document root needed by the test suite."""
52 if self.test_package.test_suite_basename == 'page_cycler_tests': 54 if self.test_package.test_suite_basename == 'page_cycler_tests':
53 return os.path.join(run_tests_helper.CHROME_DIR, 'data', 'page_cycler') 55 return os.path.join(run_tests_helper.CHROME_DIR, 'data', 'page_cycler')
54 return None 56 return None
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if document_root: 200 if document_root:
199 self.LaunchTestHttpServer(document_root) 201 self.LaunchTestHttpServer(document_root)
200 if self._TestSuiteRequiresMockTestServer(): 202 if self._TestSuiteRequiresMockTestServer():
201 self.LaunchChromeTestServerSpawner() 203 self.LaunchChromeTestServerSpawner()
202 204
203 def StripAndCopyFiles(self): 205 def StripAndCopyFiles(self):
204 """Strips and copies the required data files for the test suite.""" 206 """Strips and copies the required data files for the test suite."""
205 self.test_package.StripAndCopyExecutable() 207 self.test_package.StripAndCopyExecutable()
206 self.test_package.tool.CopyFiles() 208 self.test_package.tool.CopyFiles()
207 test_data = self.GetDataFilesForTestSuite() 209 test_data = self.GetDataFilesForTestSuite()
208 if test_data: 210 if test_data and not self.fast_and_loose:
209 if self.test_package.test_suite_basename == 'page_cycler_tests': 211 if self.test_package.test_suite_basename == 'page_cycler_tests':
210 # Since the test data for page cycler are huge (around 200M), we use 212 # Since the test data for page cycler are huge (around 200M), we use
211 # sdcard to store the data and create symbol links to map them to 213 # sdcard to store the data and create symbol links to map them to
212 # data/local/tmp/ later. 214 # data/local/tmp/ later.
213 self.CopyTestData(test_data, '/sdcard/') 215 self.CopyTestData(test_data, '/sdcard/')
214 for p in [os.path.dirname(d) for d in test_data if os.path.isdir(d)]: 216 for p in [os.path.dirname(d) for d in test_data if os.path.isdir(d)]:
215 mapped_device_path = '/data/local/tmp/' + p 217 mapped_device_path = '/data/local/tmp/' + p
216 # Unlink the mapped_device_path at first in case it was mapped to 218 # Unlink the mapped_device_path at first in case it was mapped to
217 # a wrong path. Add option '-r' becuase the old path could be a dir. 219 # a wrong path. Add option '-r' becuase the old path could be a dir.
218 self.adb.RunShellCommand('rm -r %s' % mapped_device_path) 220 self.adb.RunShellCommand('rm -r %s' % mapped_device_path)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 307
306 Returns: 308 Returns:
307 A TestResults object. 309 A TestResults object.
308 """ 310 """
309 self.SetUp() 311 self.SetUp()
310 try: 312 try:
311 self._RunTestsForSuiteInternal() 313 self._RunTestsForSuiteInternal()
312 finally: 314 finally:
313 self.TearDown() 315 self.TearDown()
314 return self.test_results 316 return self.test_results
OLDNEW
« no previous file with comments | « build/android/run_tests.py ('k') | build/android/test_package.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698