gyptest-xctest.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. # Copyright (c) 2013 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 xctest targets are correctly configured.
  7. """
  8. import TestGyp
  9. import sys
  10. if sys.platform == 'darwin':
  11. test = TestGyp.TestGyp(formats=['xcode'])
  12. # Ignore this test if Xcode 5 is not installed
  13. import subprocess
  14. job = subprocess.Popen(['xcodebuild', '-version'],
  15. stdout=subprocess.PIPE,
  16. stderr=subprocess.STDOUT)
  17. out, err = job.communicate()
  18. if job.returncode != 0:
  19. raise Exception('Error %d running xcodebuild' % job.returncode)
  20. xcode_version, build_number = out.splitlines()
  21. # Convert the version string from 'Xcode 5.0' to ['5','0'].
  22. xcode_version = xcode_version.split()[-1].split('.')
  23. if xcode_version < ['5']:
  24. test.pass_test()
  25. CHDIR = 'xctest'
  26. test.run_gyp('test.gyp', chdir=CHDIR)
  27. test.build('test.gyp', chdir=CHDIR, arguments=['-scheme', 'classes', 'test'])
  28. test.built_file_must_match('tests.xctest/Contents/Resources/resource.txt',
  29. 'foo\n', chdir=CHDIR)
  30. test.pass_test()