Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | # Copyright (c) 2014 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 | Test VCCLCompilerTool EnableEnhancedInstructionSet setting. |
| 9 | """ |
| 10 | |
| 11 | import TestGyp |
| 12 | |
| 13 | import os |
| 14 | import sys |
| 15 | |
| 16 | if sys.platform == 'win32': |
| 17 | print "This test is currently disabled: https://crbug.com/483696." |
| 18 | sys.exit(0) |
| 19 | |
| 20 | test = TestGyp.TestGyp() |
| 21 | |
| 22 | CHDIR = 'compiler-flags' |
| 23 | test.run_gyp('enable-enhanced-instruction-set.gyp', chdir=CHDIR) |
| 24 | |
| 25 | test.build('enable-enhanced-instruction-set.gyp', test.ALL, chdir=CHDIR) |
| 26 | |
| 27 | test.run_built_executable('sse_extensions', chdir=CHDIR, |
| 28 | stdout='/arch:SSE\n') |
| 29 | test.run_built_executable('sse2_extensions', chdir=CHDIR, |
| 30 | stdout='/arch:SSE2\n') |
| 31 | |
| 32 | # /arch:AVX introduced in VS2010, but MSBuild support lagged until 2012. |
| 33 | if os.path.exists(test.built_file_path('avx_extensions')): |
| 34 | test.run_built_executable('avx_extensions', chdir=CHDIR, |
| 35 | stdout='/arch:AVX\n') |
| 36 | |
| 37 | # /arch:IA32 introduced in VS2012. |
| 38 | if os.path.exists(test.built_file_path('no_extensions')): |
| 39 | test.run_built_executable('no_extensions', chdir=CHDIR, |
| 40 | stdout='/arch:IA32\n') |
| 41 | |
| 42 | # /arch:AVX2 introduced in VS2013r2. |
| 43 | if os.path.exists(test.built_file_path('avx2_extensions')): |
| 44 | test.run_built_executable('avx2_extensions', chdir=CHDIR, |
| 45 | stdout='/arch:AVX2\n') |
| 46 | |
| 47 | test.pass_test() |