| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 Google Inc. All rights reserved. | 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 | 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 Verifies that xcode-style GCC_... settings are handled properly. | 8 Verifies that xcode-style GCC_... settings are handled properly. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 def CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): | 24 def CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): |
| 25 # "clang" does not support the "-Winvalid-offsetof" flag, and silently | 25 # "clang" does not support the "-Winvalid-offsetof" flag, and silently |
| 26 # ignore it. Starting with Xcode 5.0.0, "gcc" is just a "clang" binary with | 26 # ignore it. Starting with Xcode 5.0.0, "gcc" is just a "clang" binary with |
| 27 # some hard-coded include path hack, so use the output of "-v" to detect if | 27 # some hard-coded include path hack, so use the output of "-v" to detect if |
| 28 # the compiler supports the flag or not. | 28 # the compiler supports the flag or not. |
| 29 return 'clang' not in CompilerVersion('/usr/bin/cc') | 29 return 'clang' not in CompilerVersion('/usr/bin/cc') |
| 30 | 30 |
| 31 if sys.platform == 'darwin': | 31 if sys.platform == 'darwin': |
| 32 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) | 32 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| 33 | 33 |
| 34 if test.format == 'xcode-ninja': |
| 35 test.skip_test() |
| 36 |
| 34 CHDIR = 'xcode-gcc' | 37 CHDIR = 'xcode-gcc' |
| 35 test.run_gyp('test.gyp', chdir=CHDIR) | 38 test.run_gyp('test.gyp', chdir=CHDIR) |
| 36 | 39 |
| 37 # List of targets that'll pass. It expects targets of the same name with | 40 # List of targets that'll pass. It expects targets of the same name with |
| 38 # '-fail' appended that'll fail to build. | 41 # '-fail' appended that'll fail to build. |
| 39 targets = [ | 42 targets = [ |
| 40 'warn_about_missing_newline', | 43 'warn_about_missing_newline', |
| 41 ] | 44 ] |
| 42 | 45 |
| 43 # clang doesn't warn on invalid offsetofs, it silently ignores | 46 # clang doesn't warn on invalid offsetofs, it silently ignores |
| 44 # -Wno-invalid-offsetof. | 47 # -Wno-invalid-offsetof. |
| 45 if CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): | 48 if CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): |
| 46 targets.append('warn_about_invalid_offsetof_macro') | 49 targets.append('warn_about_invalid_offsetof_macro') |
| 47 | 50 |
| 48 for target in targets: | 51 for target in targets: |
| 49 test.build('test.gyp', target, chdir=CHDIR) | 52 test.build('test.gyp', target, chdir=CHDIR) |
| 50 test.built_file_must_exist(target, chdir=CHDIR) | 53 test.built_file_must_exist(target, chdir=CHDIR) |
| 51 fail_target = target + '-fail' | 54 fail_target = target + '-fail' |
| 52 test.build('test.gyp', fail_target, chdir=CHDIR, status=None, | 55 test.build('test.gyp', fail_target, chdir=CHDIR, status=None, |
| 53 stderr=None, match=IgnoreOutput) | 56 stderr=None, match=IgnoreOutput) |
| 54 test.built_file_must_not_exist(fail_target, chdir=CHDIR) | 57 test.built_file_must_not_exist(fail_target, chdir=CHDIR) |
| 55 | 58 |
| 56 test.pass_test() | 59 test.pass_test() |
| OLD | NEW |