OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 # Copyright (c) 2013 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 .asm files can be compiled with MASM. |
| 9 """ |
| 10 |
| 11 import TestGyp |
| 12 |
| 13 import sys |
| 14 import os |
| 15 |
| 16 if sys.platform == 'win32': |
| 17 test = TestGyp.TestGyp(formats=['msvs', 'ninja']) |
| 18 |
| 19 if test.format == 'msvs' and not test.uses_msbuild: |
| 20 test.skip_test('Skipping test; MASM build rules are not supported for ' \ |
| 21 'MSVS versions < 2010') |
| 22 |
| 23 CHDIR = 'masm' |
| 24 test.run_gyp('masm.gyp', chdir=CHDIR) |
| 25 test.build('masm.gyp', 'hello_x86', chdir=CHDIR) |
| 26 |
| 27 test.run_built_executable('hello_x86', status=1, chdir=CHDIR) |
| 28 |
| 29 # Test that defines are passed through |
| 30 test.run_gyp('masm.gyp', '-D', 'test_defines=1', chdir=CHDIR) |
| 31 test.build('masm.gyp', 'hello_x86', chdir=CHDIR) |
| 32 |
| 33 test.run_built_executable('hello_x86', status=42, chdir=CHDIR) |
| 34 |
| 35 # While 64-bit executables can be compiled on any architecture, they can only |
| 36 # be run on truly 64-bit systems. Try to determine if the system supports x64. |
| 37 if (os.environ.get('PROCESSOR_ARCHITECTURE', '').find('64') >= 0 or |
| 38 os.environ.get('PROCESSOR_ARCHITEW6432', '').find('64') >= 0): |
| 39 native_64bit_supported = True |
| 40 else: |
| 41 native_64bit_supported = False |
| 42 |
| 43 test.run_gyp('masm.gyp', chdir=CHDIR) |
| 44 test.build('masm.gyp', 'hello_x64', chdir=CHDIR) |
| 45 |
| 46 if native_64bit_supported: |
| 47 test.run_built_executable('hello_x64', status=1, chdir=CHDIR) |
| 48 |
| 49 test.run_gyp('masm.gyp', '-D', 'test_defines=1', chdir=CHDIR) |
| 50 test.build('masm.gyp', 'hello_x64', chdir=CHDIR) |
| 51 |
| 52 if native_64bit_supported: |
| 53 test.run_built_executable('hello_x64', status=42, chdir=CHDIR) |
| 54 |
| 55 test.pass_test() |
OLD | NEW |