Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 glob | 5 import glob |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import sys | |
| 8 | 9 |
| 9 from pylib import android_commands | 10 from pylib import android_commands |
| 11 from pylib import cmd_helper | |
| 10 from pylib import constants | 12 from pylib import constants |
| 11 from pylib import perf_tests_helper | 13 from pylib import perf_tests_helper |
| 12 from pylib.android_commands import errors | 14 from pylib.android_commands import errors |
| 13 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
| 14 from pylib.base import base_test_runner | 16 from pylib.base import base_test_runner |
| 15 from pylib.utils import run_tests_helper | 17 from pylib.utils import run_tests_helper |
| 16 | 18 |
| 17 import test_package_apk | 19 import test_package_apk |
| 18 import test_package_executable | 20 import test_package_executable |
| 19 | 21 |
| 22 sys.path.insert( | |
| 23 0, os.path.join(constants.DIR_SOURCE_ROOT, 'tools', 'swarm_client')) | |
| 24 import run_isolated | |
| 20 | 25 |
| 21 def _GetDataFilesForTestSuite(test_suite_basename): | 26 |
| 27 _ISOLATE_FILE_PATHS = { | |
| 28 'base_unittests': 'base/base_unittests.isolate', | |
| 29 #'net_unittests': 'net/net_unittests.isolate', | |
| 30 #'unit_tests': 'chrome/unit_tests.isolate', | |
| 31 #'content_browsertests': 'content/content_browsertests.isolate', | |
| 32 #'content_unittests': 'content/content_unittests.isolate', | |
| 33 } | |
| 34 _ISOLATE_SCRIPT = os.path.join( | |
| 35 constants.DIR_SOURCE_ROOT, 'tools', 'swarm_client', 'isolate.py') | |
| 36 | |
| 37 | |
| 38 def _GetDataFilesForTestSuite(product_dir, test_suite_basename): | |
| 22 """Returns a list of data files/dirs needed by the test suite. | 39 """Returns a list of data files/dirs needed by the test suite. |
| 23 | 40 |
| 24 Args: | 41 Args: |
| 25 test_suite_basename: The test suite basename for which to return file paths. | 42 product_dir: Absolute path to product directory (e.g. /../out/Debug). |
| 43 test_suite_basename: The test suite basename (e.g. base_unittests). | |
| 26 | 44 |
| 27 Returns: | 45 Returns: |
| 28 A list of test file and directory paths. | 46 A list of test file and directory paths. |
| 29 """ | 47 """ |
| 48 # TODO(frankf): *.isolated should be generated by gyp using foo_tests_run | |
| 49 # targets. This is a stop-gap solution as currently there are no such | |
| 50 # targets for content_unittests and content_browsertests. | |
| 51 isolate_rel_path = _ISOLATE_FILE_PATHS.get(test_suite_basename) | |
| 52 if isolate_rel_path: | |
| 53 isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path) | |
| 54 isolated_abs_path = os.path.join( | |
| 55 product_dir, '%s.isolated' % test_suite_basename) | |
| 56 assert os.path.exists(isolate_abs_path) | |
| 57 isolate_cmd = [ | |
| 58 'python', _ISOLATE_SCRIPT, | |
| 59 'check', | |
| 60 '--isolate=%s' % isolate_abs_path, | |
|
csharp
2013/06/28 13:12:17
I don't think you need to specify the .isolate fil
frankf
2013/06/28 18:32:46
There's no isolated file at this point, that's wha
csharp
2013/06/28 19:01:05
Ah, right. I thought you were performing an action
| |
| 61 '--isolated=%s' % isolated_abs_path, | |
| 62 '-V', 'PRODUCT_DIR=%s' % product_dir, | |
| 63 '-V', 'OS=android', | |
| 64 '--outdir=%s' % product_dir, | |
| 65 ] | |
| 66 assert not cmd_helper.RunCmd(isolate_cmd) | |
| 67 with open(isolated_abs_path) as f: | |
| 68 isolated_content = run_isolated.load_isolated(f.read(), | |
| 69 os_flavor='android') | |
| 70 assert isolated_content['os'] == 'android' | |
| 71 return isolated_content['files'].keys() | |
| 72 | |
| 73 logging.info('Did not find an isolate file for the test suite.') | |
| 30 # Ideally, we'd just push all test data. However, it has >100MB, and a lot | 74 # Ideally, we'd just push all test data. However, it has >100MB, and a lot |
| 31 # of the files are not relevant (some are used for browser_tests, others for | 75 # of the files are not relevant (some are used for browser_tests, others for |
| 32 # features not supported, etc..). | 76 # features not supported, etc..). |
| 33 if test_suite_basename == 'base_unittests': | 77 if test_suite_basename == 'unit_tests': |
| 34 return [ | |
| 35 'base/test/data/', | |
| 36 ] | |
| 37 elif test_suite_basename == 'unit_tests': | |
| 38 test_files = [ | 78 test_files = [ |
| 39 'base/test/data/', | 79 'base/test/data/', |
| 40 'chrome/test/data/download-test1.lib', | 80 'chrome/test/data/download-test1.lib', |
| 41 'chrome/test/data/extensions/bad_magic.crx', | 81 'chrome/test/data/extensions/bad_magic.crx', |
| 42 'chrome/test/data/extensions/good.crx', | 82 'chrome/test/data/extensions/good.crx', |
| 43 'chrome/test/data/extensions/icon1.png', | 83 'chrome/test/data/extensions/icon1.png', |
| 44 'chrome/test/data/extensions/icon2.png', | 84 'chrome/test/data/extensions/icon2.png', |
| 45 'chrome/test/data/extensions/icon3.png', | 85 'chrome/test/data/extensions/icon3.png', |
| 46 'chrome/test/data/extensions/allow_silent_upgrade/', | 86 'chrome/test/data/extensions/allow_silent_upgrade/', |
| 47 'chrome/test/data/extensions/app/', | 87 'chrome/test/data/extensions/app/', |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 symbols_dir) | 298 symbols_dir) |
| 259 | 299 |
| 260 #override | 300 #override |
| 261 def InstallTestPackage(self): | 301 def InstallTestPackage(self): |
| 262 self.test_package.StripAndCopyExecutable() | 302 self.test_package.StripAndCopyExecutable() |
| 263 | 303 |
| 264 #override | 304 #override |
| 265 def PushDataDeps(self): | 305 def PushDataDeps(self): |
| 266 self.test_package.PushDataAndPakFiles() | 306 self.test_package.PushDataAndPakFiles() |
| 267 self.tool.CopyFiles() | 307 self.tool.CopyFiles() |
| 268 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_basename) | 308 test_data = _GetDataFilesForTestSuite(self.test_package.test_suite_dirname, |
| 309 self.test_package.test_suite_basename) | |
| 269 if test_data: | 310 if test_data: |
| 270 # Make sure SD card is ready. | 311 # Make sure SD card is ready. |
| 271 self.adb.WaitForSdCardReady(20) | 312 self.adb.WaitForSdCardReady(20) |
| 272 self.CopyTestData(test_data, self.adb.GetExternalStorage()) | 313 self.CopyTestData(test_data, self.adb.GetExternalStorage()) |
| 273 if self.test_package.test_suite_basename == 'webkit_unit_tests': | 314 if self.test_package.test_suite_basename == 'webkit_unit_tests': |
| 274 self.PushWebKitUnitTestsData() | 315 self.PushWebKitUnitTestsData() |
| 275 | 316 |
| 276 def PushWebKitUnitTestsData(self): | 317 def PushWebKitUnitTestsData(self): |
| 277 """Pushes the webkit_unit_tests data files to the device. | 318 """Pushes the webkit_unit_tests data files to the device. |
| 278 | 319 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 self.LaunchChromeTestServerSpawner() | 385 self.LaunchChromeTestServerSpawner() |
| 345 self.tool.SetupEnvironment() | 386 self.tool.SetupEnvironment() |
| 346 | 387 |
| 347 #override | 388 #override |
| 348 def TearDown(self): | 389 def TearDown(self): |
| 349 """Cleans up the test enviroment for the test suite.""" | 390 """Cleans up the test enviroment for the test suite.""" |
| 350 self.tool.CleanUpEnvironment() | 391 self.tool.CleanUpEnvironment() |
| 351 if self._cleanup_test_files: | 392 if self._cleanup_test_files: |
| 352 self.adb.RemovePushedFiles() | 393 self.adb.RemovePushedFiles() |
| 353 super(TestRunner, self).TearDown() | 394 super(TestRunner, self).TearDown() |
| OLD | NEW |