Home | History | Annotate | Download | only in mac
      1 #!/usr/bin/env python
      2 
      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
      5 # found in the LICENSE file.
      6 
      7 """
      8 Verifies that GC objc settings are handled correctly.
      9 """
     10 
     11 import TestGyp
     12 
     13 import sys
     14 
     15 if sys.platform == 'darwin':
     16   # set |match| to ignore build stderr output.
     17   test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'],
     18                          match = lambda a, b: True)
     19 
     20   CHDIR = 'objc-gc'
     21   test.run_gyp('test.gyp', chdir=CHDIR)
     22 
     23   build_error_code = {
     24     'xcode': [1, 65],  # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`)
     25     'make': 2,
     26     'ninja': 1,
     27   }[test.format]
     28 
     29   test.build('test.gyp', 'gc_exe_fails', chdir=CHDIR, status=build_error_code)
     30   test.build(
     31       'test.gyp', 'gc_off_exe_req_lib', chdir=CHDIR, status=build_error_code)
     32 
     33   test.build('test.gyp', 'gc_req_exe', chdir=CHDIR)
     34   test.run_built_executable('gc_req_exe', chdir=CHDIR, stdout="gc on: 1\n")
     35 
     36   test.build('test.gyp', 'gc_exe_req_lib', chdir=CHDIR)
     37   test.run_built_executable('gc_exe_req_lib', chdir=CHDIR, stdout="gc on: 1\n")
     38 
     39   test.build('test.gyp', 'gc_exe', chdir=CHDIR)
     40   test.run_built_executable('gc_exe', chdir=CHDIR, stdout="gc on: 1\n")
     41 
     42   test.build('test.gyp', 'gc_off_exe', chdir=CHDIR)
     43   test.run_built_executable('gc_off_exe', chdir=CHDIR, stdout="gc on: 0\n")
     44 
     45   test.pass_test()
     46