1 #!/usr/bin/env python 2 3 # Copyright (c) 2013 Google Inc. All rights reserved. 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 7 """ 8 Verifies that device and simulator bundles are built correctly. 9 """ 10 11 import TestGyp 12 import TestMac 13 14 import collections 15 import sys 16 17 18 if sys.platform == 'darwin': 19 test = TestGyp.TestGyp(formats=['ninja', 'xcode']) 20 21 test_cases = [ 22 ('Default', 'TestArch32Bits', ['i386']), 23 ('Default-iphoneos', 'TestArch32Bits', ['armv7']), 24 ] 25 26 if TestMac.Xcode.Version() < '0510': 27 test_cases.extend([ 28 ('Default', 'TestNoArchs', ['i386']), 29 ('Default-iphoneos', 'TestNoArchs', ['armv7'])]) 30 31 if TestMac.Xcode.Version() >= '0500': 32 test_cases.extend([ 33 ('Default', 'TestArch64Bits', ['x86_64']), 34 ('Default', 'TestMultiArchs', ['i386', 'x86_64']), 35 ('Default-iphoneos', 'TestArch64Bits', ['arm64']), 36 ('Default-iphoneos', 'TestMultiArchs', ['armv7', 'arm64'])]) 37 38 test.run_gyp('test-archs.gyp', chdir='app-bundle') 39 for configuration, target, archs in test_cases: 40 is_device_build = configuration.endswith('-iphoneos') 41 42 kwds = collections.defaultdict(list) 43 if test.format == 'xcode': 44 if is_device_build: 45 configuration, sdk = configuration.split('-') 46 kwds['arguments'].extend(['-sdk', sdk]) 47 if TestMac.Xcode.Version() < '0500': 48 kwds['arguments'].extend(['-arch', archs[0]]) 49 50 test.set_configuration(configuration) 51 filename = '%s.bundle/%s' % (target, target) 52 test.build('test-archs.gyp', target, chdir='app-bundle', **kwds) 53 result_file = test.built_file_path(filename, chdir='app-bundle') 54 55 test.must_exist(result_file) 56 TestMac.CheckFileType(test, result_file, archs) 57 58 test.pass_test() 59