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

Side by Side Diff: test/analyzer/gyptest-analyzer.py

Issue 1142323006: Makes analyzer always output static_libraries that have changed (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: is_or_has_linked_ancestor Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
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
11 11
12 found = 'Found dependency' 12 found = 'Found dependency'
13 found_all = 'Found dependency (all)' 13 found_all = 'Found dependency (all)'
14 not_found = 'No dependencies' 14 not_found = 'No dependencies'
15 15
16 16
17 def _CreateConfigFile(files, targets): 17 def _CreateConfigFile(files, targets):
18 """Creates the analyzer conflig file, which is used as the input to analyzer. 18 """Creates the analyzer config file, which is used as the input to analyzer.
19 See description of analyzer.py for description of the arguments.""" 19 See description of analyzer.py for description of the arguments."""
20 f = open('test_file', 'w') 20 f = open('test_file', 'w')
21 to_write = {'files': files, 'targets': targets } 21 to_write = {'files': files, 'targets': targets }
22 json.dump(to_write, f) 22 json.dump(to_write, f)
23 f.close() 23 f.close()
24 24
25 25
26 def _CreateBogusConfigFile(): 26 def _CreateBogusConfigFile():
27 f = open('test_file','w') 27 f = open('test_file','w')
28 f.write('bogus') 28 f.write('bogus')
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 def EnsureInvalidTargets(expected_invalid_targets): 138 def EnsureInvalidTargets(expected_invalid_targets):
139 """Verifies output contains invalid_targets.""" 139 """Verifies output contains invalid_targets."""
140 result = _ReadOutputFileContents() 140 result = _ReadOutputFileContents()
141 actual_invalid_targets = set(result['invalid_targets']) 141 actual_invalid_targets = set(result['invalid_targets'])
142 if actual_invalid_targets != expected_invalid_targets: 142 if actual_invalid_targets != expected_invalid_targets:
143 print 'actual invalid_targets:', actual_invalid_targets, \ 143 print 'actual invalid_targets:', actual_invalid_targets, \
144 '\nexpected :', expected_invalid_targets 144 '\nexpected :', expected_invalid_targets
145 test.fail_test() 145 test.fail_test()
146 146
147
148 # Two targets, A and B (both static_libraries) and A depends upon B. If a file
149 # in B changes, then both A and B are output. It is not strictly necessary that
150 # A is compiled in this case, only B.
151 _CreateConfigFile(['b.c'], [])
152 test.run_gyp('static_library_test.gyp', *CommonArgs())
153 EnsureContains(matched=True, build_targets={'a' ,'b'})
154 #test.pass_test()
Nico 2015/06/08 17:53:31 is this intentionally commented out? probably not?
sky 2015/06/08 18:01:17 Ya, sorry, I removed this line. test.pass_test()
155
147 # Verifies config_path must be specified. 156 # Verifies config_path must be specified.
148 test.run_gyp('test.gyp') 157 test.run_gyp('test.gyp')
149 EnsureStdoutContains('Must specify files to analyze via config_path') 158 EnsureStdoutContains('Must specify files to analyze via config_path')
150 159
151 # Verifies config_path must point to a valid file. 160 # Verifies config_path must point to a valid file.
152 test.run_gyp('test.gyp', '-Gconfig_path=bogus_file', 161 test.run_gyp('test.gyp', '-Gconfig_path=bogus_file',
153 '-Ganalyzer_output_path=analyzer_output') 162 '-Ganalyzer_output_path=analyzer_output')
154 EnsureError('Unable to open file bogus_file') 163 EnsureError('Unable to open file bogus_file')
155 164
156 # Verify 'invalid_targets' is present when bad target is specified. 165 # Verify 'invalid_targets' is present when bad target is specified.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 _CreateConfigFile(['f.c'], []) 353 _CreateConfigFile(['f.c'], [])
345 run_analyzer4() 354 run_analyzer4()
346 EnsureContains(matched=True, build_targets={'e', 'f'}) 355 EnsureContains(matched=True, build_targets={'e', 'f'})
347 356
348 _CreateConfigFile(['d.c'], []) 357 _CreateConfigFile(['d.c'], [])
349 run_analyzer4() 358 run_analyzer4()
350 EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'd'}) 359 EnsureContains(matched=True, build_targets={'a', 'b', 'c', 'd'})
351 360
352 _CreateConfigFile(['i.c'], []) 361 _CreateConfigFile(['i.c'], [])
353 run_analyzer4() 362 run_analyzer4()
354 EnsureContains(matched=True, build_targets={'h'}) 363 EnsureContains(matched=True, build_targets={'h', 'i'})
355 364
356 test.pass_test() 365 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698