gyptest-objc-gc.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 sys
  10. if sys.platform == 'darwin':
  11. # set |match| to ignore build stderr output.
  12. test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'],
  13. match = lambda a, b: True)
  14. CHDIR = 'objc-gc'
  15. test.run_gyp('test.gyp', chdir=CHDIR)
  16. build_error_code = {
  17. 'xcode': [1, 65], # 1 for xcode 3, 65 for xcode 4 (see `man sysexits`)
  18. 'make': 2,
  19. 'ninja': 1,
  20. }[test.format]
  21. test.build('test.gyp', 'gc_exe_fails', chdir=CHDIR, status=build_error_code)
  22. test.build(
  23. 'test.gyp', 'gc_off_exe_req_lib', chdir=CHDIR, status=build_error_code)
  24. test.build('test.gyp', 'gc_req_exe', chdir=CHDIR)
  25. test.run_built_executable('gc_req_exe', chdir=CHDIR, stdout="gc on: 1\n")
  26. test.build('test.gyp', 'gc_exe_req_lib', chdir=CHDIR)
  27. test.run_built_executable('gc_exe_req_lib', chdir=CHDIR, stdout="gc on: 1\n")
  28. test.build('test.gyp', 'gc_exe', chdir=CHDIR)
  29. test.run_built_executable('gc_exe', chdir=CHDIR, stdout="gc on: 1\n")
  30. test.build('test.gyp', 'gc_off_exe', chdir=CHDIR)
  31. test.run_built_executable('gc_off_exe', chdir=CHDIR, stdout="gc on: 0\n")
  32. test.pass_test()