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 Verifies that xcode-style GCC_... settings that require clang are handled 9 properly. 10 """ 11 12 import TestGyp 13 14 import os 15 import sys 16 17 if sys.platform == 'darwin': 18 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) 19 20 CHDIR = 'xcode-gcc' 21 test.run_gyp('test-clang.gyp', chdir=CHDIR) 22 23 test.build('test-clang.gyp', 'aliasing_yes', chdir=CHDIR) 24 test.run_built_executable('aliasing_yes', chdir=CHDIR, stdout="1\n") 25 test.build('test-clang.gyp', 'aliasing_no', chdir=CHDIR) 26 test.run_built_executable('aliasing_no', chdir=CHDIR, stdout="0\n") 27 28 # The default behavior changed: strict aliasing used to be off, now it's on 29 # by default. The important part is that this is identical for all generators 30 # (which it is). TODO(thakis): Enable this once the bots have a newer Xcode. 31 #test.build('test-clang.gyp', 'aliasing_default', chdir=CHDIR) 32 #test.run_built_executable('aliasing_default', chdir=CHDIR, stdout="1\n") 33 # For now, just check the generated ninja file: 34 if test.format == 'ninja': 35 contents = open(test.built_file_path('obj/aliasing_default.ninja', 36 chdir=CHDIR)).read() 37 if 'strict-aliasing' in contents: 38 test.fail_test() 39 40 test.pass_test() 41