Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: test/mac/gyptest-xcode-gcc.py

Issue 83113002: Fix gyptest-xcode-gcc.py when using Xcode 5.0.2 (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 import TestGyp 11 import TestGyp
12 12
13 import os 13 import os
14 import subprocess
14 import sys 15 import sys
15 16
16 def IgnoreOutput(string, expected_string): 17 def IgnoreOutput(string, expected_string):
17 return True 18 return True
18 19
20 def CompilerVersion(compiler):
21 stdout = subprocess.check_output([compiler, '-v'], stderr=subprocess.STDOUT)
22 return stdout.rstrip('\n')
23
24 def CompilerSupportsWarnAboutInvalidOffsetOfMacro(test):
25 # With Xcode 5.0.2, gcc is a version of clang using different binary and
26 # include directories. It then behaves like clang and doesn't warn on
27 # invalid offsetofs (it silently ignore -Wno-invalid-offsetof).
28 if 'clang' in CompilerVersion('/usr/bin/gcc'):
29 return False
30 # TODO(thakis): This isn't really the right way to detect the compiler,
31 # Xcode has some embedded compiler, but it's a reliable proxy at least on
32 # the bots. The compiler is forced to gcc/g++ in the gyp file in a
33 # make_global_settings section for ninja and make.
34 return test.format != 'xcode' or os.readlink('/usr/bin/cc') != 'clang'
Mark Mentovai 2013/12/06 20:17:56 I think that testing |'clang' in CompilerVersion('
sdefresne 2013/12/10 12:38:43 Done.
35
19 if sys.platform == 'darwin': 36 if sys.platform == 'darwin':
20 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) 37 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
21 38
22 CHDIR = 'xcode-gcc' 39 CHDIR = 'xcode-gcc'
23 test.run_gyp('test.gyp', chdir=CHDIR) 40 test.run_gyp('test.gyp', chdir=CHDIR)
24 41
25 # List of targets that'll pass. It expects targets of the same name with 42 # List of targets that'll pass. It expects targets of the same name with
26 # '-fail' appended that'll fail to build. 43 # '-fail' appended that'll fail to build.
27 targets = [ 44 targets = [
28 'warn_about_missing_newline', 45 'warn_about_missing_newline',
29 ] 46 ]
30 47
31 # clang doesn't warn on invalid offsetofs, it silently ignores 48 # clang doesn't warn on invalid offsetofs, it silently ignores
32 # -Wno-invalid-offsetof. 49 # -Wno-invalid-offsetof.
33 # TODO(thakis): This isn't really the right way to detect the compiler, 50 if CompilerSupportsWarnAboutInvalidOffsetOfMacro(test):
34 # Xcode has some embedded compiler, but it's a reliable proxy at least on
35 # the bots. The compiler is forced to gcc/g++ in the gyp file in a
36 # make_global_settings section for ninja and make.
37 if test.format != 'xcode' or os.readlink('/usr/bin/cc') != 'clang':
38 targets.append('warn_about_invalid_offsetof_macro') 51 targets.append('warn_about_invalid_offsetof_macro')
39 52
40 for target in targets: 53 for target in targets:
41 test.build('test.gyp', target, chdir=CHDIR) 54 test.build('test.gyp', target, chdir=CHDIR)
42 test.built_file_must_exist(target, chdir=CHDIR) 55 test.built_file_must_exist(target, chdir=CHDIR)
43 fail_target = target + '-fail' 56 fail_target = target + '-fail'
44 test.build('test.gyp', fail_target, chdir=CHDIR, status=None, 57 test.build('test.gyp', fail_target, chdir=CHDIR, status=None,
45 stderr=None, match=IgnoreOutput) 58 stderr=None, match=IgnoreOutput)
46 test.built_file_must_not_exist(fail_target, chdir=CHDIR) 59 test.built_file_must_not_exist(fail_target, chdir=CHDIR)
47 60
48 test.pass_test() 61 test.pass_test()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698