gyptest-objc-gc.py 1.5 KB

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