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 Make sure target machine setting is extracted properly. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import os |
| 14 import subprocess |
| 15 import sys |
| 16 |
| 17 # Find /third_party/pefile based on current directory and script path. |
| 18 sys.path.append(os.path.join( |
| 19 os.path.dirname(__file__), '..', '..', '..', '..', 'third_party', 'pefile')) |
| 20 sys.path.append(os.path.join( |
| 21 os.path.dirname(__file__), '..', '..', '..', '..', '..', |
| 22 'third_party', 'pefile')) |
| 23 import pefile |
| 24 |
| 25 if sys.platform == 'win32': |
| 26 test = TestGyp.TestGyp(formats=['ninja', 'msvs']) |
| 27 |
| 28 CHDIR = 'linker_flags' |
| 29 test.run_gyp('target-machine.gyp', chdir=CHDIR) |
| 30 test.build('target-machine.gyp', test.ALL, chdir=CHDIR) |
| 31 |
| 32 MACHINE_TYPE_X86 = 0x14c |
| 33 MACHINE_TYPE_AMD64 = 0x8664 |
| 34 x86 = pefile.PE(test.built_file_path('test_tm_x86.exe', chdir=CHDIR)) |
| 35 if x86.FILE_HEADER.Machine != MACHINE_TYPE_X86: |
| 36 print 'Incorrect machine type.' |
| 37 test.fail_test() |
| 38 # TODO(scottmg): Toolchain doesn't support if x86 hosted, and we don't |
| 39 # control which compiler we use very well right now. |
| 40 #x64 = pefile.PE(test.built_file_path('test_tm_x64.exe', chdir=CHDIR)) |
| 41 #if x64.FILE_HEADER.Machine != MACHINE_TYPE_AMD64: |
| 42 #print 'Incorrect machine type.' |
| 43 #test.fail_test() |
| 44 |
| 45 if test.format == 'ninja': |
| 46 ninja_file = test.built_file_path('obj/test_tm_x86.ninja', chdir=CHDIR) |
| 47 test.must_contain(ninja_file, '/MACHINE:X86') |
| 48 |
| 49 #ninja_file = test.built_file_path('obj/test_tm_x64.ninja', chdir=CHDIR) |
| 50 #test.must_contain(ninja_file, '/MACHINE:X64') |
| 51 |
| 52 # TODO(scottmg): There's a bunch of targets, but we don't use any of them. |
| 53 |
| 54 test.pass_test() |
OLD | NEW |