Index: test/mac/gyptest-archs.py |
=================================================================== |
--- test/mac/gyptest-archs.py (revision 1785) |
+++ test/mac/gyptest-archs.py (working copy) |
@@ -17,21 +17,35 @@ |
if sys.platform == 'darwin': |
test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
- def CheckFileType(file, expected): |
- proc = subprocess.Popen(['file', '-b', file], stdout=subprocess.PIPE) |
+ def GetStdout(cmdlist): |
+ proc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE) |
o = proc.communicate()[0].strip() |
assert not proc.returncode |
+ return o |
+ |
+ def CheckFileType(file, expected): |
+ o = GetStdout(['file', '-b', file]) |
if not re.match(expected, o, re.DOTALL): |
print 'File: Expected %s, got %s' % (expected, o) |
test.fail_test() |
+ def XcodeVersion(): |
+ xcode, build = GetStdout(['xcodebuild', '-version']).splitlines() |
+ xcode = xcode.split()[-1].replace('.', '') |
+ xcode = (xcode + '0' * (3 - len(xcode))).zfill(4) |
+ return xcode |
+ |
test.run_gyp('test-no-archs.gyp', chdir='archs') |
test.build('test-no-archs.gyp', test.ALL, chdir='archs') |
result_file = test.built_file_path('Test', chdir='archs') |
test.must_exist(result_file) |
- # FIXME: The default setting changed from i386 to x86_64 in Xcode 5. |
- #CheckFileType(result_file, '^Mach-O executable i386') |
+ if XcodeVersion() >= '0500': |
+ expected_type = '^Mach-O 64-bit executable x86_64$' |
+ else: |
+ expected_type = '^Mach-O executable i386$' |
+ CheckFileType(result_file, expected_type) |
+ |
test.run_gyp('test-archs-x86_64.gyp', chdir='archs') |
test.build('test-archs-x86_64.gyp', test.ALL, chdir='archs') |
result_file = test.built_file_path('Test64', chdir='archs') |