| OLD | NEW |
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 self.check(['analyze', '-c', 'gn_debug', '//out/Default', | 132 self.check(['analyze', '-c', 'gn_debug', '//out/Default', |
| 133 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) | 133 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) |
| 134 out = json.loads(mbw.files['/tmp/out.json']) | 134 out = json.loads(mbw.files['/tmp/out.json']) |
| 135 self.assertEqual(out, { | 135 self.assertEqual(out, { |
| 136 'status': 'Found dependency', | 136 'status': 'Found dependency', |
| 137 'targets': ['foo_unittests'], | 137 'targets': ['foo_unittests'], |
| 138 'build_targets': ['foo_unittests'] | 138 'build_targets': ['foo_unittests'] |
| 139 }) | 139 }) |
| 140 | 140 |
| 141 def test_gn_analyze_all(self): |
| 142 files = {'/tmp/in.json': """{\ |
| 143 "files": ["foo/foo_unittest.cc"], |
| 144 "targets": ["all", "bar_unittests"] |
| 145 }"""} |
| 146 mbw = self.fake_mbw(files) |
| 147 mbw.Call = lambda cmd: (0, 'out/Default/foo_unittests\n', '') |
| 148 |
| 149 self.check(['analyze', '-c', 'gn_debug', '//out/Default', |
| 150 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0) |
| 151 out = json.loads(mbw.files['/tmp/out.json']) |
| 152 self.assertEqual(out, { |
| 153 'status': 'Found dependency (all)', |
| 154 }) |
| 155 |
| 141 def test_gyp_analyze(self): | 156 def test_gyp_analyze(self): |
| 142 self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release', | 157 self.check(['analyze', '-c', 'gyp_rel_bot', '//out/Release', |
| 143 '/tmp/in.json', '/tmp/out.json'], | 158 '/tmp/in.json', '/tmp/out.json'], |
| 144 ret=0) | 159 ret=0) |
| 145 | 160 |
| 146 def test_gen(self): | 161 def test_gen(self): |
| 147 self.check(['gen', '-c', 'gn_debug', '//out/Default'], ret=0) | 162 self.check(['gen', '-c', 'gn_debug', '//out/Default'], ret=0) |
| 148 self.check(['gen', '-c', 'gyp_rel_bot', '//out/Release'], ret=0) | 163 self.check(['gen', '-c', 'gyp_rel_bot', '//out/Release'], ret=0) |
| 149 | 164 |
| 150 def test_goma_dir_expansion(self): | 165 def test_goma_dir_expansion(self): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 163 | 178 |
| 164 def test_lookup(self): | 179 def test_lookup(self): |
| 165 self.check(['lookup', '-c', 'gn_debug'], ret=0) | 180 self.check(['lookup', '-c', 'gn_debug'], ret=0) |
| 166 | 181 |
| 167 def test_validate(self): | 182 def test_validate(self): |
| 168 self.check(['validate'], ret=0) | 183 self.check(['validate'], ret=0) |
| 169 | 184 |
| 170 | 185 |
| 171 if __name__ == '__main__': | 186 if __name__ == '__main__': |
| 172 unittest.main() | 187 unittest.main() |
| OLD | NEW |