Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: tests/callingconv_case_by_case/nacl.scons

Issue 8502006: Extend callingconv_case_by_case test to exercise the "pnaclcall" (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Also turn on other test. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/callingconv_case_by_case/for_each_type.h ('k') | tests/callingconv_case_by_case/return_structs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/callingconv_case_by_case/nacl.scons
diff --git a/tests/callingconv_case_by_case/nacl.scons b/tests/callingconv_case_by_case/nacl.scons
index a92d4a264b313d6dc0d0967b183c8bb50e83ce8e..2a6d5093d123426e43b2063402326400f7af12b4 100644
--- a/tests/callingconv_case_by_case/nacl.scons
+++ b/tests/callingconv_case_by_case/nacl.scons
@@ -13,56 +13,99 @@ Import('env')
# MODULE0(cc1) -> MODULE0(cc1) -> MODULE1(cc2) -> MODULE2(cc2) -> MODULE3(cc1).
# For the return test, the dataflow is reversed.
-# Environments for building module sources
-envlist = []
+# For x86-64, there is a compatibility flag and calling conv attribute.
+# We use the same framework to test those as well.
-# For nacl-gcc, only do a self-test.
-# For ARM, there is no nacl-gcc so only do a self-test.
-# Otherwise, mix them up!
-if not env.Bit('bitcode') or env.Bit('target_arm'):
- if not env.Bit('bitcode'):
- # Assume that for nacl-gcc, the bots have at least sse2.
- env.Append(CCFLAGS=['-msse2'])
+
+# List of (4 envs for the modules, link_env, test_name_suffix)
+# to apply to each source. The 4 envs may have different flags.
+test_configurations = []
+
+def AddCommonFlags(envlist):
robertm 2011/11/16 20:38:28 I think it would be better to sort of inline this,
jvoung - send to chromium... 2011/11/17 23:06:01 Well there's the part where it needs to give each
+ for (i, e) in enumerate(envlist):
+ # Add -Wno-long-long because we use c99 long long constants in C++ code.
+ e.Append(CCFLAGS=['-DMODULE' + str(i), '-Wno-long-long'])
+
+def MakeSelfTestEnv(base_env, extra_flags):
robertm 2011/11/16 20:38:28 more explanation for how this is used would not hu
jvoung - send to chromium... 2011/11/17 23:06:01 Done.
+ base_env = base_env.Clone()
+ base_env.Append(CCFLAGS=extra_flags)
+ envlist = []
for i in xrange(4):
- envlist.append(env.Clone()) # Same CC for all...
- link_env = env
-else:
+ envlist.append(base_env.Clone()) # Same CC for all...
+ AddCommonFlags(envlist)
+ link_env = base_env
+ return (envlist, link_env)
+
+def MakeCrossEnvs(base_env, extra_gcc_flags, extra_pnacl_flags):
+ envlist = []
# For module0
- cc1_env = env.Clone()
+ cc1_env = base_env.Clone()
cc1_env.PNaClForceNative()
+ cc1_env.Append(CCFLAGS=extra_pnacl_flags)
envlist.append(cc1_env)
# For module1
- cc2_env = env.PNaClGetNNaClEnv()
- # Assume that for nacl-gcc, the bots have at least sse2.
- cc2_env.Append(CCFLAGS=['-msse2'])
- # Add nacl-gcc compatibility flag (to be committed).
- # cc2_env.Append(CCFLAGS=['-mstructs-on-stack'])
+ cc2_env = base_env.PNaClGetNNaClEnv()
+ cc2_env.Append(CCFLAGS=extra_gcc_flags)
envlist.append(cc2_env)
envlist.append(cc2_env.Clone()) # For module2
envlist.append(cc1_env.Clone()) # For module3
-
link_env = cc1_env # To allow linking native objects (from ForceNative).
+ AddCommonFlags(envlist)
+ return (envlist, link_env)
-for (i, e) in enumerate(envlist):
- # Add -Wno-long-long because we use c99 long long constants in C++ code.
- e.Append(CCFLAGS=['-DMODULE' + str(i), '-Wno-long-long'])
+if not env.Bit('bitcode'):
+ # For gcc, only do a self-consistency test.
+ # Assume for nacl-gcc the bots have at least sse2.
+ envlist, link_env = MakeSelfTestEnv(env, ['-msse2'])
+ test_configurations.append((envlist, link_env, ''))
+else:
+ if env.Bit('target_arm'):
+ # For arm, there is no gcc, so just test pnacl (via native objects).
+ native_env = env.Clone()
+ native_env.PNaClForceNative()
+ envlist, link_env = MakeSelfTestEnv(native_env, [])
+ test_configurations.append((envlist, link_env, ''))
+ elif env.Bit('target_x86_32'):
+ # For x86-32 there is gcc, but no compatibility flags.
+ envlist, link_env = MakeCrossEnvs(env, ['-msse2'], [])
+ test_configurations.append((envlist, link_env, ''))
+ elif env.Bit('target_x86_64'):
+ # For x86-64 PNaCl we have more things to test.
+ # First test the command line flag.
+ envlist, link_env = MakeCrossEnvs(env,
+ ['-msse2', '-mpnacl-cconv'], [])
+ test_configurations.append((envlist, link_env, ''))
+ envlist, link_env = MakeCrossEnvs(env,
+ ['-msse2', '-DTEST_ATTRIBUTE_VIA_DECL'],
+ [])
+ test_configurations.append((envlist, link_env, '_decl'))
+ envlist, link_env = MakeCrossEnvs(env,
+ ['-msse2', '-DTEST_ATTRIBUTE_VIA_FP'],
+ [])
+ test_configurations.append((envlist, link_env, '_fp'))
+ else:
+ raise "Unknown target architecture!"
-# Once the gcc flag is added (and/or if we do something with llvm).
-tis_broken = env.Bit('bitcode') and env.Bit('target_x86_64')
-
-for test_source in ["return_structs.cc",
- "call_structs.cc"]:
- test_name = test_source.split('.')[0]
- objfiles = []
- for (i, e) in enumerate(envlist):
- obj = e.ComponentObject(test_name + '.' + str(i), test_source)
- objfiles.append(obj)
+# Helper function to make test nodes.
robertm 2011/11/16 20:38:28 it might be simpler to not inline this one
jvoung - send to chromium... 2011/11/17 23:06:01 Done (you mean to inline this one).
+def MakeProgramAndTest(objfiles, test_name):
prog = link_env.ComponentProgram(test_name,
objfiles,
EXTRA_LIBS=['${NONIRT_LIBS}'])
node = env.CommandSelLdrTestNacl(test_name + '.out',
prog)
- env.AddNodeToTestSuite(node, ['small_tests'],
- 'run_' + test_name + '_test',
- is_broken=tis_broken)
+ env.AddNodeToTestSuite(node, ['small_tests', 'toolchain_tests'],
+ 'run_' + test_name + '_test')
+
+######################################################################
+
+for test_source in ['return_structs.cc',
+ 'call_structs.cc']:
+ test_name = test_source.split('.')[0]
+ for (envlist, link_env, test_suffix) in test_configurations:
+ objfiles = []
+ for (i, e) in enumerate(envlist):
+ obj = e.ComponentObject(test_name + test_suffix + '.' + str(i),
+ test_source)
+ objfiles.append(obj)
+ MakeProgramAndTest(objfiles, test_name + test_suffix)
« no previous file with comments | « tests/callingconv_case_by_case/for_each_type.h ('k') | tests/callingconv_case_by_case/return_structs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698