| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Build/test configurations, which are just dictionaries. This | 5 """Build/test configurations, which are just dictionaries. This |
| 6 "defines" the schema and provides some wrappers.""" | 6 "defines" the schema and provides some wrappers.""" |
| 7 | 7 |
| 8 | 8 |
| 9 import json | 9 import json |
| 10 import os.path | 10 import os.path |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 @property | 119 @property |
| 120 def sanitizer(self): | 120 def sanitizer(self): |
| 121 """Sanitizer to use, if any.""" | 121 """Sanitizer to use, if any.""" |
| 122 return self.values["sanitizer"] | 122 return self.values["sanitizer"] |
| 123 | 123 |
| 124 @property | 124 @property |
| 125 def test_types(self): | 125 def test_types(self): |
| 126 """List of test types to run.""" | 126 """List of test types to run.""" |
| 127 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) | 127 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) |
| 128 | |
| 129 # Utility methods ------------------------------------------------------------ | |
| 130 | |
| 131 def match_target_os(self, selector): | |
| 132 """Returns whether the current config matches the target os selector. | |
| 133 | |
| 134 |selector| is a list of strings. Each string is either: | |
| 135 * : matches everything. | |
| 136 target_os : matches the given target os. | |
| 137 !* : rejects everything | |
| 138 !target_os : rejects the given target os. | |
| 139 | |
| 140 The last matching selector is considered. If no selector match, the config | |
| 141 matches. | |
| 142 """ | |
| 143 for match in reversed(selector): | |
| 144 invert = match[0] == "!" | |
| 145 if invert: | |
| 146 match = match[1:] | |
| 147 if match == "*" or self.target_os == match: | |
| 148 return not invert | |
| 149 return True | |
| OLD | NEW |