| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 Returns: | 55 Returns: |
| 56 An instance of pexpect spawn class. | 56 An instance of pexpect spawn class. |
| 57 """ | 57 """ |
| 58 raise NotImplementedError('Method must be overriden.') | 58 raise NotImplementedError('Method must be overriden.') |
| 59 | 59 |
| 60 def Install(self): | 60 def Install(self): |
| 61 """Install the test package to the device.""" | 61 """Install the test package to the device.""" |
| 62 raise NotImplementedError('Method must be overriden.') | 62 raise NotImplementedError('Method must be overriden.') |
| 63 | 63 |
| 64 def GetDisabledPrefixes(self): | 64 def _ParseGTestListTests(self, raw_list): |
| 65 return ['DISABLED_', 'FLAKY_', 'FAILS_'] | 65 """Parses a raw test list as provided by --gtest_list_tests. |
| 66 | |
| 67 def _ParseGTestListTests(self, all_tests): | |
| 68 """Parses and filters the raw test lists. | |
| 69 | 66 |
| 70 Args: | 67 Args: |
| 71 all_tests: The raw test listing with the following format: | 68 raw_list: The raw test listing with the following format: |
| 72 | 69 |
| 73 IPCChannelTest. | 70 IPCChannelTest. |
| 74 SendMessageInChannelConnected | 71 SendMessageInChannelConnected |
| 75 IPCSyncChannelTest. | 72 IPCSyncChannelTest. |
| 76 Simple | 73 Simple |
| 77 DISABLED_SendWithTimeoutMixedOKAndTimeout | 74 DISABLED_SendWithTimeoutMixedOKAndTimeout |
| 78 | 75 |
| 79 Returns: | 76 Returns: |
| 80 A list of non-disabled tests. For the above raw listing: | 77 A list of all tests. For the above raw listing: |
| 81 | 78 |
| 82 [IPCChannelTest.SendMessageInChannelConnected, IPCSyncChannelTest.Simple] | 79 [IPCChannelTest.SendMessageInChannelConnected, IPCSyncChannelTest.Simple, |
| 80 IPCSyncChannelTest.DISABLED_SendWithTimeoutMixedOKAndTimeout] |
| 83 """ | 81 """ |
| 84 ret = [] | 82 ret = [] |
| 85 current = '' | 83 current = '' |
| 86 disabled_prefixes = self.GetDisabledPrefixes() | 84 for test in raw_list: |
| 87 for test in all_tests: | |
| 88 if not test: | 85 if not test: |
| 89 continue | 86 continue |
| 90 if test[0] != ' ' and not test.endswith('.'): | 87 if test[0] != ' ' and not test.endswith('.'): |
| 91 # Ignore any lines with unexpected format. | 88 # Ignore any lines with unexpected format. |
| 92 continue | 89 continue |
| 93 if test[0] != ' ' and test.endswith('.'): | 90 if test[0] != ' ' and test.endswith('.'): |
| 94 current = test | 91 current = test |
| 95 continue | 92 continue |
| 96 if 'YOU HAVE' in test: | 93 if 'YOU HAVE' in test: |
| 97 break | 94 break |
| 98 test_name = test[2:] | 95 test_name = test[2:] |
| 99 if not any([test_name.startswith(x) for x in disabled_prefixes]): | 96 ret += [current + test_name] |
| 100 ret += [current + test_name] | |
| 101 return ret | 97 return ret |
| OLD | NEW |