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 """Base class representing GTest test packages.""" | 5 """Base class representing GTest test packages.""" |
6 | 6 |
7 import os | 7 import os |
8 | 8 |
9 from pylib import constants | 9 from pylib import constants |
10 | 10 |
11 | 11 |
12 class TestPackage(object): | 12 class TestPackage(object): |
13 """A helper base class for both APK and stand-alone executables. | 13 """A helper base class for both APK and stand-alone executables. |
14 | 14 |
15 Args: | 15 Args: |
16 adb: ADB interface the tests are using. | 16 adb: ADB interface the tests are using. |
17 device: Device to run the tests. | 17 device: Device to run the tests. |
18 test_suite: A specific test suite to run, empty to run all. | 18 suite_path_full: Absolute path to a specific test suite to run, |
| 19 empty to run all. |
| 20 Ex: '/foo/bar/base_unittests-debug.apk', for which |
| 21 self.suite_path_full = '/foo/bar/base_unittests-debug.apk' |
| 22 self.suite_path = '/foo/bar/base_unittests-debug' |
| 23 self.suite_basename = 'base_unittests' |
| 24 self.suite_dirname = '/foo/bar' |
19 tool: Name of the Valgrind tool. | 25 tool: Name of the Valgrind tool. |
20 """ | 26 """ |
21 | 27 |
22 def __init__(self, adb, device, test_suite, tool): | 28 def __init__(self, adb, device, suite_path_full, tool): |
23 self.adb = adb | 29 self.adb = adb |
24 self.device = device | 30 self.device = device |
25 self.test_suite_full = test_suite | 31 self.suite_path_full = suite_path_full |
26 self.test_suite = os.path.splitext(test_suite)[0] | 32 self.suite_path = os.path.splitext(suite_path_full)[0] |
27 self.test_suite_basename = self._GetTestSuiteBaseName() | 33 self.suite_basename = self._GetTestSuiteBaseName() |
28 self.test_suite_dirname = os.path.dirname( | 34 self.suite_dirname = os.path.dirname( |
29 self.test_suite.split(self.test_suite_basename)[0]) | 35 self.suite_path.split(self.suite_basename)[0]) |
30 self.tool = tool | 36 self.tool = tool |
31 | 37 |
32 def ClearApplicationState(self): | 38 def ClearApplicationState(self): |
33 """Clears the application state.""" | 39 """Clears the application state.""" |
34 raise NotImplementedError('Method must be overriden.') | 40 raise NotImplementedError('Method must be overriden.') |
35 | 41 |
36 def CreateCommandLineFileOnDevice(self, test_filter, test_arguments): | 42 def CreateCommandLineFileOnDevice(self, test_filter, test_arguments): |
37 """Creates a test runner script and pushes to the device. | 43 """Creates a test runner script and pushes to the device. |
38 | 44 |
39 Args: | 45 Args: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 # Ignore any lines with unexpected format. | 94 # Ignore any lines with unexpected format. |
89 continue | 95 continue |
90 if test[0] != ' ' and test.endswith('.'): | 96 if test[0] != ' ' and test.endswith('.'): |
91 current = test | 97 current = test |
92 continue | 98 continue |
93 if 'YOU HAVE' in test: | 99 if 'YOU HAVE' in test: |
94 break | 100 break |
95 test_name = test[2:] | 101 test_name = test[2:] |
96 ret += [current + test_name] | 102 ret += [current + test_name] |
97 return ret | 103 return ret |
OLD | NEW |