OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 """ | 5 """ |
6 Verifies that the user can override the compiler and linker using CC/CXX/LD | 6 Verifies that the user can override the compiler and linker using CC/CXX/LD |
7 environment variables. | 7 environment variables. |
8 """ | 8 """ |
9 | 9 |
10 import TestGyp | 10 import TestGyp |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 # We can't test to presence of my_ld.py in the output since | 33 # We can't test to presence of my_ld.py in the output since |
34 # ninja will use CXX_target as the linker regardless | 34 # ninja will use CXX_target as the linker regardless |
35 test.must_contain_all_lines(test.stdout(), check_for) | 35 test.must_contain_all_lines(test.stdout(), check_for) |
36 | 36 |
37 | 37 |
38 test = TestGyp.TestGyp(formats=['ninja', 'make']) | 38 test = TestGyp.TestGyp(formats=['ninja', 'make']) |
39 | 39 |
40 def TestTargetOveride(): | 40 def TestTargetOveride(): |
41 expected = ['my_cc.py', 'my_cxx.py', 'FOO' ] | 41 expected = ['my_cc.py', 'my_cxx.py', 'FOO' ] |
42 if test.format != 'ninja': # ninja just uses $CC / $CXX as linker. | 42 |
43 # ninja just uses $CC / $CXX as linker. | |
44 if test.format not in ['ninja', 'xcode-ninja']: | |
43 expected.append('FOO_LINK') | 45 expected.append('FOO_LINK') |
44 | 46 |
45 # Check that CC, CXX and LD set target compiler | 47 # Check that CC, CXX and LD set target compiler |
46 oldenv = os.environ.copy() | 48 oldenv = os.environ.copy() |
47 try: | 49 try: |
48 os.environ['CC'] = 'python %s/my_cc.py FOO' % here | 50 os.environ['CC'] = 'python %s/my_cc.py FOO' % here |
49 os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here | 51 os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here |
50 os.environ['LINK'] = 'python %s/my_ld.py FOO_LINK' % here | 52 os.environ['LINK'] = 'python %s/my_ld.py FOO_LINK' % here |
51 | 53 |
52 CheckCompiler(test, 'compiler.gyp', expected, | 54 CheckCompiler(test, 'compiler.gyp', expected, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 os.environ.update(oldenv) | 102 os.environ.update(oldenv) |
101 | 103 |
102 # Run the same tests once the eviron has been restored. The | 104 # Run the same tests once the eviron has been restored. The |
103 # generated should have embedded all the settings in the | 105 # generated should have embedded all the settings in the |
104 # project files so the results should be the same. | 106 # project files so the results should be the same. |
105 CheckCompiler(test, 'compiler-host.gyp', expected, False) | 107 CheckCompiler(test, 'compiler-host.gyp', expected, False) |
106 | 108 |
107 | 109 |
108 TestTargetOveride() | 110 TestTargetOveride() |
109 TestTargetOverideCompilerOnly() | 111 TestTargetOverideCompilerOnly() |
110 TestHostOveride() | 112 |
113 # The xcode generator chokes on the 'host' toolset. | |
sdefresne
2014/09/02 15:13:05
Is this a bug or by design?
Tobias
2014/10/02 18:19:19
I can't reproduce this one any more. I've removed
| |
114 if test.format != 'xcode-ninja': | |
115 TestHostOveride() | |
111 | 116 |
112 test.pass_test() | 117 test.pass_test() |
OLD | NEW |