OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 Google Inc. All rights reserved. | 2 # Copyright (c) 2014 Google Inc. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Tests for analyzer | 6 """Tests for analyzer |
7 """ | 7 """ |
8 | 8 |
9 import json | 9 import json |
10 import TestGyp | 10 import TestGyp |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 _CreateConfigFile(['foo.c'], ['all']) | 291 _CreateConfigFile(['foo.c'], ['all']) |
292 run_analyzer() | 292 run_analyzer() |
293 EnsureContains(matched=True, compile_targets={'exe'}) | 293 EnsureContains(matched=True, compile_targets={'exe'}) |
294 | 294 |
295 # Assertions when modifying build (gyp/gypi) files, especially when said files | 295 # Assertions when modifying build (gyp/gypi) files, especially when said files |
296 # are included. | 296 # are included. |
297 _CreateConfigFile(['subdir2/d.cc'], ['all'], ['exe', 'exe2', 'foo', 'exe3']) | 297 _CreateConfigFile(['subdir2/d.cc'], ['all'], ['exe', 'exe2', 'foo', 'exe3']) |
298 run_analyzer2() | 298 run_analyzer2() |
299 EnsureContains(matched=True, test_targets={'exe', 'foo'}, | 299 EnsureContains(matched=True, test_targets={'exe', 'foo'}, |
300 compile_targets={'exe'}) | 300 compile_targets={'exe', 'foo'}) |
301 | 301 |
302 _CreateConfigFile(['subdir2/subdir.includes.gypi'], ['all'], | 302 _CreateConfigFile(['subdir2/subdir.includes.gypi'], ['all'], |
303 ['exe', 'exe2', 'foo', 'exe3']) | 303 ['exe', 'exe2', 'foo', 'exe3']) |
304 run_analyzer2() | 304 run_analyzer2() |
305 EnsureContains(matched=True, test_targets={'exe', 'foo'}, | 305 EnsureContains(matched=True, test_targets={'exe', 'foo'}, |
306 compile_targets={'exe'}) | 306 compile_targets={'exe', 'foo'}) |
307 | 307 |
308 _CreateConfigFile(['subdir2/subdir.gyp'], ['all'], | 308 _CreateConfigFile(['subdir2/subdir.gyp'], ['all'], |
309 ['exe', 'exe2', 'foo', 'exe3']) | 309 ['exe', 'exe2', 'foo', 'exe3']) |
310 run_analyzer2() | 310 run_analyzer2() |
311 EnsureContains(matched=True, test_targets={'exe', 'foo'}, | 311 EnsureContains(matched=True, test_targets={'exe', 'foo'}, |
312 compile_targets={'exe'}) | 312 compile_targets={'exe', 'foo'}) |
313 | 313 |
314 _CreateConfigFile(['test2.includes.gypi'], ['all'], | 314 _CreateConfigFile(['test2.includes.gypi'], ['all'], |
315 ['exe', 'exe2', 'foo', 'exe3']) | 315 ['exe', 'exe2', 'foo', 'exe3']) |
316 run_analyzer2() | 316 run_analyzer2() |
317 EnsureContains(matched=True, test_targets={'exe', 'exe2', 'exe3'}, | 317 EnsureContains(matched=True, test_targets={'exe', 'exe2', 'exe3'}, |
318 compile_targets={'exe', 'exe2', 'exe3'}) | 318 compile_targets={'exe', 'exe2', 'exe3'}) |
319 | 319 |
320 # Verify modifying a file included makes all targets dirty. | 320 # Verify modifying a file included makes all targets dirty. |
321 _CreateConfigFile(['common.gypi'], ['all'], ['exe', 'exe2', 'foo', 'exe3']) | 321 _CreateConfigFile(['common.gypi'], ['all'], ['exe', 'exe2', 'foo', 'exe3']) |
322 run_analyzer2('-Icommon.gypi') | 322 run_analyzer2('-Icommon.gypi') |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 EnsureContains(matched=True, test_targets={'exe2'}, | 407 EnsureContains(matched=True, test_targets={'exe2'}, |
408 compile_targets={'exe2', 'exe3'}) | 408 compile_targets={'exe2', 'exe3'}) |
409 | 409 |
410 _CreateConfigFile(['exe3.c'], ['exe2'], ['exe2']) | 410 _CreateConfigFile(['exe3.c'], ['exe2'], ['exe2']) |
411 run_analyzer() | 411 run_analyzer() |
412 EnsureContains(matched=False) | 412 EnsureContains(matched=False) |
413 | 413 |
414 # Assertions with 'all' listed as a test_target. | 414 # Assertions with 'all' listed as a test_target. |
415 _CreateConfigFile(['exe3.c'], [], ['all']) | 415 _CreateConfigFile(['exe3.c'], [], ['all']) |
416 run_analyzer() | 416 run_analyzer() |
417 EnsureContains(matched=True, compile_targets={'exe3'}, test_targets={'all'}) | 417 EnsureContains(matched=True, compile_targets={'exe3', 'all'}, |
| 418 test_targets={'all'}) |
418 | 419 |
419 _CreateConfigFile(['exe2.c'], [], ['all', 'exe2']) | 420 _CreateConfigFile(['exe2.c'], [], ['all', 'exe2']) |
420 run_analyzer() | 421 run_analyzer() |
421 EnsureContains(matched=True, compile_targets={'exe2'}, | 422 EnsureContains(matched=True, compile_targets={'exe2', 'all'}, |
422 test_targets={'all', 'exe2'}) | 423 test_targets={'all', 'exe2'}) |
423 | 424 |
424 test.pass_test() | 425 test.pass_test() |
OLD | NEW |