OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2013 Google Inc. All rights reserved. | 3 # Copyright (c) 2013 Google Inc. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Make sure LTCG is working properly. | 8 Make sure LTCG is working properly. |
9 """ | 9 """ |
10 | 10 |
11 import TestGyp | 11 import TestGyp |
12 | 12 |
13 import sys | 13 import sys |
14 | 14 |
15 if sys.platform == 'win32': | 15 if sys.platform == 'win32': |
16 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) | 16 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
17 | 17 |
18 CHDIR = 'linker-flags' | 18 CHDIR = 'linker-flags' |
19 test.run_gyp('ltcg.gyp', chdir=CHDIR) | 19 test.run_gyp('ltcg.gyp', chdir=CHDIR) |
20 | 20 |
21 # Here we expect LTCG is able to inline functions beyond compile unit. | 21 # Here we expect LTCG is able to inline functions beyond compile unit. |
22 # Note: This marker is embedded in 'inline_test_main.cc' | 22 # Note: This marker is embedded in 'inline_test_main.cc' |
23 INLINE_MARKER = '==== inlined ====' | 23 INLINE_MARKER = '==== inlined ====' |
24 | 24 |
| 25 # link.exe generates following lines when LTCG is enabled. |
| 26 # Note: Future link.exe may or may not generate them. Update as needed. |
| 27 LTCG_LINKER_MESSAGES = ['Generating code', 'Finished generating code'] |
| 28 |
25 # test 'LinkTimeCodeGenerationOptionDefault' | 29 # test 'LinkTimeCodeGenerationOptionDefault' |
26 test.build('ltcg.gyp', 'test_ltcg_off', chdir=CHDIR) | 30 test.build('ltcg.gyp', 'test_ltcg_off', chdir=CHDIR) |
27 test.run_built_executable('test_ltcg_off', chdir=CHDIR) | 31 test.run_built_executable('test_ltcg_off', chdir=CHDIR) |
28 test.must_not_contain_any_line(test.stdout(), [INLINE_MARKER]) | 32 test.must_not_contain_any_line(test.stdout(), [INLINE_MARKER]) |
29 | 33 |
30 # test 'LinkTimeCodeGenerationOptionUse' | 34 # test 'LinkTimeCodeGenerationOptionUse' |
31 test.build('ltcg.gyp', 'test_ltcg_on', chdir=CHDIR) | 35 test.build('ltcg.gyp', 'test_ltcg_on', chdir=CHDIR) |
32 test.must_contain_any_line(test.stdout(), ['Generating code']) | 36 if test.format == 'ninja': |
| 37 # Make sure ninja win_tool.py filters out noisy lines. |
| 38 test.must_not_contain_any_line(test.stdout(), LTCG_LINKER_MESSAGES) |
| 39 elif test.format == 'msvs': |
| 40 test.must_contain_any_line(test.stdout(), LTCG_LINKER_MESSAGES) |
33 test.run_built_executable('test_ltcg_on', chdir=CHDIR) | 41 test.run_built_executable('test_ltcg_on', chdir=CHDIR) |
34 test.must_contain_any_line(test.stdout(), [INLINE_MARKER]) | 42 test.must_contain_any_line(test.stdout(), [INLINE_MARKER]) |
35 | 43 |
36 test.pass_test() | 44 test.pass_test() |
OLD | NEW |