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

Side by Side Diff: tools/mb/mb_unittest.py

Issue 1109453002: Re-roll GN to 326666 and fix GN-related bugs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete stray blank line Created 5 years, 8 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 | « tools/mb/mb.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Tests for mb.py.""" 5 """Tests for mb.py."""
6 6
7 import json 7 import json
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 mbw = self.fake_mbw(files) 146 mbw = self.fake_mbw(files)
147 mbw.Call = lambda cmd: (0, 'out/Default/foo_unittests\n', '') 147 mbw.Call = lambda cmd: (0, 'out/Default/foo_unittests\n', '')
148 148
149 self.check(['analyze', '-c', 'gn_debug', '//out/Default', 149 self.check(['analyze', '-c', 'gn_debug', '//out/Default',
150 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) 150 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0)
151 out = json.loads(mbw.files['/tmp/out.json']) 151 out = json.loads(mbw.files['/tmp/out.json'])
152 self.assertEqual(out, { 152 self.assertEqual(out, {
153 'status': 'Found dependency (all)', 153 'status': 'Found dependency (all)',
154 }) 154 })
155 155
156 def test_gn_analyze_missing_file(self):
157 files = {'/tmp/in.json': """{\
158 "files": ["foo/foo_unittest.cc"],
159 "targets": ["bar_unittests"]
160 }"""}
161 mbw = self.fake_mbw(files)
162 mbw.Call = lambda cmd: (
163 1, 'The input matches no targets, configs, or files\n', '')
164
165 self.check(['analyze', '-c', 'gn_debug', '//out/Default',
166 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0)
167 out = json.loads(mbw.files['/tmp/out.json'])
168 self.assertEqual(out, {
169 'build_targets': [],
170 'targets': [],
171 'status': 'No dependency',
172 })
173
156 def test_gyp_analyze(self): 174 def test_gyp_analyze(self):
157 self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release', 175 self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release',
158 '/tmp/in.json', '/tmp/out.json'], 176 '/tmp/in.json', '/tmp/out.json'],
159 ret=0) 177 ret=0)
160 178
161 def test_gen(self): 179 def test_gen(self):
162 self.check(['gen', '-c', 'gn_debug', '//out/Default'], ret=0) 180 self.check(['gen', '-c', 'gn_debug', '//out/Default'], ret=0)
163 self.check(['gen', '-c', 'gyp_rel_bot', '//out/Release'], ret=0) 181 self.check(['gen', '-c', 'gyp_rel_bot', '//out/Release'], ret=0)
164 182
165 def test_goma_dir_expansion(self): 183 def test_goma_dir_expansion(self):
(...skipping 12 matching lines...) Expand all
178 196
179 def test_lookup(self): 197 def test_lookup(self):
180 self.check(['lookup', '-c', 'gn_debug'], ret=0) 198 self.check(['lookup', '-c', 'gn_debug'], ret=0)
181 199
182 def test_validate(self): 200 def test_validate(self):
183 self.check(['validate'], ret=0) 201 self.check(['validate'], ret=0)
184 202
185 203
186 if __name__ == '__main__': 204 if __name__ == '__main__':
187 unittest.main() 205 unittest.main()
OLDNEW
« no previous file with comments | « tools/mb/mb.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698