| Index: test/ios/gyptest-archs.py
|
| diff --git a/test/ios/gyptest-archs.py b/test/ios/gyptest-archs.py
|
| index 87d0657db512379d6a3f1961ae2b49131be63d9c..85f1b6af408dc1f4322fd1a8d048ee758d55e432 100644
|
| --- a/test/ios/gyptest-archs.py
|
| +++ b/test/ios/gyptest-archs.py
|
| @@ -11,19 +11,37 @@ Verifies that device and simulator bundles are built correctly.
|
| import plistlib
|
| import TestGyp
|
| import os
|
| +import re
|
| import struct
|
| import subprocess
|
| import sys
|
| import tempfile
|
|
|
|
|
| -def CheckFileType(file, expected):
|
| +def BuildExpected(file, archs):
|
| + if len(archs) == 1:
|
| + return 'Non-fat file: %s is architecture: %s' % (file, archs[0])
|
| + return 'Architectures in the fat file: %s are: %s' % (file, ' '.join(archs))
|
| +
|
| +
|
| +def CheckFileType(test, file, archs):
|
| proc = subprocess.Popen(['lipo', '-info', file], stdout=subprocess.PIPE)
|
| o = proc.communicate()[0].strip()
|
| assert not proc.returncode
|
| - if not expected in o:
|
| - print 'File: Expected %s, got %s' % (expected, o)
|
| + if len(archs) == 1:
|
| + pattern = re.compile('^Non-fat file: (.*) is architecture: (.*)$')
|
| + else:
|
| + pattern = re.compile('^Architectures in the fat file: (.*) are: (.*)$')
|
| + match = pattern.match(o)
|
| + if match is None:
|
| + print 'Ouput does not match expected pattern: %s' % (pattern.pattern)
|
| test.fail_test()
|
| + else:
|
| + found_file, found_archs = match.groups()
|
| + if found_file != file or set(found_archs.split()) != set(archs):
|
| + print 'Expected file %s with arch %s, got %s with arch %s' % (
|
| + file, ' '.join(archs), found_file, ' '.join(found_archs))
|
| + test.fail_test()
|
|
|
|
|
| def XcodeVersion():
|
| @@ -42,26 +60,42 @@ def GetStdout(cmdlist):
|
|
|
| if sys.platform == 'darwin':
|
| test = TestGyp.TestGyp()
|
| -
|
| - test.run_gyp('test-archs.gyp', chdir='app-bundle')
|
| - test.set_configuration('Default')
|
| -
|
| - # TODO(sdefresne): add 'Test Archs x86_64' once bots have been updated to
|
| - # a SDK version that supports "x86_64" architecture.
|
| - filenames = ['Test No Archs', 'Test Archs i386']
|
| - if XcodeVersion() >= '0500':
|
| - filenames.append('Test Archs x86_64')
|
| -
|
| - for filename in filenames:
|
| - target = filename.replace(' ', '_').lower()
|
| - test.build('test-archs.gyp', target, chdir='app-bundle')
|
| - result_file = test.built_file_path(
|
| - '%s.bundle/%s' % (filename, filename), chdir='app-bundle')
|
| - test.must_exist(result_file)
|
| -
|
| - expected = 'i386'
|
| - if 'x86_64' in filename:
|
| - expected = 'x86_64'
|
| - CheckFileType(result_file, expected)
|
| -
|
| - test.pass_test()
|
| + if test.format == 'ninja' or test.format == 'xcode':
|
| + test_cases = [
|
| + ('Default', 'Test No Archs', ['i386']),
|
| + ('Default', 'Test Arch 32-bits', ['i386']),
|
| + ('Default', 'Test Arch 64-bits', ['x86_64']),
|
| + ('Default', 'Test Multi Archs', ['i386', 'x86_64']),
|
| + ('Default-iphoneos', 'Test No Archs', ['armv7']),
|
| + ('Default-iphoneos', 'Test Arch 32-bits', ['armv7']),
|
| + ('Default-iphoneos', 'Test Arch 64-bits', ['arm64']),
|
| + ('Default-iphoneos', 'Test Multi Archs', ['armv7', 'arm64']),
|
| + ]
|
| +
|
| + xcode_version = XcodeVersion()
|
| + test.run_gyp('test-archs.gyp', chdir='app-bundle')
|
| + for configuration, name, archs in test_cases:
|
| + is_64_bit_build = ('arm64' in archs or 'x86_64' in archs)
|
| + is_device_build = configuration.endswith('-iphoneos')
|
| +
|
| + # TODO(sdefresne): remove this test once the bots have been updated to
|
| + # a SDK version that supports 64-bit architectures.
|
| + if xcode_version < '0500' and is_64_bit_build:
|
| + continue
|
| +
|
| + kwds = {}
|
| + if test.format == 'xcode' and is_device_build:
|
| + configuration, sdk = configuration.split('-')
|
| + kwds['arguments'] = ['-sdk', sdk]
|
| +
|
| + test.set_configuration(configuration)
|
| + product = name.replace(' ', '')
|
| + filename = '%s.bundle/%s' % (product, product)
|
| + target = name.replace(' ', '_').replace('-', '_').lower()
|
| + test.build('test-archs.gyp', target, chdir='app-bundle', **kwds)
|
| + result_file = test.built_file_path(filename, chdir='app-bundle')
|
| +
|
| + test.must_exist(result_file)
|
| + CheckFileType(test, result_file, archs)
|
| +
|
| + test.pass_test()
|
|
|