Index: tests/minsfi/nacl.scons |
diff --git a/tests/minsfi/nacl.scons b/tests/minsfi/nacl.scons |
new file mode 100644 |
index 0000000000000000000000000000000000000000..805b35f1c9defc0465079a1c2f8294aa10d5670c |
--- /dev/null |
+++ b/tests/minsfi/nacl.scons |
@@ -0,0 +1,58 @@ |
+# 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') |
+ |
+if 'TRUSTED_ENV' not in env: |
+ Return() |
+trusted_env = env['TRUSTED_ENV'] |
+ |
+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(test_name, sandbox_name, ptrsize=0): |
+ bc_env = env.Clone() |
+ bc_env.Replace(CCFLAGS=[], LINKFLAGS=[]) |
+ |
+ name_trusted = 'test_%s_trusted' % test_name |
+ name_untrusted = 'test_%s_untrusted' % test_name |
+ name_untrusted_obj = '%s.o' % name_untrusted |
+ srcs_trusted = [ 'test_%s.c' % test_name ] |
+ 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.
|
+ |
+ if ptrsize == 0: |
+ ptrsize = 24 if trusted_env.Bit('build_x86_32') else 32 |
+ |
+ 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
|
+ test_pexe = bc_env.ComponentProgram(name_untrusted, [ test_file ]) |
+ |
+ opt_ptrsize = '-minsfi-ptrsize=%d ' % ptrsize |
+ opt_result = env.Command( |
+ test_name + '.minsfi.bc', [test_pexe], |
+ '${PNACLOPT} ' |
+ '-strip-debug ' |
+ '-minsfi-strip-tls ' |
+ '-pnacl-abi-simplify-preopt ' |
+ '-pnacl-abi-simplify-postopt ' |
+ '-minsfi ' |
+ + opt_ptrsize + |
+ '${SOURCES} -o ${TARGET}') |
+ |
+ llc_result = env.Command( |
+ test_name + '.minsfi.o', [opt_result], |
+ '${LLC} ' |
+ '${SOURCES} -o ${TARGET}') |
+ |
+ main = trusted_env.ComponentObject(name_trusted, srcs_trusted) |
+ 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
|
+ LIBS=['minsfi_runtime']) |
+ |
+ node = env.CommandTest('%s.out' % test_name, [prog]) |
+ env.AddNodeToTestSuite(node, |
+ ['small_tests', 'toolchain_tests', 'minsfi_tests'], |
+ 'run_minsfi_' + test_name + '_test') |
+ |
+CompileSandbox('memory_layout', 'dummy') |
+CompileSandbox('initializer', 'dummy') |