1 #!/usr/bin/env python 2 3 # Copyright (c) 2012 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 reference optimization setting is extracted 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('opt-ref.gyp', chdir=CHDIR) 20 test.build('opt-ref.gyp', chdir=CHDIR) 21 22 # We're specifying /DEBUG so the default is to not remove unused functions. 23 output = test.run_dumpbin( 24 '/disasm', test.built_file_path('test_optref_default.exe', chdir=CHDIR)) 25 if 'unused_function' not in output: 26 test.fail_test() 27 28 # Explicitly off, unused_function preserved. 29 output = test.run_dumpbin( 30 '/disasm', test.built_file_path('test_optref_no.exe', chdir=CHDIR)) 31 if 'unused_function' not in output: 32 test.fail_test() 33 34 # Explicitly on, should be removed. 35 output = test.run_dumpbin( 36 '/disasm', test.built_file_path('test_optref_yes.exe', chdir=CHDIR)) 37 if 'unused_function' in output: 38 test.fail_test() 39 40 test.pass_test() 41