| 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 TESTS_TO_RUN = [ | 44 # Test various intrinsics. | 
| 45      # (src, exit_status, golden_file, cond), | 45 # Some of the intrinsic tests cover intrinsics that we do not want to | 
| 46      # The valus None for golden_file means no golden file, c.f. | 46 # support. For example, llvm.frameaddress. If that is the case, we will | 
| 47      #  SConstruct::CommandTest() | 47 # use the nonstable_env as our test_env in AddIntrinsicTest. | 
| 48      ('setlongjmp.c', '55', None, True), | 48 if env.Bit('bitcode'): | 
| 49      ('intrinsics.cc', '55', None, True), | 49   nonstable_env = env.Clone() | 
| 50      ('float2.c', '0', True, True), | 50   nonstable_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) | 
| 51      ('frame_addresses.c', '0', None, True), | 51 else: | 
| 52      # NOTE: this test uses bitcode asm's | 52   nonstable_env = env | 
| 53      ('llvm_math_intrinsics.c', '0', True, env.Bit('bitcode')), |  | 
| 54      # NOTE: this test uses bitcode asm's |  | 
| 55      ('llvm_bitmanip_intrinsics.c', '0', True, env.Bit('bitcode')), |  | 
| 56      ('llvm_atomic_intrinsics.c', '55', None, True), |  | 
| 57 ] |  | 
| 58 | 53 | 
| 59 for src, exit_status, golden_file, cond in TESTS_TO_RUN: | 54 | 
| 60   if not cond: continue | 55 def AddIntrinsicTest(test_env, src, exit_status, has_golden_file=False): | 
| 61   name = src.split('.')[0] | 56   name = src.split('.')[0] | 
| 62   if golden_file == True: | 57   if has_golden_file: | 
| 63     golden_file = env.File(name + '.stdout') | 58     golden_file = test_env.File(name + '.stdout') | 
|  | 59   else: | 
|  | 60     golden_file = None | 
| 64 | 61 | 
| 65   nexe = env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) | 62   nexe = test_env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) | 
| 66   node = env.CommandSelLdrTestNacl(name + '.out', | 63   node = test_env.CommandSelLdrTestNacl(name + '.out', | 
| 67                                    nexe, | 64                                         nexe, | 
| 68                                    exit_status=exit_status, | 65                                         exit_status=exit_status, | 
| 69                                    stdout_golden=golden_file) | 66                                         stdout_golden=golden_file) | 
| 70   env.AddNodeToTestSuite(node, | 67   test_env.AddNodeToTestSuite(node, | 
| 71                          ['toolchain_tests','small_tests'], | 68                               ['toolchain_tests','small_tests'], | 
| 72                          'run_' + name + '_test') | 69                               'run_' + name + '_test') | 
|  | 70 | 
|  | 71 | 
|  | 72 AddIntrinsicTest(env, 'setlongjmp.c', '55') | 
|  | 73 AddIntrinsicTest(env, 'intrinsics.cc', '55'), | 
|  | 74 AddIntrinsicTest(env, 'float2.c', '0', has_golden_file=True) | 
|  | 75 # Consider llvm.frameaddress and llvm.returnaddress non-stable, | 
|  | 76 # since we may want to hide return and stack addresses in the future. | 
|  | 77 AddIntrinsicTest(nonstable_env, 'frame_addresses.c', '0'), | 
|  | 78 AddIntrinsicTest(nonstable_env, 'return_address.c', '55') | 
|  | 79 # TODO(jvoung): Revisit stability of llvm math, bitmanip, and atomic intrinsics. | 
|  | 80 if env.Bit('bitcode'): | 
|  | 81   # These two tests redirect C function calls to llvm instrinsic functions, | 
|  | 82   # so they only work w/ PNaCl. | 
|  | 83   AddIntrinsicTest(nonstable_env, 'llvm_math_intrinsics.c', '0', | 
|  | 84                    has_golden_file=True) | 
|  | 85   AddIntrinsicTest(nonstable_env, 'llvm_bitmanip_intrinsics.c', '0', | 
|  | 86                    has_golden_file=True) | 
|  | 87 AddIntrinsicTest(nonstable_env, 'llvm_atomic_intrinsics.c', '55') | 
| 73 | 88 | 
| 74 | 89 | 
| 75 # initfini test | 90 # initfini test | 
| 76 initfini_obj = env.ComponentObject('initfini.c') | 91 initfini_obj = env.ComponentObject('initfini.c') | 
| 77 | 92 | 
| 78 def AddInitFiniTest(env, name, extra_libs): | 93 def AddInitFiniTest(env, name, extra_libs): | 
| 79   nexe = env.ComponentProgram(name, | 94   nexe = env.ComponentProgram(name, | 
| 80                               [initfini_obj], | 95                               [initfini_obj], | 
| 81                               EXTRA_LIBS=extra_libs + ['${NONIRT_LIBS}']) | 96                               EXTRA_LIBS=extra_libs + ['${NONIRT_LIBS}']) | 
| 82   golden_file = env.File(name + '.stdout') | 97   golden_file = env.File(name + '.stdout') | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133 bias_env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'], | 148 bias_env.AddNodeToTestSuite(node, ['toolchain_tests', 'small_tests'], | 
| 134                             'run_pthread_cleanup_test') | 149                             'run_pthread_cleanup_test') | 
| 135 | 150 | 
| 136 | 151 | 
| 137 # NOTE: the tests below break easily under valgrid and since | 152 # NOTE: the tests below break easily under valgrid and since | 
| 138 #       they do not exercise malloc/free we exclude | 153 #       they do not exercise malloc/free we exclude | 
| 139 if env.IsRunningUnderValgrind(): | 154 if env.IsRunningUnderValgrind(): | 
| 140   Return() | 155   Return() | 
| 141 | 156 | 
| 142 | 157 | 
| 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' | 158 # NOTE: we assume that the incoming env contains '-O2', '-fomit-frame-pointer' | 
| 153 def MakeEnv(use_opts, use_frames): | 159 def MakeEnv(use_opts, use_frames): | 
| 154   new_env = env.Clone() | 160   new_env = env.Clone() | 
| 155   # AddBiasForPNaCl() is only needed for stack_frame.cc and eh_return.c. | 161   # AddBiasForPNaCl() is only needed for stack_frame.cc and eh_return.c. | 
| 156   if new_env.Bit('bitcode'): | 162   if new_env.Bit('bitcode'): | 
| 157     new_env.AddBiasForPNaCl() | 163     new_env.AddBiasForPNaCl() | 
| 158   new_env.FilterOut(CFLAGS=['-pedantic']) | 164   new_env.FilterOut(CFLAGS=['-pedantic']) | 
| 159   new_env.FilterOut(CCFLAGS=['-pedantic']) | 165   new_env.FilterOut(CCFLAGS=['-pedantic']) | 
| 160   if use_frames: | 166   if use_frames: | 
| 161     new_env.FilterOut(CFLAGS=['-fomit-frame-pointer']) | 167     new_env.FilterOut(CFLAGS=['-fomit-frame-pointer']) | 
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 355     env.AddNodeToTestSuite(node, | 361     env.AddNodeToTestSuite(node, | 
| 356                            ['toolchain_tests', 'small_tests'], | 362                            ['toolchain_tests', 'small_tests'], | 
| 357                            'run_' + name + '_test') | 363                            'run_' + name + '_test') | 
| 358   AddAlignedCodeTest('aligned_code', | 364   AddAlignedCodeTest('aligned_code', | 
| 359                      env.ComponentProgram('aligned_code', ['aligned_code.c'], | 365                      env.ComponentProgram('aligned_code', ['aligned_code.c'], | 
| 360                                           EXTRA_LIBS=['${NONIRT_LIBS}'])) | 366                                           EXTRA_LIBS=['${NONIRT_LIBS}'])) | 
| 361   if not env.Bit('nacl_disable_shared'): | 367   if not env.Bit('nacl_disable_shared'): | 
| 362     AddAlignedCodeTest('aligned_code_lib', | 368     AddAlignedCodeTest('aligned_code_lib', | 
| 363                        env.NaClSharedLibrary('aligned_code_lib', | 369                        env.NaClSharedLibrary('aligned_code_lib', | 
| 364                                              ['aligned_code_lib.c'])) | 370                                              ['aligned_code_lib.c'])) | 
| OLD | NEW | 
|---|