| 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 | 6 Verifies that the user can override the compiler and linker using |
| 7 CC/CXX/NM/READELF environment variables. | 7 CC/CXX/NM/READELF environment variables. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import TestGyp | 10 import TestGyp |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 test = TestGyp.TestGyp(formats=['ninja']) | 37 test = TestGyp.TestGyp(formats=['ninja']) |
| 38 # Must set the test format to something with a flavor (the part after the '-') | 38 # Must set the test format to something with a flavor (the part after the '-') |
| 39 # in order to test the desired behavior. Since we want to run a non-host | 39 # in order to test the desired behavior. Since we want to run a non-host |
| 40 # toolchain, we have to set the flavor to something that the ninja generator | 40 # toolchain, we have to set the flavor to something that the ninja generator |
| 41 # doesn't know about, so it doesn't default to the host-specific tools (e.g., | 41 # doesn't know about, so it doesn't default to the host-specific tools (e.g., |
| 42 # 'otool' on mac to generate the .TOC). | 42 # 'otool' on mac to generate the .TOC). |
| 43 # | 43 # |
| 44 # Note that we can't just pass format=['ninja-some_toolchain'] to the | 44 # Note that we can't just pass format=['ninja-some_toolchain'] to the |
| 45 # constructor above, because then this test wouldn't be recognized as a ninja | 45 # constructor above, because then this test wouldn't be recognized as a ninja |
| 46 # format test. | 46 # format test. |
| 47 test.formats = ['ninja-some_flavor'] | 47 test.formats = ['ninja-my_flavor' if f == 'ninja' else f for f in test.formats] |
| 48 | 48 |
| 49 | 49 |
| 50 def TestTargetOverideSharedLib(): | 50 def TestTargetOverideSharedLib(): |
| 51 # The std output from nm and readelf is redirected to files, so we can't | 51 # The std output from nm and readelf is redirected to files, so we can't |
| 52 # expect their output to appear. Instead, check for the files they create to | 52 # expect their output to appear. Instead, check for the files they create to |
| 53 # see if they actually ran. | 53 # see if they actually ran. |
| 54 expected = ['my_cc.py', 'my_cxx.py', 'FOO'] | 54 expected = ['my_cc.py', 'my_cxx.py', 'FOO'] |
| 55 | 55 |
| 56 # Check that CC, CXX, NM, READELF, set target compiler | 56 # Check that CC, CXX, NM, READELF, set target compiler |
| 57 env = {'CC': 'python %s/my_cc.py FOO' % here, | 57 env = {'CC': 'python %s/my_cc.py FOO' % here, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 # Run the same tests once the eviron has been restored. The generated | 69 # Run the same tests once the eviron has been restored. The generated |
| 70 # projects should have embedded all the settings in the project files so the | 70 # projects should have embedded all the settings in the project files so the |
| 71 # results should be the same. | 71 # results should be the same. |
| 72 CheckCompiler(test, 'compiler-shared-lib.gyp', expected, False) | 72 CheckCompiler(test, 'compiler-shared-lib.gyp', expected, False) |
| 73 test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM') | 73 test.must_contain(test.built_file_path('RAN_MY_NM'), 'RAN_MY_NM') |
| 74 test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF') | 74 test.must_contain(test.built_file_path('RAN_MY_READELF'), 'RAN_MY_READELF') |
| 75 | 75 |
| 76 | 76 |
| 77 TestTargetOverideSharedLib() | 77 TestTargetOverideSharedLib() |
| 78 test.pass_test() | 78 test.pass_test() |
| OLD | NEW |