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 fixed base 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('fixed-base.gyp', chdir=CHDIR) 20 test.build('fixed-base.gyp', test.ALL, chdir=CHDIR) 21 22 def GetHeaders(exe): 23 full_path = test.built_file_path(exe, chdir=CHDIR) 24 return test.run_dumpbin('/headers', full_path) 25 26 # For exe, default is fixed, for dll, it's not fixed. 27 if 'Relocations stripped' not in GetHeaders('test_fixed_default_exe.exe'): 28 test.fail_test() 29 if 'Relocations stripped' in GetHeaders('test_fixed_default_dll.dll'): 30 test.fail_test() 31 32 # Explicitly not fixed. 33 if 'Relocations stripped' in GetHeaders('test_fixed_no.exe'): 34 test.fail_test() 35 36 # Explicitly fixed. 37 if 'Relocations stripped' not in GetHeaders('test_fixed_yes.exe'): 38 test.fail_test() 39 40 test.pass_test() 41