OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2014 Google Inc. All rights reserved. | 3 # Copyright (c) 2014 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 make_global_settings works with the full toolchain. | 8 Verifies make_global_settings works with the full toolchain. |
9 """ | 9 """ |
10 | 10 |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 import TestGyp | 13 import TestGyp |
14 | 14 |
15 if sys.platform == 'win32': | 15 if sys.platform == 'win32': |
16 # cross compiling not supported by ninja on windows | 16 # cross compiling not supported by ninja on windows |
17 # and make not supported on windows at all. | 17 # and make not supported on windows at all. |
18 sys.exit(0) | 18 sys.exit(0) |
19 | 19 |
20 test = TestGyp.TestGyp(formats=['ninja']) | 20 test = TestGyp.TestGyp(formats=['ninja']) |
21 # Must set the test format to something with a flavor (the part after the '-') | 21 # Must set the test format to something with a flavor (the part after the '-') |
22 # in order to test the desired behavior. Since we want to run a non-host | 22 # in order to test the desired behavior. Since we want to run a non-host |
23 # toolchain, we have to set the flavor to something that the ninja generator | 23 # toolchain, we have to set the flavor to something that the ninja generator |
24 # doesn't know about, so it doesn't default to the host-specific tools (e.g., | 24 # doesn't know about, so it doesn't default to the host-specific tools (e.g., |
25 # 'otool' on mac to generate the .TOC). | 25 # 'otool' on mac to generate the .TOC). |
26 # | 26 # |
27 # Note that we can't just pass format=['ninja-some_toolchain'] to the | 27 # Note that we can't just pass format=['ninja-some_toolchain'] to the |
28 # constructor above, because then this test wouldn't be recognized as a ninja | 28 # constructor above, because then this test wouldn't be recognized as a ninja |
29 # format test. | 29 # format test. |
30 test.formats = ['ninja-some_flavor'] | 30 test.formats = ['ninja-my_flavor' if f == 'ninja' else f for f in test.formats] |
31 | 31 |
32 gyp_file = 'make_global_settings.gyp' | 32 gyp_file = 'make_global_settings.gyp' |
33 | 33 |
34 test.run_gyp(gyp_file, | 34 test.run_gyp(gyp_file, |
35 # Teach the .gyp file about the location of my_nm.py and | 35 # Teach the .gyp file about the location of my_nm.py and |
36 # my_readelf.py, and the python executable. | 36 # my_readelf.py, and the python executable. |
37 '-Dworkdir=%s' % test.workdir, | 37 '-Dworkdir=%s' % test.workdir, |
38 '-Dpython=%s' % sys.executable) | 38 '-Dpython=%s' % sys.executable) |
39 test.build(gyp_file, arguments=['-v']) | 39 test.build(gyp_file, |
| 40 arguments=['-v'] if test.format == 'ninja-my_flavor' else []) |
40 | 41 |
41 expected = ['MY_CC', 'MY_CXX'] | 42 expected = ['MY_CC', 'MY_CXX'] |
42 test.must_contain_all_lines(test.stdout(), expected) | 43 test.must_contain_all_lines(test.stdout(), expected) |
43 | 44 |
44 test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM') | 45 test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM') |
45 test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF') | 46 test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF') |
46 | 47 |
47 test.pass_test() | 48 test.pass_test() |
OLD | NEW |