Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 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 a default gyp define can be overridden. | 8 Verifies that a default gyp define can be overridden. |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import os | 11 import os |
| 12 import TestGyp | 12 import TestGyp |
| 13 | 13 |
| 14 test = TestGyp.TestGyp() | 14 test = TestGyp.TestGyp() |
| 15 | 15 |
| 16 #CMake loudly warns about passing '#' to the compiler and drops the define. | |
|
Nico
2013/11/19 16:35:28
nit: space after #
bungeman-chromium
2013/11/20 20:54:51
Done.
| |
| 17 expect_stderr = '' | |
| 18 if test.format == 'cmake': | |
| 19 expect_stderr = ( | |
| 20 """WARNING: Preprocessor definitions containing '#' may not be passed on the""" | |
| 21 """ compiler command line because many compilers do not support it.\n""" | |
| 22 """CMake is dropping a preprocessor definition: HASH_VALUE="a#1"\n""" | |
| 23 """Consider defining the macro in a (configured) header file.\n\n""") | |
| 24 | |
| 16 # Command-line define | 25 # Command-line define |
| 17 test.run_gyp('defines.gyp', '-D', 'OS=fakeos') | 26 test.run_gyp('defines.gyp', '-D', 'OS=fakeos') |
| 18 test.build('defines.gyp') | 27 test.build('defines.gyp', stderr=expect_stderr) |
| 19 test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) | 28 test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) |
| 20 # Clean up the exe so subsequent tests don't find an old exe. | 29 # Clean up the exe so subsequent tests don't find an old exe. |
| 21 os.remove(test.built_file_path('fakeosprogram', type=test.EXECUTABLE)) | 30 os.remove(test.built_file_path('fakeosprogram', type=test.EXECUTABLE)) |
| 22 | 31 |
| 23 # Without "OS" override, fokeosprogram shouldn't be built. | 32 # Without "OS" override, fokeosprogram shouldn't be built. |
| 24 test.run_gyp('defines.gyp') | 33 test.run_gyp('defines.gyp') |
| 25 test.build('defines.gyp') | 34 test.build('defines.gyp', stderr=expect_stderr) |
| 26 test.built_file_must_not_exist('fakeosprogram', type=test.EXECUTABLE) | 35 test.built_file_must_not_exist('fakeosprogram', type=test.EXECUTABLE) |
| 27 | 36 |
| 28 # Environment define | 37 # Environment define |
| 29 os.environ['GYP_DEFINES'] = 'OS=fakeos' | 38 os.environ['GYP_DEFINES'] = 'OS=fakeos' |
| 30 test.run_gyp('defines.gyp') | 39 test.run_gyp('defines.gyp') |
| 31 test.build('defines.gyp') | 40 test.build('defines.gyp', stderr=expect_stderr) |
| 32 test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) | 41 test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) |
| 33 | 42 |
| 34 test.pass_test() | 43 test.pass_test() |
| OLD | NEW |