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 platform | 9 import platform |
10 import sys | 10 import sys |
11 | 11 |
12 | 12 |
13 class Config(object): | 13 class Config(object): |
14 """A Config is basically just a wrapper around a dictionary that species a | 14 """A Config is basically just a wrapper around a dictionary that species a |
15 build/test configuration. The dictionary is accessible through the values | 15 build/test configuration. The dictionary is accessible through the values |
16 member.""" | 16 member.""" |
17 | 17 |
18 # Valid values for target_os (None is also valid): | 18 # Valid values for target_os (None is also valid): |
19 OS_ANDROID = "android" | 19 OS_ANDROID = "android" |
| 20 OS_FNL = "fnl" |
20 OS_IOS = "ios" | 21 OS_IOS = "ios" |
21 OS_LINUX = "linux" | 22 OS_LINUX = "linux" |
22 OS_MAC = "mac" | 23 OS_MAC = "mac" |
23 OS_WINDOWS = "windows" | 24 OS_WINDOWS = "windows" |
24 | 25 |
25 # Valid values for target_cpu (None is also valid): | 26 # Valid values for target_cpu (None is also valid): |
26 ARCH_X86 = "x86" | 27 ARCH_X86 = "x86" |
27 ARCH_X64 = "x64" | 28 ARCH_X64 = "x64" |
28 ARCH_ARM = "arm" | 29 ARCH_ARM = "arm" |
29 | 30 |
30 # Valid values for sanitizer (None is also valid): | 31 # Valid values for sanitizer (None is also valid): |
31 SANITIZER_ASAN = "asan" | 32 SANITIZER_ASAN = "asan" |
32 | 33 |
33 # Standard values for test types (test types are arbitrary strings; other | 34 # Standard values for test types (test types are arbitrary strings; other |
34 # values are allowed). | 35 # values are allowed). |
35 TEST_TYPE_DEFAULT = "default" | 36 TEST_TYPE_DEFAULT = "default" |
36 TEST_TYPE_UNIT = "unit" | 37 TEST_TYPE_UNIT = "unit" |
37 TEST_TYPE_PERF = "perf" | 38 TEST_TYPE_PERF = "perf" |
38 TEST_TYPE_INTEGRATION = "integration" | 39 TEST_TYPE_INTEGRATION = "integration" |
39 | 40 |
40 def __init__(self, target_os=None, target_cpu=None, is_debug=True, | 41 def __init__(self, target_os=None, target_cpu=None, is_debug=True, |
41 is_clang=None, sanitizer=None, dcheck_always_on=False, | 42 is_clang=None, sanitizer=None, dcheck_always_on=False, |
42 is_simulator=False, is_official_build=False, **kwargs): | 43 is_simulator=False, is_official_build=False, **kwargs): |
43 """Constructs a Config with key-value pairs specified via keyword arguments. | 44 """Constructs a Config with key-value pairs specified via keyword arguments. |
44 If target_os is not specified, it will be set to the host OS.""" | 45 If target_os is not specified, it will be set to the host OS.""" |
45 | 46 |
46 assert target_os in (None, Config.OS_ANDROID, Config.OS_IOS, | 47 assert target_os in (None, Config.OS_ANDROID, Config.OS_FNL, |
47 Config.OS_LINUX, Config.OS_MAC, | 48 Config.OS_IOS, Config.OS_LINUX, |
48 Config.OS_WINDOWS) | 49 Config.OS_MAC, Config.OS_WINDOWS) |
49 assert target_cpu in (None, Config.ARCH_X86, Config.ARCH_X64, | 50 assert target_cpu in (None, Config.ARCH_X86, Config.ARCH_X64, |
50 Config.ARCH_ARM) | 51 Config.ARCH_ARM) |
51 assert isinstance(is_debug, bool) | 52 assert isinstance(is_debug, bool) |
52 assert isinstance(is_official_build, bool) | 53 assert isinstance(is_official_build, bool) |
53 assert is_clang is None or isinstance(is_clang, bool) | 54 assert is_clang is None or isinstance(is_clang, bool) |
54 assert sanitizer in (None, Config.SANITIZER_ASAN) | 55 assert sanitizer in (None, Config.SANITIZER_ASAN) |
55 if "test_types" in kwargs: | 56 if "test_types" in kwargs: |
56 assert isinstance(kwargs["test_types"], list) | 57 assert isinstance(kwargs["test_types"], list) |
57 | 58 |
58 self.values = {} | 59 self.values = {} |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 140 |
140 @property | 141 @property |
141 def sanitizer(self): | 142 def sanitizer(self): |
142 """Sanitizer to use, if any.""" | 143 """Sanitizer to use, if any.""" |
143 return self.values["sanitizer"] | 144 return self.values["sanitizer"] |
144 | 145 |
145 @property | 146 @property |
146 def test_types(self): | 147 def test_types(self): |
147 """List of test types to run.""" | 148 """List of test types to run.""" |
148 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) | 149 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) |
OLD | NEW |