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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 @property | 113 @property |
114 def sanitizer(self): | 114 def sanitizer(self): |
115 """Sanitizer to use, if any.""" | 115 """Sanitizer to use, if any.""" |
116 return self.values["sanitizer"] | 116 return self.values["sanitizer"] |
117 | 117 |
118 @property | 118 @property |
119 def test_types(self): | 119 def test_types(self): |
120 """List of test types to run.""" | 120 """List of test types to run.""" |
121 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) | 121 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) |
| 122 |
| 123 # Utility methods ------------------------------------------------------------ |
| 124 |
| 125 def match_target_os(self, selector): |
| 126 """Returns whether the current config matches the target os selector. |
| 127 |
| 128 |selector| is a list of strings. Each string is either: |
| 129 * : matches everything. |
| 130 target_os : matches the given target os. |
| 131 !* : rejects everything |
| 132 !target_os : rejects the given target os. |
| 133 |
| 134 The last matching selector is considered. If no selector match, the config |
| 135 matches. |
| 136 """ |
| 137 for match in reversed(selector): |
| 138 invert = match[0] == "!" |
| 139 if invert: |
| 140 match = match[1:] |
| 141 if match == "*" or self.target_os == match: |
| 142 return not invert |
| 143 return True |
OLD | NEW |