OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 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 build of an executable with C++ defines. | 8 Verifies build of an executable with C++ defines. |
9 """ | 9 """ |
10 | 10 |
11 import TestGyp | 11 import TestGyp |
12 | 12 |
13 test = TestGyp.TestGyp() | 13 test = TestGyp.TestGyp() |
14 | 14 |
15 test.run_gyp('defines.gyp') | 15 test.run_gyp('defines.gyp') |
16 | 16 |
17 test.build('defines.gyp') | |
18 | |
19 expect = """\ | 17 expect = """\ |
20 FOO is defined | 18 FOO is defined |
21 VALUE is 1 | 19 VALUE is 1 |
22 2*PAREN_VALUE is 12 | 20 2*PAREN_VALUE is 12 |
23 HASH_VALUE is a#1 | |
24 """ | 21 """ |
| 22 |
| 23 #CMake loudly warns about passing '#' to the compiler and drops the define. |
| 24 expect_stderr = '' |
| 25 if test.format == 'cmake': |
| 26 expect_stderr = ( |
| 27 """WARNING: Preprocessor definitions containing '#' may not be passed on the""" |
| 28 """ compiler command line because many compilers do not support it.\n""" |
| 29 """CMake is dropping a preprocessor definition: HASH_VALUE="a#1"\n""" |
| 30 """Consider defining the macro in a (configured) header file.\n\n""") |
| 31 else: |
| 32 expect += """HASH_VALUE is a#1 |
| 33 """ |
| 34 |
| 35 test.build('defines.gyp', stderr=expect_stderr) |
| 36 |
25 test.run_built_executable('defines', stdout=expect) | 37 test.run_built_executable('defines', stdout=expect) |
26 | 38 |
27 test.pass_test() | 39 test.pass_test() |
OLD | NEW |