Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 Import('env') | |
| 6 | |
| 7 if 'TRUSTED_ENV' not in env: | |
| 8 Return() | |
| 9 trusted_env = env['TRUSTED_ENV'] | |
| 10 | |
| 11 if not env.Bit('bitcode') or not env.Bit('minsfi') or \ | |
| 12 not trusted_env.Bit('build_x86') or trusted_env.Bit('windows'): | |
| 13 Return() | |
| 14 | |
| 15 def CompileSandbox(test_name, sandbox_name, ptrsize=0): | |
| 16 bc_env = env.Clone() | |
| 17 bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) | |
| 18 | |
| 19 name_trusted = 'test_%s_trusted' % test_name | |
| 20 name_untrusted = 'test_%s_untrusted' % test_name | |
| 21 name_untrusted_obj = '%s.o' % name_untrusted | |
| 22 srcs_trusted = [ 'test_%s.c' % test_name ] | |
| 23 srcs_untrusted = [ 'sandbox_%s.c' % sandbox_name ] | |
|
jvoung (off chromium)
2014/09/08 23:18:47
Might be better to just have |sandbox_name| be the
dbrazdil
2014/09/09 00:57:53
Done.
| |
| 24 | |
| 25 if ptrsize == 0: | |
| 26 ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 | |
| 27 | |
| 28 test_file = bc_env.ComponentObject(name_untrusted_obj, srcs_untrusted) | |
|
jvoung (off chromium)
2014/09/08 23:18:47
Do you need this separate ComponentObject() invoca
dbrazdil
2014/09/09 00:57:53
I do need it, actually. If I gave it straight to C
| |
| 29 test_pexe = bc_env.ComponentProgram(name_untrusted, [ test_file ]) | |
| 30 | |
| 31 opt_ptrsize = '-minsfi-ptrsize=%d ' % ptrsize | |
| 32 opt_result = env.Command( | |
| 33 test_name + '.minsfi.bc', [test_pexe], | |
| 34 '${PNACLOPT} ' | |
| 35 '-strip-debug ' | |
| 36 '-minsfi-strip-tls ' | |
| 37 '-pnacl-abi-simplify-preopt ' | |
| 38 '-pnacl-abi-simplify-postopt ' | |
| 39 '-minsfi ' | |
| 40 + opt_ptrsize + | |
| 41 '${SOURCES} -o ${TARGET}') | |
| 42 | |
| 43 llc_result = env.Command( | |
| 44 test_name + '.minsfi.o', [opt_result], | |
| 45 '${LLC} ' | |
| 46 '${SOURCES} -o ${TARGET}') | |
| 47 | |
| 48 main = trusted_env.ComponentObject(name_trusted, srcs_trusted) | |
| 49 prog = trusted_env.ComponentProgram(test_name , [llc_result, main], | |
|
jvoung (off chromium)
2014/09/08 23:18:47
same, might be able to just pass srcs_trusted + ll
dbrazdil
2014/09/09 00:57:53
Done. Here's it's okay because it doesn't make sen
| |
| 50 LIBS=['minsfi_runtime']) | |
| 51 | |
| 52 node = env.CommandTest('%s.out' % test_name, [prog]) | |
| 53 env.AddNodeToTestSuite(node, | |
| 54 ['small_tests', 'toolchain_tests', 'minsfi_tests'], | |
| 55 'run_minsfi_' + test_name + '_test') | |
| 56 | |
| 57 CompileSandbox('memory_layout', 'dummy') | |
| 58 CompileSandbox('initializer', 'dummy') | |
| OLD | NEW |