OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | 3 # Copyright (c) 2012 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 GC objc settings are handled correctly. | 8 Verifies that GC objc settings are handled correctly. |
9 """ | 9 """ |
10 | 10 |
11 import TestGyp | 11 import TestGyp |
| 12 import TestMac |
12 | 13 |
13 import sys | 14 import sys |
14 | 15 |
15 if sys.platform == 'darwin': | 16 if sys.platform == 'darwin': |
16 # set |match| to ignore build stderr output. | 17 # set |match| to ignore build stderr output. |
17 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], | 18 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], |
18 match = lambda a, b: True) | 19 match = lambda a, b: True) |
19 | 20 |
20 CHDIR = 'objc-gc' | 21 # Xcode 5.1 removed support for garbage-collection: |
21 test.run_gyp('test.gyp', chdir=CHDIR) | 22 # error: garbage collection is no longer supported |
| 23 if TestMac.Xcode.Version() < '0510': |
22 | 24 |
23 build_error_code = { | 25 CHDIR = 'objc-gc' |
24 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`) | 26 test.run_gyp('test.gyp', chdir=CHDIR) |
25 'make': 2, | |
26 'ninja': 1, | |
27 }[test.format] | |
28 | 27 |
29 test.build('test.gyp', 'gc_exe_fails', chdir=CHDIR, status=build_error_code) | 28 build_error_code = { |
30 test.build( | 29 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`) |
31 'test.gyp', 'gc_off_exe_req_lib', chdir=CHDIR, status=build_error_code) | 30 'make': 2, |
| 31 'ninja': 1, |
| 32 }[test.format] |
32 | 33 |
33 test.build('test.gyp', 'gc_req_exe', chdir=CHDIR) | 34 test.build('test.gyp', 'gc_exe_fails', chdir=CHDIR, status=build_error_code) |
34 test.run_built_executable('gc_req_exe', chdir=CHDIR, stdout="gc on: 1\n") | 35 test.build( |
| 36 'test.gyp', 'gc_off_exe_req_lib', chdir=CHDIR, status=build_error_code) |
35 | 37 |
36 test.build('test.gyp', 'gc_exe_req_lib', chdir=CHDIR) | 38 test.build('test.gyp', 'gc_req_exe', chdir=CHDIR) |
37 test.run_built_executable('gc_exe_req_lib', chdir=CHDIR, stdout="gc on: 1\n") | 39 test.run_built_executable('gc_req_exe', chdir=CHDIR, stdout="gc on: 1\n") |
38 | 40 |
39 test.build('test.gyp', 'gc_exe', chdir=CHDIR) | 41 test.build('test.gyp', 'gc_exe_req_lib', chdir=CHDIR) |
40 test.run_built_executable('gc_exe', chdir=CHDIR, stdout="gc on: 1\n") | 42 test.run_built_executable( |
| 43 'gc_exe_req_lib', chdir=CHDIR, stdout="gc on: 1\n") |
41 | 44 |
42 test.build('test.gyp', 'gc_off_exe', chdir=CHDIR) | 45 test.build('test.gyp', 'gc_exe', chdir=CHDIR) |
43 test.run_built_executable('gc_off_exe', chdir=CHDIR, stdout="gc on: 0\n") | 46 test.run_built_executable('gc_exe', chdir=CHDIR, stdout="gc on: 1\n") |
| 47 |
| 48 test.build('test.gyp', 'gc_off_exe', chdir=CHDIR) |
| 49 test.run_built_executable('gc_off_exe', chdir=CHDIR, stdout="gc on: 0\n") |
44 | 50 |
45 test.pass_test() | 51 test.pass_test() |
OLD | NEW |