1 #!/usr/bin/env python 2 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 5 # found in the LICENSE file. 6 7 """ 8 Make sure LTCG is working properly. 9 """ 10 11 import TestGyp 12 13 import sys 14 15 if sys.platform == 'win32': 16 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) 17 18 CHDIR = 'linker-flags' 19 test.run_gyp('ltcg.gyp', chdir=CHDIR) 20 21 # Here we expect LTCG is able to inline functions beyond compile unit. 22 # Note: This marker is embedded in 'inline_test_main.cc' 23 INLINE_MARKER = '==== inlined ====' 24 25 # test 'LinkTimeCodeGenerationOptionDefault' 26 test.build('ltcg.gyp', 'test_ltcg_off', chdir=CHDIR) 27 test.run_built_executable('test_ltcg_off', chdir=CHDIR) 28 test.must_not_contain_any_line(test.stdout(), [INLINE_MARKER]) 29 30 # test 'LinkTimeCodeGenerationOptionUse' 31 test.build('ltcg.gyp', 'test_ltcg_on', chdir=CHDIR) 32 test.must_contain_any_line(test.stdout(), ['Generating code']) 33 test.run_built_executable('test_ltcg_on', chdir=CHDIR) 34 test.must_contain_any_line(test.stdout(), [INLINE_MARKER]) 35 36 test.pass_test() 37