| Index: test/win/gyptest-link_target_machine.py
|
| diff --git a/test/win/gyptest-link_target_machine.py b/test/win/gyptest-link_target_machine.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fc59ccabf81dc55cbf0d9ce87d75316e58fe96d9
|
| --- /dev/null
|
| +++ b/test/win/gyptest-link_target_machine.py
|
| @@ -0,0 +1,54 @@
|
| +#!/usr/bin/env python
|
| +
|
| +# Copyright (c) 2012 Google Inc. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +"""
|
| +Make sure target machine setting is extracted properly.
|
| +"""
|
| +
|
| +import TestGyp
|
| +
|
| +import os
|
| +import subprocess
|
| +import sys
|
| +
|
| +# Find /third_party/pefile based on current directory and script path.
|
| +sys.path.append(os.path.join(
|
| + os.path.dirname(__file__), '..', '..', '..', '..', 'third_party', 'pefile'))
|
| +sys.path.append(os.path.join(
|
| + os.path.dirname(__file__), '..', '..', '..', '..', '..',
|
| + 'third_party', 'pefile'))
|
| +import pefile
|
| +
|
| +if sys.platform == 'win32':
|
| + test = TestGyp.TestGyp(formats=['ninja', 'msvs'])
|
| +
|
| + CHDIR = 'linker_flags'
|
| + test.run_gyp('target-machine.gyp', chdir=CHDIR)
|
| + test.build('target-machine.gyp', test.ALL, chdir=CHDIR)
|
| +
|
| + MACHINE_TYPE_X86 = 0x14c
|
| + MACHINE_TYPE_AMD64 = 0x8664
|
| + x86 = pefile.PE(test.built_file_path('test_tm_x86.exe', chdir=CHDIR))
|
| + if x86.FILE_HEADER.Machine != MACHINE_TYPE_X86:
|
| + print 'Incorrect machine type.'
|
| + test.fail_test()
|
| + # TODO(scottmg): Toolchain doesn't support if x86 hosted, and we don't
|
| + # control which compiler we use very well right now.
|
| + #x64 = pefile.PE(test.built_file_path('test_tm_x64.exe', chdir=CHDIR))
|
| + #if x64.FILE_HEADER.Machine != MACHINE_TYPE_AMD64:
|
| + #print 'Incorrect machine type.'
|
| + #test.fail_test()
|
| +
|
| + if test.format == 'ninja':
|
| + ninja_file = test.built_file_path('obj/test_tm_x86.ninja', chdir=CHDIR)
|
| + test.must_contain(ninja_file, '/MACHINE:X86')
|
| +
|
| + #ninja_file = test.built_file_path('obj/test_tm_x64.ninja', chdir=CHDIR)
|
| + #test.must_contain(ninja_file, '/MACHINE:X64')
|
| +
|
| + # TODO(scottmg): There's a bunch of targets, but we don't use any of them.
|
| +
|
| + test.pass_test()
|
|
|