gyptest-archs.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 device and simulator bundles are built correctly.
  7. """
  8. import TestGyp
  9. import TestMac
  10. import collections
  11. import sys
  12. if sys.platform == 'darwin':
  13. test = TestGyp.TestGyp(formats=['ninja', 'xcode'])
  14. test_cases = [
  15. ('Default', 'TestArch32Bits', ['i386']),
  16. ('Default-iphoneos', 'TestArch32Bits', ['armv7']),
  17. ]
  18. if TestMac.Xcode.Version() < '0510':
  19. test_cases.extend([
  20. ('Default', 'TestNoArchs', ['i386']),
  21. ('Default-iphoneos', 'TestNoArchs', ['armv7'])])
  22. if TestMac.Xcode.Version() >= '0500':
  23. test_cases.extend([
  24. ('Default', 'TestArch64Bits', ['x86_64']),
  25. ('Default', 'TestMultiArchs', ['i386', 'x86_64']),
  26. ('Default-iphoneos', 'TestArch64Bits', ['arm64']),
  27. ('Default-iphoneos', 'TestMultiArchs', ['armv7', 'arm64'])])
  28. test.run_gyp('test-archs.gyp', chdir='app-bundle')
  29. for configuration, target, archs in test_cases:
  30. is_device_build = configuration.endswith('-iphoneos')
  31. kwds = collections.defaultdict(list)
  32. if test.format == 'xcode':
  33. if is_device_build:
  34. configuration, sdk = configuration.split('-')
  35. kwds['arguments'].extend(['-sdk', sdk])
  36. if TestMac.Xcode.Version() < '0500':
  37. kwds['arguments'].extend(['-arch', archs[0]])
  38. test.set_configuration(configuration)
  39. filename = '%s.bundle/%s' % (target, target)
  40. test.build('test-archs.gyp', target, chdir='app-bundle', **kwds)
  41. result_file = test.built_file_path(filename, chdir='app-bundle')
  42. test.must_exist(result_file)
  43. TestMac.CheckFileType(test, result_file, archs)
  44. test.pass_test()