OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 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. |
| 6 |
| 7 """ |
| 8 Tests things related to ARCHS. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import subprocess |
| 14 import sys |
| 15 |
| 16 if sys.platform == 'darwin': |
| 17 test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) |
| 18 |
| 19 def CheckFileType(file, expected): |
| 20 proc = subprocess.Popen(['file', '-b', file], stdout=subprocess.PIPE) |
| 21 o = proc.communicate()[0].strip() |
| 22 assert not proc.returncode |
| 23 if o != expected: |
| 24 print 'File: Expected %s, got %s' % (expected, o) |
| 25 test.fail_test() |
| 26 |
| 27 test.run_gyp('test-no-archs.gyp', chdir='archs') |
| 28 test.build('test-no-archs.gyp', test.ALL, chdir='archs') |
| 29 result_file = test.built_file_path('Test', chdir='archs') |
| 30 test.must_exist(result_file) |
| 31 CheckFileType(result_file, 'Mach-O executable i386') |
| 32 |
| 33 test.run_gyp('test-archs-x86_64.gyp', chdir='archs') |
| 34 test.build('test-archs-x86_64.gyp', test.ALL, chdir='archs') |
| 35 result_file = test.built_file_path('Test64', chdir='archs') |
| 36 test.must_exist(result_file) |
| 37 CheckFileType(result_file, 'Mach-O 64-bit executable x86_64') |
OLD | NEW |