Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 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 # force inclusion of entire library, so that we can validate it | 8 # force inclusion of entire library, so that we can validate it |
| 9 # NOTE: This approach does not work for -lc because of tons of | 9 # NOTE: This approach does not work for -lc because of tons of |
| 10 # undefined symbols which would have to be stubbed out | 10 # undefined symbols which would have to be stubbed out |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 EXTRA_LINKFLAGS=DEP_LINKFLAGS, | 34 EXTRA_LINKFLAGS=DEP_LINKFLAGS, |
| 35 LIBS=DEP_LIBS, | 35 LIBS=DEP_LIBS, |
| 36 _LIBFLAGS='') | 36 _LIBFLAGS='') |
| 37 node = env.CommandValidatorTestNacl('whole_archive_test.out', | 37 node = env.CommandValidatorTestNacl('whole_archive_test.out', |
| 38 image=nexe) | 38 image=nexe) |
| 39 env.AddNodeToTestSuite(node, | 39 env.AddNodeToTestSuite(node, |
| 40 ['toolchain_tests', 'small_tests'], | 40 ['toolchain_tests', 'small_tests'], |
| 41 'run_whole_archive_test') | 41 'run_whole_archive_test') |
| 42 | 42 |
| 43 | 43 |
| 44 # Test various intrinsics. | |
| 45 | |
| 46 # Some of the intrinsic tests cover intrinsics that we do not want to | |
| 47 # support. For example, llvm.frameaddress. If that is the case, we will set | |
| 48 # the 'stable_bitcode' field to False in the TESTS_TO_RUN list. | |
| 49 if env.Bit('bitcode'): | |
| 50 nonstable_env = env.Clone() | |
| 51 nonstable_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) | |
| 52 else: | |
| 53 nonstable_env = env | |
| 54 | |
| 44 TESTS_TO_RUN = [ | 55 TESTS_TO_RUN = [ |
| 45 # (src, exit_status, golden_file, cond), | 56 # (src, exit_status, golden_file, stable_bitcode, cond), |
|
Mark Seaborn
2013/05/09 21:26:37
This is getting hard to read -- too many fields.
jvoung (off chromium)
2013/05/09 23:31:43
Good idea! Done.
| |
| 46 # The valus None for golden_file means no golden file, c.f. | 57 # The valus None for golden_file means no golden file, c.f. |
| 47 # SConstruct::CommandTest() | 58 # SConstruct::CommandTest() |
| 48 ('setlongjmp.c', '55', None, True), | 59 ('setlongjmp.c', '55', None, True, True), |
| 49 ('intrinsics.cc', '55', None, True), | 60 ('intrinsics.cc', '55', None, True, True), |
| 50 ('float2.c', '0', True, True), | 61 ('float2.c', '0', True, True, True), |
| 51 ('frame_addresses.c', '0', None, True), | 62 # Consider llvm.frameaddress and llvm.returnaddress non-stable, |
| 52 # NOTE: this test uses bitcode asm's | 63 # since we may want to hide return and stack addresses in the future. |
| 53 ('llvm_math_intrinsics.c', '0', True, env.Bit('bitcode')), | 64 ('frame_addresses.c', '0', None, False, True), |
| 54 # NOTE: this test uses bitcode asm's | 65 ('return_address.c', '55', None, False, True), |
| 55 ('llvm_bitmanip_intrinsics.c', '0', True, env.Bit('bitcode')), | 66 # Revisit stability of llvm math intrinsics. |
| 56 ('llvm_atomic_intrinsics.c', '55', None, True), | 67 ('llvm_math_intrinsics.c', '0', True, False, env.Bit('bitcode')), |
| 68 # Revisit stability of llvm bitmanip intrinsics. | |
| 69 ('llvm_bitmanip_intrinsics.c', '0', True, False, env.Bit('bitcode')), | |
| 70 # Revisit stability of llvm atomic intrinsics. | |
| 71 ('llvm_atomic_intrinsics.c', '55', None, False, True), | |
| 57 ] | 72 ] |
| 58 | 73 |
| 59 for src, exit_status, golden_file, cond in TESTS_TO_RUN: | 74 for src, exit_status, golden_file, stable_bitcode, cond in TESTS_TO_RUN: |
| 60 if not cond: continue | 75 if not cond: continue |
| 61 name = src.split('.')[0] | 76 name = src.split('.')[0] |
| 62 if golden_file == True: | 77 if golden_file == True: |
| 63 golden_file = env.File(name + '.stdout') | 78 golden_file = env.File(name + '.stdout') |
| 64 | 79 |
| 65 nexe = env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) | 80 if stable_bitcode: |
|
Mark Seaborn
2013/05/09 21:26:37
How about this to reduce duplication:
if stable_bi
jvoung (off chromium)
2013/05/09 23:31:43
Reduced duplication.
| |
| 81 nexe = env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) | |
| 82 else: | |
| 83 nexe = nonstable_env.ComponentProgram(name, | |
| 84 src, EXTRA_LIBS=['${NONIRT_LIBS}']) | |
| 66 node = env.CommandSelLdrTestNacl(name + '.out', | 85 node = env.CommandSelLdrTestNacl(name + '.out', |
| 67 nexe, | 86 nexe, |
| 68 exit_status=exit_status, | 87 exit_status=exit_status, |
| 69 stdout_golden=golden_file) | 88 stdout_golden=golden_file) |
| 70 env.AddNodeToTestSuite(node, | 89 env.AddNodeToTestSuite(node, |
| 71 ['toolchain_tests','small_tests'], | 90 ['toolchain_tests','small_tests'], |
| 72 'run_' + name + '_test') | 91 'run_' + name + '_test') |
| 73 | 92 |
| 74 | 93 |
| 75 # initfini test | 94 # initfini test |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 bias_env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'], | 152 bias_env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'], |
| 134 'run_pthread_cleanup_test') | 153 'run_pthread_cleanup_test') |
| 135 | 154 |
| 136 | 155 |
| 137 # NOTE: the tests below break easily under valgrid and since | 156 # NOTE: the tests below break easily under valgrid and since |
| 138 # they do not exercise malloc/free we exclude | 157 # they do not exercise malloc/free we exclude |
| 139 if env.IsRunningUnderValgrind(): | 158 if env.IsRunningUnderValgrind(): |
| 140 Return() | 159 Return() |
| 141 | 160 |
| 142 | 161 |
| 143 nexe = env.ComponentProgram('return_address', 'return_address.c', | |
| 144 EXTRA_LIBS=['${NONIRT_LIBS}']) | |
| 145 node = env.CommandSelLdrTestNacl('return_address.out', | |
| 146 nexe, | |
| 147 exit_status='55') | |
| 148 env.AddNodeToTestSuite(node, | |
| 149 ['toolchain_tests', 'small_tests'], | |
| 150 'run_return_address_test') | |
| 151 | |
| 152 # NOTE: we assume that the incoming env contains '-O2', '-fomit-frame-pointer' | 162 # NOTE: we assume that the incoming env contains '-O2', '-fomit-frame-pointer' |
| 153 def MakeEnv(use_opts, use_frames): | 163 def MakeEnv(use_opts, use_frames): |
| 154 new_env = env.Clone() | 164 new_env = env.Clone() |
| 155 # AddBiasForPNaCl() is only needed for stack_frame.cc and eh_return.c. | 165 # AddBiasForPNaCl() is only needed for stack_frame.cc and eh_return.c. |
| 156 if new_env.Bit('bitcode'): | 166 if new_env.Bit('bitcode'): |
| 157 new_env.AddBiasForPNaCl() | 167 new_env.AddBiasForPNaCl() |
| 158 new_env.FilterOut(CFLAGS=['-pedantic']) | 168 new_env.FilterOut(CFLAGS=['-pedantic']) |
| 159 new_env.FilterOut(CCFLAGS=['-pedantic']) | 169 new_env.FilterOut(CCFLAGS=['-pedantic']) |
| 160 if use_frames: | 170 if use_frames: |
| 161 new_env.FilterOut(CFLAGS=['-fomit-frame-pointer']) | 171 new_env.FilterOut(CFLAGS=['-fomit-frame-pointer']) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 env.AddNodeToTestSuite(node, | 365 env.AddNodeToTestSuite(node, |
| 356 ['toolchain_tests', 'small_tests'], | 366 ['toolchain_tests', 'small_tests'], |
| 357 'run_' + name + '_test') | 367 'run_' + name + '_test') |
| 358 AddAlignedCodeTest('aligned_code', | 368 AddAlignedCodeTest('aligned_code', |
| 359 env.ComponentProgram('aligned_code', ['aligned_code.c'], | 369 env.ComponentProgram('aligned_code', ['aligned_code.c'], |
| 360 EXTRA_LIBS=['${NONIRT_LIBS}'])) | 370 EXTRA_LIBS=['${NONIRT_LIBS}'])) |
| 361 if not env.Bit('nacl_disable_shared'): | 371 if not env.Bit('nacl_disable_shared'): |
| 362 AddAlignedCodeTest('aligned_code_lib', | 372 AddAlignedCodeTest('aligned_code_lib', |
| 363 env.NaClSharedLibrary('aligned_code_lib', | 373 env.NaClSharedLibrary('aligned_code_lib', |
| 364 ['aligned_code_lib.c'])) | 374 ['aligned_code_lib.c'])) |
| OLD | NEW |