3 # Copyright (c) 2012 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.
8 Tests things related to ARCHS.
18 if sys.platform == 'darwin':
19 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
21 test.run_gyp('test-no-archs.gyp', chdir='archs')
22 test.build('test-no-archs.gyp', test.ALL, chdir='archs')
23 result_file = test.built_file_path('Test', chdir='archs')
24 test.must_exist(result_file)
26 if TestMac.Xcode.Version() >= '0500':
27 expected_type = ['x86_64']
29 expected_type = ['i386']
30 TestMac.CheckFileType(test, result_file, expected_type)
32 test.run_gyp('test-archs-x86_64.gyp', chdir='archs')
33 test.build('test-archs-x86_64.gyp', test.ALL, chdir='archs')
34 result_file = test.built_file_path('Test64', chdir='archs')
35 test.must_exist(result_file)
36 TestMac.CheckFileType(test, result_file, ['x86_64'])
38 if test.format != 'make':
39 # Build all targets except 'exe_32_64_no_sources' that does build
40 # but should not cause error when generating ninja files
42 'static_32_64', 'shared_32_64', 'shared_32_64_bundle',
43 'module_32_64', 'module_32_64_bundle',
44 'exe_32_64', 'exe_32_64_bundle', 'precompiled_prefix_header_mm_32_64',
47 test.run_gyp('test-archs-multiarch.gyp', chdir='archs')
48 for target in targets:
49 test.build('test-archs-multiarch.gyp', target=target, chdir='archs')
51 result_file = test.built_file_path(
52 'static_32_64', chdir='archs', type=test.STATIC_LIB)
53 test.must_exist(result_file)
54 TestMac.CheckFileType(test, result_file, ['i386', 'x86_64'])
56 result_file = test.built_file_path(
57 'shared_32_64', chdir='archs', type=test.SHARED_LIB)
58 test.must_exist(result_file)
59 TestMac.CheckFileType(test, result_file, ['i386', 'x86_64'])
61 result_file = test.built_file_path('My Framework.framework/My Framework',
63 test.must_exist(result_file)
64 TestMac.CheckFileType(test, result_file, ['i386', 'x86_64'])
65 # Check that symbol "_x" made it into both versions of the binary:
66 if not all(['D _x' in subprocess.check_output(
67 ['nm', '-arch', arch, result_file]) for arch in ['i386', 'x86_64']]):
68 # This can only flakily fail, due to process ordering issues. If this
69 # does fail flakily, then something's broken, it's not the test at fault.
72 result_file = test.built_file_path(
73 'exe_32_64', chdir='archs', type=test.EXECUTABLE)
74 test.must_exist(result_file)
75 TestMac.CheckFileType(test, result_file, ['i386', 'x86_64'])
77 result_file = test.built_file_path('Test App.app/Contents/MacOS/Test App',
79 test.must_exist(result_file)
80 TestMac.CheckFileType(test, result_file, ['i386', 'x86_64'])