OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 Import('env') | 5 Import('env') |
6 | 6 |
7 if 'TRUSTED_ENV' not in env: | 7 if 'TRUSTED_ENV' not in env: |
8 Return() | 8 Return() |
9 trusted_env = env['TRUSTED_ENV'] | 9 trusted_env = env['TRUSTED_ENV'] |
10 | 10 |
11 if not env.Bit('bitcode') or not env.Bit('minsfi') or \ | 11 if not env.Bit('bitcode') or not env.Bit('minsfi') or \ |
12 not trusted_env.Bit('build_x86') or trusted_env.Bit('windows'): | 12 not trusted_env.Bit('build_x86') or trusted_env.Bit('windows'): |
13 Return() | 13 Return() |
14 | 14 |
15 def CompileSandbox(test_name, exerciser_src, sandbox_src, ptrsize=0): | 15 def CompileSandbox(test_name, exerciser_src, sandbox_src, ptrsize=0, |
| 16 support_lib=True): |
16 if ptrsize == 0: | 17 if ptrsize == 0: |
17 ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 | 18 ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 |
18 | 19 |
19 bc_env = env.Clone() | 20 bc_env = env.Clone() |
20 bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) | 21 bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) |
| 22 if support_lib: |
| 23 bc_env.Append(LIBS=['minsfi_support']) |
| 24 bc_env.Append(LIBS=['c']) |
21 | 25 |
22 # Compile the untrusted file. | 26 # Compile the untrusted file. |
23 # We cannot pass the source file directly to the ComponentProgram call | 27 # We cannot pass the source file directly to the ComponentProgram call |
24 # because we want to reuse the same sandbox source for multiple tests and | 28 # because we want to reuse the same sandbox source for multiple tests and |
25 # that requires giving each instance a different object file name. | 29 # that requires giving each instance a different object file name. |
26 input_obj = bc_env.ComponentObject( | 30 input_obj = bc_env.ComponentObject( |
27 test_name + '.obj.bc', | 31 test_name + '.obj.bc', |
28 [sandbox_src]) | 32 [sandbox_src]) |
29 | 33 |
30 # Link bitcode files into a single module. (flags set in naclsdk.py) | 34 # Link bitcode files into a single module. (flags set in naclsdk.py) |
(...skipping 27 matching lines...) Expand all Loading... |
58 [llc_result, exerciser_src], | 62 [llc_result, exerciser_src], |
59 LIBS=['minsfi_runtime']) | 63 LIBS=['minsfi_runtime']) |
60 | 64 |
61 # Register the test. | 65 # Register the test. |
62 node = env.CommandTest('%s.out' % test_name, [prog]) | 66 node = env.CommandTest('%s.out' % test_name, [prog]) |
63 env.AddNodeToTestSuite( | 67 env.AddNodeToTestSuite( |
64 node, | 68 node, |
65 ['small_tests', 'toolchain_tests', 'minsfi_tests'], | 69 ['small_tests', 'toolchain_tests', 'minsfi_tests'], |
66 'run_minsfi_' + test_name + '_test') | 70 'run_minsfi_' + test_name + '_test') |
67 | 71 |
68 CompileSandbox('memory_layout', 'test_memory_layout.c', 'sandbox_dummy.c') | 72 CompileSandbox('memory_layout', 'test_memory_layout.c', 'sandbox_dummy.c', |
69 CompileSandbox('initializer', 'test_initializer.c', 'sandbox_dummy.c') | 73 support_lib=False) |
| 74 CompileSandbox('initializer', 'test_initializer.c', 'sandbox_dummy.c', |
| 75 support_lib=False) |
| 76 CompileSandbox('pointer_conversion', 'test_pointer_conversion.c', |
| 77 'sandbox_dummy.c', support_lib=False) |
| 78 CompileSandbox('invoke_args', 'test_invoke_args.c', 'sandbox_invoke_args.c') |
OLD | NEW |