gyptest-xcode-gcc-clang.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 xcode-style GCC_... settings that require clang are handled
  7. properly.
  8. """
  9. import TestGyp
  10. import os
  11. import sys
  12. if sys.platform == 'darwin':
  13. test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
  14. CHDIR = 'xcode-gcc'
  15. test.run_gyp('test-clang.gyp', chdir=CHDIR)
  16. test.build('test-clang.gyp', 'aliasing_yes', chdir=CHDIR)
  17. test.run_built_executable('aliasing_yes', chdir=CHDIR, stdout="1\n")
  18. test.build('test-clang.gyp', 'aliasing_no', chdir=CHDIR)
  19. test.run_built_executable('aliasing_no', chdir=CHDIR, stdout="0\n")
  20. # The default behavior changed: strict aliasing used to be off, now it's on
  21. # by default. The important part is that this is identical for all generators
  22. # (which it is). TODO(thakis): Enable this once the bots have a newer Xcode.
  23. #test.build('test-clang.gyp', 'aliasing_default', chdir=CHDIR)
  24. #test.run_built_executable('aliasing_default', chdir=CHDIR, stdout="1\n")
  25. # For now, just check the generated ninja file:
  26. if test.format == 'ninja':
  27. contents = open(test.built_file_path('obj/aliasing_default.ninja',
  28. chdir=CHDIR)).read()
  29. if 'strict-aliasing' in contents:
  30. test.fail_test()
  31. test.pass_test()