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 | 5 |
6 import os | 6 import os |
7 import shlex | 7 import shlex |
8 import sys | 8 import sys |
9 import tempfile | 9 import tempfile |
10 import time | 10 import time |
11 | 11 |
12 import android_commands | 12 import android_commands |
13 import constants | 13 import constants |
14 from android_commands import errors | 14 from android_commands import errors |
15 from test_package import TestPackage | 15 from test_package import TestPackage |
16 from pylib import pexpect | 16 from pylib import pexpect |
17 | 17 |
18 class TestPackageApk(TestPackage): | 18 class TestPackageApk(TestPackage): |
19 """A helper class for running APK-based native tests. | 19 """A helper class for running APK-based native tests. |
20 | 20 |
21 Args: | 21 Args: |
22 adb: ADB interface the tests are using. | 22 adb: ADB interface the tests are using. |
23 device: Device to run the tests. | 23 device: Device to run the tests. |
24 test_suite: A specific test suite to run, empty to run all. | 24 test_suite: A specific test suite to run, empty to run all. |
25 timeout: Timeout for each test. | 25 timeout: Timeout for each test. |
26 rebaseline: Whether or not to run tests in isolation and update the filter. | |
27 performance_test: Whether or not performance test(s). | 26 performance_test: Whether or not performance test(s). |
28 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. |
29 tool: Name of the Valgrind tool. | 28 tool: Name of the Valgrind tool. |
30 dump_debug_info: A debug_info object. | 29 dump_debug_info: A debug_info object. |
31 """ | 30 """ |
32 | 31 |
33 def __init__(self, adb, device, test_suite, timeout, rebaseline, | 32 def __init__(self, adb, device, test_suite, timeout, |
34 performance_test, cleanup_test_files, tool, | 33 performance_test, cleanup_test_files, tool, |
35 dump_debug_info): | 34 dump_debug_info): |
36 TestPackage.__init__(self, adb, device, test_suite, timeout, | 35 TestPackage.__init__(self, adb, device, test_suite, timeout, |
37 rebaseline, performance_test, cleanup_test_files, | 36 performance_test, cleanup_test_files, |
38 tool, dump_debug_info) | 37 tool, dump_debug_info) |
39 | 38 |
40 def _CreateTestRunnerScript(self, options): | 39 def _CreateTestRunnerScript(self, options): |
41 command_line_file = tempfile.NamedTemporaryFile() | 40 command_line_file = tempfile.NamedTemporaryFile() |
42 # GTest expects argv[0] to be the executable path. | 41 # GTest expects argv[0] to be the executable path. |
43 command_line_file.write(self.test_suite_basename + ' ' + options) | 42 command_line_file.write(self.test_suite_basename + ' ' + options) |
44 command_line_file.flush() | 43 command_line_file.flush() |
45 self.adb.PushIfNeeded(command_line_file.name, | 44 self.adb.PushIfNeeded(command_line_file.name, |
46 constants.TEST_EXECUTABLE_DIR + | 45 constants.TEST_EXECUTABLE_DIR + |
47 '/chrome-native-tests-command-line') | 46 '/chrome-native-tests-command-line') |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 self.tool.CopyFiles() | 114 self.tool.CopyFiles() |
116 # Always uninstall the previous one (by activity name); we don't | 115 # Always uninstall the previous one (by activity name); we don't |
117 # know what was embedded in it. | 116 # know what was embedded in it. |
118 self.adb.ManagedInstall(self.test_suite_full, False, | 117 self.adb.ManagedInstall(self.test_suite_full, False, |
119 package_name='org.chromium.native_test') | 118 package_name='org.chromium.native_test') |
120 | 119 |
121 def _GetTestSuiteBaseName(self): | 120 def _GetTestSuiteBaseName(self): |
122 """Returns the base name of the test suite.""" | 121 """Returns the base name of the test suite.""" |
123 # APK test suite names end with '-debug.apk' | 122 # APK test suite names end with '-debug.apk' |
124 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 123 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] |
OLD | NEW |