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 19 matching lines...) Expand all Loading... |
30 test.run_gyp(gypfile) | 30 test.run_gyp(gypfile) |
31 test.build(gypfile) | 31 test.build(gypfile) |
32 | 32 |
33 test.must_contain_all_lines(test.stdout(), check_for) | 33 test.must_contain_all_lines(test.stdout(), check_for) |
34 | 34 |
35 | 35 |
36 test = TestGyp.TestGyp(formats=['ninja', 'make']) | 36 test = TestGyp.TestGyp(formats=['ninja', 'make']) |
37 | 37 |
38 def TestTargetOveride(): | 38 def TestTargetOveride(): |
39 expected = ['my_cc.py', 'my_cxx.py', 'FOO' ] | 39 expected = ['my_cc.py', 'my_cxx.py', 'FOO' ] |
40 if test.format != 'ninja': # ninja just uses $CC / $CXX as linker. | 40 |
| 41 # ninja just uses $CC / $CXX as linker. |
| 42 if test.format not in ['ninja', 'xcode-ninja']: |
41 expected.append('FOO_LINK') | 43 expected.append('FOO_LINK') |
42 | 44 |
43 # Check that CC, CXX and LD set target compiler | 45 # Check that CC, CXX and LD set target compiler |
44 oldenv = os.environ.copy() | 46 oldenv = os.environ.copy() |
45 try: | 47 try: |
46 os.environ['CC'] = 'python %s/my_cc.py FOO' % here | 48 os.environ['CC'] = 'python %s/my_cc.py FOO' % here |
47 os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here | 49 os.environ['CXX'] = 'python %s/my_cxx.py FOO' % here |
48 os.environ['LINK'] = 'python %s/my_ld.py FOO_LINK' % here | 50 os.environ['LINK'] = 'python %s/my_ld.py FOO_LINK' % here |
49 | 51 |
50 CheckCompiler(test, 'compiler-exe.gyp', expected, True) | 52 CheckCompiler(test, 'compiler-exe.gyp', expected, True) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 os.environ.update(oldenv) | 99 os.environ.update(oldenv) |
98 | 100 |
99 # Run the same tests once the eviron has been restored. The | 101 # Run the same tests once the eviron has been restored. The |
100 # generated should have embedded all the settings in the | 102 # generated should have embedded all the settings in the |
101 # project files so the results should be the same. | 103 # project files so the results should be the same. |
102 CheckCompiler(test, 'compiler-host.gyp', expected, False) | 104 CheckCompiler(test, 'compiler-host.gyp', expected, False) |
103 | 105 |
104 | 106 |
105 TestTargetOveride() | 107 TestTargetOveride() |
106 TestTargetOverideCompilerOnly() | 108 TestTargetOverideCompilerOnly() |
107 TestHostOveride() | |
108 | 109 |
109 test.pass_test() | 110 test.pass_test() |
OLD | NEW |