Index: tests/toolchain/nacl.scons |
diff --git a/tests/toolchain/nacl.scons b/tests/toolchain/nacl.scons |
index c332995319294ed3a65e4e9001988f81459eec46..60c8965251e488ae116aac507c5114b1ba57a621 100644 |
--- a/tests/toolchain/nacl.scons |
+++ b/tests/toolchain/nacl.scons |
@@ -41,35 +41,46 @@ env.AddNodeToTestSuite(node, |
'run_whole_archive_test') |
-TESTS_TO_RUN = [ |
- # (src, exit_status, golden_file, cond), |
- # The valus None for golden_file means no golden file, c.f. |
- # SConstruct::CommandTest() |
- ('setlongjmp.c', '55', None, True), |
- ('intrinsics.cc', '55', None, True), |
- ('float2.c', '0', True, True), |
- ('frame_addresses.c', '0', None, True), |
- # NOTE: this test uses bitcode asm's |
- ('llvm_math_intrinsics.c', '0', True, env.Bit('bitcode')), |
- # NOTE: this test uses bitcode asm's |
- ('llvm_bitmanip_intrinsics.c', '0', True, env.Bit('bitcode')), |
- ('llvm_atomic_intrinsics.c', '55', None, True), |
-] |
- |
-for src, exit_status, golden_file, cond in TESTS_TO_RUN: |
- if not cond: continue |
- name = src.split('.')[0] |
- if golden_file == True: |
- golden_file = env.File(name + '.stdout') |
+# Test various intrinsics. |
+# Some of the intrinsic tests cover intrinsics that we do not want to |
+# support. For example, llvm.frameaddress. If that is the case, we will |
+# use the nonstable_env as our test_env in AddIntrinsicTest. |
+if env.Bit('bitcode'): |
+ nonstable_env = env.Clone() |
Mark Seaborn
2013/05/09 23:39:11
Need to move this line out of the conditional othe
jvoung (off chromium)
2013/05/09 23:48:26
Oops, how about set nonstable_env = env in the non
|
+ nonstable_env.Append(LINKFLAGS=['--pnacl-disable-abi-check']) |
- nexe = env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) |
- node = env.CommandSelLdrTestNacl(name + '.out', |
- nexe, |
- exit_status=exit_status, |
- stdout_golden=golden_file) |
- env.AddNodeToTestSuite(node, |
- ['toolchain_tests','small_tests'], |
- 'run_' + name + '_test') |
+def AddIntrinsicTest(test_env, src, exit_status, has_golden_file=False, |
+ cond=True): |
+ if not cond: |
+ return |
+ name = src.split('.')[0] |
+ if has_golden_file: |
+ golden_file = test_env.File(name + '.stdout') |
+ else: |
+ golden_file = None |
+ |
+ nexe = test_env.ComponentProgram(name, src, EXTRA_LIBS=['${NONIRT_LIBS}']) |
+ node = test_env.CommandSelLdrTestNacl(name + '.out', |
+ nexe, |
+ exit_status=exit_status, |
+ stdout_golden=golden_file) |
+ test_env.AddNodeToTestSuite(node, |
+ ['toolchain_tests','small_tests'], |
+ 'run_' + name + '_test') |
+ |
+AddIntrinsicTest(env, 'setlongjmp.c', '55') |
+AddIntrinsicTest(env, 'intrinsics.cc', '55'), |
+AddIntrinsicTest(env, 'float2.c', '0', has_golden_file=True) |
+# Consider llvm.frameaddress and llvm.returnaddress non-stable, |
+# since we may want to hide return and stack addresses in the future. |
+AddIntrinsicTest(nonstable_env, 'frame_addresses.c', '0'), |
+AddIntrinsicTest(nonstable_env, 'return_address.c', '55') |
+# TODO(jvoung): Revisit stability of llvm math, bitmanip, and atomic intrinsics. |
+AddIntrinsicTest(nonstable_env, 'llvm_math_intrinsics.c', '0', |
+ has_golden_file=True, cond=env.Bit('bitcode')) |
Mark Seaborn
2013/05/09 23:39:11
You could put this in an "if" instead of using the
jvoung (off chromium)
2013/05/09 23:48:26
Done.
|
+AddIntrinsicTest(nonstable_env, 'llvm_bitmanip_intrinsics.c', '0', |
+ has_golden_file=True, cond=env.Bit('bitcode')) |
+AddIntrinsicTest(nonstable_env, 'llvm_atomic_intrinsics.c', '55') |
# initfini test |
@@ -140,15 +151,6 @@ if env.IsRunningUnderValgrind(): |
Return() |
-nexe = env.ComponentProgram('return_address', 'return_address.c', |
- EXTRA_LIBS=['${NONIRT_LIBS}']) |
-node = env.CommandSelLdrTestNacl('return_address.out', |
- nexe, |
- exit_status='55') |
-env.AddNodeToTestSuite(node, |
- ['toolchain_tests', 'small_tests'], |
- 'run_return_address_test') |
- |
# NOTE: we assume that the incoming env contains '-O2', '-fomit-frame-pointer' |
def MakeEnv(use_opts, use_frames): |
new_env = env.Clone() |