Index: tests/minsfi/nacl.scons |
diff --git a/tests/minsfi/nacl.scons b/tests/minsfi/nacl.scons |
new file mode 100644 |
index 0000000000000000000000000000000000000000..46ccfda2b7e45ee295f516f327828d575d9cfb62 |
--- /dev/null |
+++ b/tests/minsfi/nacl.scons |
@@ -0,0 +1,52 @@ |
+# Copyright (c) 2014 The Native Client Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+Import('env') |
+ |
+trusted_env = env['TRUSTED_ENV'] |
jvoung (off chromium)
2014/09/05 00:32:00
You might have to test that trusted_env is not som
dbrazdil
2014/09/05 19:41:38
Done.
|
+if not env.Bit('bitcode') or not env.Bit('minsfi') or \ |
+ not trusted_env.Bit('build_x86') or trusted_env.Bit('windows'): |
+ Return() |
+ |
+def CompileSandbox(name, ptrsize=0): |
+ bc_env = env.Clone() |
+ bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) |
+ bc_env.Append(EXTRA_LIBS=['${NONIRT_LIBS}']) |
+ |
+ name_trusted = '%s_trusted' % name |
+ name_untrusted = '%s_untrusted' % name |
+ srcs_trusted = [ '%s.c' % name_trusted ] |
+ srcs_untrusted = [ '%s.c' % name_untrusted ] |
+ |
+ if ptrsize == 0: |
+ ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 |
+ |
+ bitcode_file = bc_env.ComponentObject(name_untrusted, srcs_untrusted) |
+ |
+ opt_ptrsize = '-minsfi-ptrsize=%d ' % ptrsize |
+ opt_result = env.Command( |
+ name + '.minsfi.bc', [bitcode_file], |
+ '${PNACLOPT} ' |
+ '-minsfi-strip-tls ' |
+ '-pnacl-abi-simplify-preopt ' |
+ '-pnacl-abi-simplify-postopt ' |
+ '-minsfi ' |
+ + opt_ptrsize + |
+ '${SOURCES} -o ${TARGET}') |
+ |
+ llc_result = env.Command( |
+ name + '.minsfi.o', [opt_result], |
+ '${LLC} ' |
+ '${SOURCES} -o ${TARGET}') |
+ |
+ main = trusted_env.ComponentObject(name_trusted, srcs_trusted) |
+ prog = trusted_env.ComponentProgram(name , [llc_result, main], |
+ EXTRA_LIBS=['minsfi_runtime']) |
+ |
+ node = env.CommandTest('%s.out' % name, [prog]) |
+ env.AddNodeToTestSuite(node, |
+ ['small_tests', 'toolchain_tests', 'nonpexe_tests'], |
+ 'run_minsfi_' + name + '_test') |
+ |
+CompileSandbox('init') |