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_FNL = "fnl" |
21 OS_IOS = "ios" | 21 OS_IOS = "ios" |
22 OS_LINUX = "linux" | 22 OS_LINUX = "linux" |
23 OS_MAC = "mac" | 23 OS_MAC = "mac" |
24 OS_WINDOWS = "windows" | 24 OS_WINDOWS = "windows" |
25 | 25 |
26 # Valid values for target_cpu (None is also valid): | 26 # Valid values for target_cpu (None is also valid): |
27 ARCH_X86 = "x86" | 27 ARCH_X86 = "x86" |
28 ARCH_X64 = "x64" | 28 ARCH_X64 = "x64" |
29 ARCH_ARM = "arm" | 29 ARCH_ARM = "arm" |
30 ARCH_ARM64 = "arm64" | |
viettrungluu
2015/12/27 18:02:50
Please add arm64 to mojo/tools/mopy/gn_unittest.py
| |
30 | 31 |
31 # Valid values for sanitizer (None is also valid): | 32 # Valid values for sanitizer (None is also valid): |
32 SANITIZER_ASAN = "asan" | 33 SANITIZER_ASAN = "asan" |
33 | 34 |
34 # Standard values for test types (test types are arbitrary strings; other | 35 # Standard values for test types (test types are arbitrary strings; other |
35 # values are allowed). | 36 # values are allowed). |
36 TEST_TYPE_DEFAULT = "default" | 37 TEST_TYPE_DEFAULT = "default" |
37 TEST_TYPE_UNIT = "unit" | 38 TEST_TYPE_UNIT = "unit" |
38 TEST_TYPE_PERF = "perf" | 39 TEST_TYPE_PERF = "perf" |
39 TEST_TYPE_INTEGRATION = "integration" | 40 TEST_TYPE_INTEGRATION = "integration" |
40 | 41 |
41 def __init__(self, target_os=None, target_cpu=None, is_debug=True, | 42 def __init__(self, target_os=None, target_cpu=None, is_debug=True, |
42 is_clang=None, sanitizer=None, dcheck_always_on=False, | 43 is_clang=None, sanitizer=None, dcheck_always_on=False, |
43 is_simulator=False, is_official_build=False, **kwargs): | 44 is_simulator=False, is_official_build=False, **kwargs): |
44 """Constructs a Config with key-value pairs specified via keyword arguments. | 45 """Constructs a Config with key-value pairs specified via keyword arguments. |
45 If target_os is not specified, it will be set to the host OS.""" | 46 If target_os is not specified, it will be set to the host OS.""" |
46 | 47 |
47 assert target_os in (None, Config.OS_ANDROID, Config.OS_FNL, | 48 assert target_os in (None, Config.OS_ANDROID, Config.OS_FNL, |
48 Config.OS_IOS, Config.OS_LINUX, | 49 Config.OS_IOS, Config.OS_LINUX, |
49 Config.OS_MAC, Config.OS_WINDOWS) | 50 Config.OS_MAC, Config.OS_WINDOWS) |
50 assert target_cpu in (None, Config.ARCH_X86, Config.ARCH_X64, | 51 assert target_cpu in (None, Config.ARCH_X86, Config.ARCH_X64, |
51 Config.ARCH_ARM) | 52 Config.ARCH_ARM, Config.ARCH_ARM64) |
52 assert isinstance(is_debug, bool) | 53 assert isinstance(is_debug, bool) |
53 assert isinstance(is_official_build, bool) | 54 assert isinstance(is_official_build, bool) |
54 assert is_clang is None or isinstance(is_clang, bool) | 55 assert is_clang is None or isinstance(is_clang, bool) |
55 assert sanitizer in (None, Config.SANITIZER_ASAN) | 56 assert sanitizer in (None, Config.SANITIZER_ASAN) |
56 if "test_types" in kwargs: | 57 if "test_types" in kwargs: |
57 assert isinstance(kwargs["test_types"], list) | 58 assert isinstance(kwargs["test_types"], list) |
58 | 59 |
59 self.values = {} | 60 self.values = {} |
60 self.values["target_os"] = (self.GetHostOS() if target_os is None else | 61 self.values["target_os"] = (self.GetHostOS() if target_os is None else |
61 target_os) | 62 target_os) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 | 141 |
141 @property | 142 @property |
142 def sanitizer(self): | 143 def sanitizer(self): |
143 """Sanitizer to use, if any.""" | 144 """Sanitizer to use, if any.""" |
144 return self.values["sanitizer"] | 145 return self.values["sanitizer"] |
145 | 146 |
146 @property | 147 @property |
147 def test_types(self): | 148 def test_types(self): |
148 """List of test types to run.""" | 149 """List of test types to run.""" |
149 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) | 150 return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT]) |
OLD | NEW |