| OLD | NEW |
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 Import('env') | 6 Import('env') |
| 7 | 7 |
| 8 def AddTest(env, src, exit_status='0', golden_file=None, test_suffix='', | 8 def AddTest(env, src, exit_status='0', golden_file=None, test_suffix='', |
| 9 is_broken=False, compile_env=None, link_env=None, | 9 is_broken=False, compile_env=None, link_env=None, |
| 10 EXTRA_LIBS=[]): | 10 EXTRA_LIBS=[]): |
| 11 name = src.split('.')[0] + test_suffix | 11 name = src.split('.')[0] + test_suffix |
| 12 | 12 |
| 13 compile_env = compile_env or env | 13 compile_env = compile_env or env |
| 14 link_env = link_env or env | 14 link_env = link_env or env |
| 15 | 15 |
| 16 obj = compile_env.ComponentObject(name, src) | 16 obj = compile_env.ComponentObject(name, src) |
| 17 nexe = link_env.ComponentProgram( | 17 nexe = link_env.ComponentProgram( |
| 18 name, obj, EXTRA_LIBS=['${NONIRT_LIBS}'] + EXTRA_LIBS) | 18 name, obj, EXTRA_LIBS=['${NONIRT_LIBS}'] + EXTRA_LIBS) |
| 19 node = env.CommandSelLdrTestNacl( | 19 node = env.CommandSelLdrTestNacl( |
| 20 name + '.out', nexe, exit_status=exit_status, | 20 name + '.out', nexe, exit_status=exit_status, |
| 21 stdout_golden=golden_file) | 21 stdout_golden=golden_file) |
| 22 env.AddNodeToTestSuite( | 22 env.AddNodeToTestSuite( |
| 23 node, ['toolchain_tests', 'small_tests'], 'run_' + name + '_test', | 23 node, ['toolchain_tests', 'small_tests'], 'run_' + name + '_test', |
| 24 is_broken=is_broken) | 24 is_broken=is_broken) |
| 25 | 25 |
| 26 c_flags = ['-std=gnu99'] |
| 26 cxx_flags = (['-Wc++11-narrowing', '-std=gnu++11'] | 27 cxx_flags = (['-Wc++11-narrowing', '-std=gnu++11'] |
| 27 if env.Bit('bitcode') else ['-std=gnu++0x']) | 28 if env.Bit('bitcode') else ['-std=gnu++0x']) |
| 28 | 29 |
| 29 native_env = env.Clone() | 30 native_env = env.Clone() |
| 30 if env.Bit('bitcode'): | 31 if env.Bit('bitcode'): |
| 31 native_flags = [] | 32 native_flags = [] |
| 32 elif env.Bit('target_x86_32'): | 33 elif env.Bit('target_x86_32'): |
| 33 native_flags = ['-msse2', '-msse3', '-msse4'] | 34 native_flags = ['-msse2', '-msse3', '-msse4'] |
| 34 elif env.Bit('target_x86_64'): | 35 elif env.Bit('target_x86_64'): |
| 35 native_flags = ['-msse2', '-msse3', '-msse4'] | 36 native_flags = ['-msse2', '-msse3', '-msse4'] |
| 36 elif env.Bit('target_arm'): | 37 elif env.Bit('target_arm'): |
| 37 native_flags = ['--target=armv7a-unknown-nacl-gnueabi','-mfloat-abi=hard'] | 38 native_flags = ['--target=armv7a-unknown-nacl-gnueabi','-mfloat-abi=hard'] |
| 38 elif env.Bit('target_mips32'): | 39 elif env.Bit('target_mips32'): |
| 39 native_flags = [] | 40 native_flags = [] |
| 40 native_env.Append(CCFLAGS=native_flags + cxx_flags) | 41 native_env.Append(CFLAGS=c_flags) |
| 42 native_env.Append(CXXFLAGS=cxx_flags) |
| 43 native_env.Append(CCFLAGS=native_flags) |
| 41 | 44 |
| 42 ref_env = env.Clone() | 45 ref_env = env.Clone() |
| 43 ref_flags = ['-DVREFIMPL'] | 46 ref_flags = ['-DVREFIMPL'] |
| 44 ref_env.Append(CCFLAGS=ref_flags + cxx_flags) | 47 ref_env.Append(CFLAGS=c_flags) |
| 48 ref_env.Append(CXXFLAGS=cxx_flags) |
| 49 ref_env.Append(CCFLAGS=ref_flags) |
| 45 | 50 |
| 46 # TODO(jfb): The native environment currently doesn't compile. | 51 # TODO(jfb): The native environment currently doesn't compile. |
| 47 if env.Bit('bitcode'): | 52 if env.Bit('bitcode'): |
| 48 AddTest(native_env, 'simd.cc', test_suffix='_native') | 53 AddTest(native_env, 'simd.cc', test_suffix='_native') |
| 49 AddTest(ref_env, 'simd.cc', test_suffix='_ref') | 54 AddTest(ref_env, 'simd.cc', test_suffix='_ref') |
| 55 |
| 56 # GCC 4.4 doesn't support all features of the vector extensions in C. |
| 57 # TODO(jfb) Re-enable testing when we migrate to a newer GCC. |
| 58 if env.Bit('bitcode'): |
| 59 AddTest(ref_env, 'vector_extension.c', |
| 60 golden_file=ref_env.File('vector_extension.stdout')) |
| OLD | NEW |