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

Side by Side Diff: tests/toolchain/nacl.scons

Issue 639113003: Add nacl-clang testing to SCons (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # -*- python -*- 1 # -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 Import('env') 6 Import('env')
7 7
8 # force inclusion of entire library, so that we can validate it 8 # force inclusion of entire library, so that we can validate it
9 # NOTE: This approach does not work for -lc because of tons of 9 # NOTE: This approach does not work for -lc because of tons of
10 # undefined symbols which would have to be stubbed out 10 # undefined symbols which would have to be stubbed out
11 DEP_LIBS = ['nacl', 'srpc', 'imc_syscalls', 'platform', 'gio', 'pthread', 'm'] 11 DEP_LIBS = ['nacl', 'srpc', 'imc_syscalls', 'platform', 'gio', 'pthread', 'm']
12 12
13 # -lgcc is not exposed to the bitcode in PNaCl 13 # -lgcc is not exposed to the bitcode in PNaCl
14 if env.Bit('bitcode'): 14 if env.Bit('bitcode'):
15 LIBGCC = [] 15 LIBGCC = []
16 else: 16 else:
17 LIBGCC = ['-lgcc'] 17 LIBGCC = ['-lgcc']
18 18
19 DEP_LINKFLAGS = (['-Wl,--whole-archive'] + LIBGCC + 19 DEP_LINKFLAGS = (['-Wl,--whole-archive'] + LIBGCC +
20 ['-l' + name for name in DEP_LIBS] + 20 ['-l' + name for name in DEP_LIBS] +
21 ['-Wl,--no-whole-archive']) 21 ['-Wl,--no-whole-archive'])
22 22
23 # TODO(robertm): get rid of -allow-asm once we can distinguish 23 # TODO(robertm): get rid of -allow-asm once we can distinguish
24 # real asms from the redirect ones used here 24 # real asms from the redirect ones used here
25 if env.Bit('bitcode'): 25 if env.Bit('bitcode'):
26 env.Append(CCFLAGS=['-allow-asm']) 26 env.Append(CCFLAGS=['-allow-asm'])
27 27
28 # Test C++11 code with both supported C++ standard libraries. 28 # Test C++11 code with both supported C++ standard libraries.
29 cpp11_libs = ['libstdc++', 'libc++'] 29 cpp11_libs = ['libc++']
30 if env.Bit('bitcode'):
31 # PNaCl still supports libstdc++ but nacl-clang does not.
32 cpp11_libs.append('libstdc++')
30 cpp11_envs = {} 33 cpp11_envs = {}
31 for lib in cpp11_libs: 34 for lib in cpp11_libs:
32 cpp11_envs[lib] = env.Clone() 35 cpp11_envs[lib] = env.Clone()
33 cpp11_envs[lib].Append(CCFLAGS=['-std=c++11', '-stdlib=' + lib]) 36 cpp11_envs[lib].Append(CCFLAGS=['-std=c++11', '-stdlib=' + lib])
34 cpp11_envs[lib].Append(LINKFLAGS=['-stdlib=' + lib]) 37 cpp11_envs[lib].Append(LINKFLAGS=['-stdlib=' + lib])
35 38
36 # All the libraries were already included via -l switches in LINKFLAGS. 39 # All the libraries were already included via -l switches in LINKFLAGS.
37 # But we use them again in LIBS so scons knows about the dependencies. 40 # But we use them again in LIBS so scons knows about the dependencies.
38 # _LIBFLAGS is the internal variable that puts the expansion of LIBS 41 # _LIBFLAGS is the internal variable that puts the expansion of LIBS
39 # into the command line; so by clearing that, we prevent scons from 42 # into the command line; so by clearing that, we prevent scons from
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 AddIntrinsicTest(env, 'float2.c', '0', golden_file=env.File('float2.stdout')) 82 AddIntrinsicTest(env, 'float2.c', '0', golden_file=env.File('float2.stdout'))
80 AddIntrinsicTest(env, 'synchronization_sync.c', '0', 83 AddIntrinsicTest(env, 'synchronization_sync.c', '0',
81 # TODO(jfb) Blocked on bugs 3579 and 2981. This should 84 # TODO(jfb) Blocked on bugs 3579 and 2981. This should
82 # work on PNaCl because it avoids the broken 16-bit 85 # work on PNaCl because it avoids the broken 16-bit
83 # instructions on x86-32 by using 32-bit instructions. 86 # instructions on x86-32 by using 32-bit instructions.
84 # The test also exercises instructions that confuse valgrind. 87 # The test also exercises instructions that confuse valgrind.
85 is_broken=((env.Bit('target_x86_32') and 88 is_broken=((env.Bit('target_x86_32') and
86 not env.Bit('bitcode')) or 89 not env.Bit('bitcode')) or
87 env.IsRunningUnderValgrind())) 90 env.IsRunningUnderValgrind()))
88 AddIntrinsicTest(env, 'synchronization_volatile.c', '0') 91 AddIntrinsicTest(env, 'synchronization_volatile.c', '0')
89 if env.Bit('bitcode'): 92 if env.Bit('bitcode') or env.Bit('nacl_clang'):
90 # The following tests were only made to work on LLVM for 93 # The following tests were only made to work on LLVM for
91 # PNaCl. Command-line flags and libraries need to be updated for GCC 94 # PNaCl. Command-line flags and libraries need to be updated for GCC
92 # support. 95 # support.
93 # pthread is needed when building with libc++. 96 # pthread is needed when building with libc++.
94 for lib in cpp11_envs: 97 for lib in cpp11_envs:
95 AddIntrinsicTest(cpp11_envs[lib], 'condition_variable_cpp11.cc', '0', 98 AddIntrinsicTest(cpp11_envs[lib], 'condition_variable_cpp11.cc', '0',
96 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 99 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
97 AddIntrinsicTest(cpp11_envs[lib], 'future_cpp11.cc', '0', 100 AddIntrinsicTest(cpp11_envs[lib], 'future_cpp11.cc', '0',
98 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 101 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
99 AddIntrinsicTest(cpp11_envs[lib], 'mutex_cpp11.cc', '0', 102 AddIntrinsicTest(cpp11_envs[lib], 'mutex_cpp11.cc', '0',
100 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 103 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
101 AddIntrinsicTest(cpp11_envs[lib], 'synchronization_cpp11.cc', '0', 104 AddIntrinsicTest(cpp11_envs[lib], 'synchronization_cpp11.cc', '0',
102 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 105 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
103 AddIntrinsicTest(cpp11_envs[lib], 'thread_cpp11.cc', '0', 106 AddIntrinsicTest(cpp11_envs[lib], 'thread_cpp11.cc', '0',
104 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 107 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
105 if lib != 'libstdc++': 108 if lib != 'libstdc++':
106 # TODO(jfb) Can't compile with libstdc++. 109 # TODO(jfb) Can't compile with libstdc++.
107 AddIntrinsicTest(cpp11_envs[lib], 'long_double_cpp11.cc', '0', 110 AddIntrinsicTest(cpp11_envs[lib], 'long_double_cpp11.cc', '0',
108 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}']) 111 test_suffix=lib, EXTRA_LIBS=['${PTHREAD_LIBS}'])
109 112
110 # This test redirects C function calls to llvm instrinsic functions, 113 # This test redirects C function calls to llvm instrinsic functions,
111 # so they only work w/ PNaCl. 114 # so they only work w/ PNaCl.
112 if env.Bit('bitcode'): 115 if env.Bit('bitcode') or env.Bit('nacl_clang'):
113 AddIntrinsicTest(env, 'llvm_bitmanip_intrinsics.c', '0', 116 AddIntrinsicTest(env, 'llvm_bitmanip_intrinsics.c', '0',
114 golden_file=env.File('llvm_bitmanip_intrinsics.stdout')) 117 golden_file=env.File('llvm_bitmanip_intrinsics.stdout'))
115 AddIntrinsicTest(env, 'llvm_math_intrinsics.c', '0', 118 AddIntrinsicTest(env, 'llvm_math_intrinsics.c', '0',
116 golden_file=env.File('llvm_math_intrinsics.stdout')) 119 golden_file=env.File('llvm_math_intrinsics.stdout'))
117 # Also test the math functions with -ffast-math, so we are a tiny bit more 120 # Also test the math functions with -ffast-math, so we are a tiny bit more
118 # confident that sin() or __builtin_sin() doesn't get turned into 121 # confident that sin() or __builtin_sin() doesn't get turned into
119 # something like llvm.sin.f64. 122 # something like llvm.sin.f64.
120 fastmath_env = env.Clone() 123 fastmath_env = env.Clone()
121 fastmath_env.Append(CCFLAGS=['-ffast-math']) 124 fastmath_env.Append(CCFLAGS=['-ffast-math'])
122 AddIntrinsicTest(fastmath_env, 'llvm_math_intrinsics.c', '0', 125 AddIntrinsicTest(fastmath_env, 'llvm_math_intrinsics.c', '0',
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 new_env.Append(CCFLAGS=['-O2']) 244 new_env.Append(CCFLAGS=['-O2'])
242 else: 245 else:
243 new_env.FilterOut(CFLAGS=['-O2']) 246 new_env.FilterOut(CFLAGS=['-O2'])
244 new_env.FilterOut(CCFLAGS=['-O2']) 247 new_env.FilterOut(CCFLAGS=['-O2'])
245 new_env.FilterOut(LINKFLAGS=['-O3']) 248 new_env.FilterOut(LINKFLAGS=['-O3'])
246 return new_env 249 return new_env
247 250
248 EH_ENVIRONMENTS_TO_TRY = [] 251 EH_ENVIRONMENTS_TO_TRY = []
249 252
250 base_eh_env = env.Clone() 253 base_eh_env = env.Clone()
254
251 supports_cxx11 = env.Bit('bitcode') or env.Bit('target_arm') 255 supports_cxx11 = env.Bit('bitcode') or env.Bit('target_arm')
252 base_eh_env.Append(CPPDEFINES=[['SUPPORTS_CXX11', str(int(supports_cxx11))]]) 256 base_eh_env.Append(CPPDEFINES=[['SUPPORTS_CXX11', str(int(supports_cxx11))]])
253 if supports_cxx11: 257 if supports_cxx11:
254 # This flag is necessary for testing std::rethrow_exception(), at 258 # This flag is necessary for testing std::rethrow_exception(), at
255 # least when using libstdc++. 259 # least when using libstdc++.
256 base_eh_env.Append(CXXFLAGS=['-std=gnu++11']) 260 base_eh_env.Append(CXXFLAGS=['-std=gnu++11'])
257 261
258 if env.Bit('bitcode') and env['TOOLCHAIN_FEATURE_VERSION'] >= 1: 262 if env.Bit('bitcode') and env['TOOLCHAIN_FEATURE_VERSION'] >= 1:
259 for lib in ('libstdc++', 'libc++'): 263 for lib in ('libstdc++', 'libc++'):
260 sjlj_eh_env = base_eh_env.Clone() 264 sjlj_eh_env = base_eh_env.Clone()
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 mixedlink_env.Append(CCFLAGS=['-Wt,-force-align-stack']) 607 mixedlink_env.Append(CCFLAGS=['-Wt,-force-align-stack'])
604 nexe = mixedlink_env.ComponentProgram( 608 nexe = mixedlink_env.ComponentProgram(
605 'stackalign_test', 609 'stackalign_test',
606 ['call_with_misaligned_stack.S', 'stackalign_test.c'], 610 ['call_with_misaligned_stack.S', 'stackalign_test.c'],
607 EXTRA_LIBS=['${NONIRT_LIBS}']) 611 EXTRA_LIBS=['${NONIRT_LIBS}'])
608 node = mixedlink_env.CommandSelLdrTestNacl('stackalign.out', nexe) 612 node = mixedlink_env.CommandSelLdrTestNacl('stackalign.out', nexe)
609 mixedlink_env.AddNodeToTestSuite( 613 mixedlink_env.AddNodeToTestSuite(
610 node, 614 node,
611 ['nonpexe_tests', 'small_tests', 'toolchain_tests'], 615 ['nonpexe_tests', 'small_tests', 'toolchain_tests'],
612 'run_stackalign_test') 616 'run_stackalign_test')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698