Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: mojo/tools/mopy/gn_unittest.py

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/tools/mopy/gn.py ('k') | mojo/tools/roll/cc_strip_video.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import itertools 5 import itertools
6 import sys 6 import sys
7 import unittest 7 import unittest
8 8
9 import mopy.gn as gn 9 import mopy.gn as gn
10 10
11 from mopy.config import Config 11 from mopy.config import Config
12 12
13 13
14 class GTestListTestsTest(unittest.TestCase): 14 class GTestListTestsTest(unittest.TestCase):
15 """Tests mopy.gn.""" 15 """Tests mopy.gn."""
16 16
17 def testConfigToGNToConfig(self): 17 def testConfigToGNToConfig(self):
18 """Tests that config to gn to config is the identity""" 18 """Tests that config to gn to config is the identity"""
19 configs_to_test = { 19 configs_to_test = {
20 "target_os": [None, "android", "chromeos", "linux"], 20 "target_os": [None, "android", "chromeos", "linux"],
21 "target_arch": [None, "x86", "x64", "arm"], 21 "target_cpu": [None, "x86", "x64", "arm"],
22 "is_debug": [False, True], 22 "is_debug": [False, True],
23 "is_clang": [False, True], 23 "is_clang": [False, True],
24 "sanitizer": [None, Config.SANITIZER_ASAN], 24 "sanitizer": [None, Config.SANITIZER_ASAN],
25 "use_goma": [False], 25 "use_goma": [False],
26 "use_nacl": [False, True], 26 "use_nacl": [False, True],
27 "dcheck_always_on": [False, True], 27 "dcheck_always_on": [False, True],
28 } 28 }
29 29
30 for args in _iterate_over_config(configs_to_test): 30 for args in _iterate_over_config(configs_to_test):
31 config = Config(**args) 31 config = Config(**args)
32 gn_args = gn.GNArgsForConfig(config) 32 gn_args = gn.GNArgsForConfig(config)
33 new_config = gn.ConfigForGNArgs(gn_args) 33 new_config = gn.ConfigForGNArgs(gn_args)
34 self.assertDictEqual(config.values, new_config.values) 34 self.assertDictEqual(config.values, new_config.values)
35 35
36 def testGNToConfigToGN(self): 36 def testGNToConfigToGN(self):
37 """Tests that gn to config to gn is the identity""" 37 """Tests that gn to config to gn is the identity"""
38 configs_to_test = { 38 configs_to_test = {
39 "os": [None, "android", "chromeos"], 39 "os": [None, "android", "chromeos"],
40 "target_arch": ["x86", "x64", "arm"], 40 "target_cpu": ["x86", "x64", "arm"],
41 "is_debug": [False, True], 41 "is_debug": [False, True],
42 "is_clang": [False, True], 42 "is_clang": [False, True],
43 "is_asan": [False, True], 43 "is_asan": [False, True],
44 "use_goma": [False], 44 "use_goma": [False],
45 "mojo_use_nacl": [False, True], 45 "mojo_use_nacl": [False, True],
46 "dcheck_always_on": [False, True], 46 "dcheck_always_on": [False, True],
47 } 47 }
48 48
49 for args in _iterate_over_config(configs_to_test): 49 for args in _iterate_over_config(configs_to_test):
50 if args.get('os', None) == "chromeos": 50 if args.get('os', None) == "chromeos":
(...skipping 10 matching lines...) Expand all
61 61
62 62
63 def _iterate_over_config(config): 63 def _iterate_over_config(config):
64 def product_to_dict(p): 64 def product_to_dict(p):
65 return dict(filter(lambda x: x[1] is not None, zip(config.keys(), p))) 65 return dict(filter(lambda x: x[1] is not None, zip(config.keys(), p)))
66 return itertools.imap(product_to_dict, itertools.product(*config.values())) 66 return itertools.imap(product_to_dict, itertools.product(*config.values()))
67 67
68 68
69 if __name__ == "__main__": 69 if __name__ == "__main__":
70 unittest.main() 70 unittest.main()
OLDNEW
« no previous file with comments | « mojo/tools/mopy/gn.py ('k') | mojo/tools/roll/cc_strip_video.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698