1 # This testing configuration handles running the test suite against LLVM's
2 # libc++ using adb and a libc++_shared.so library on Android.
4 lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
9 site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
11 import libcxx.test.android
12 import libcxx.test.config
13 import libcxx.test.params
15 config.substitutions.append(('%{flags}',
16 '--sysroot @CMAKE_SYSROOT@' if '@CMAKE_SYSROOT@' else ''
19 compile_flags = '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support'
20 if re.match(r'i686-linux-android(21|22|23)$', config.target_triple):
21 # 32-bit x86 Android has a bug where the stack is sometimes misaligned.
22 # The problem appears limited to versions before Android N (API 24) and only
23 # __attribute__((constructor)) functions. Compile with -mstackrealign to
24 # work around the bug.
25 # TODO: Consider automatically doing something like this in Clang itself (LIBCXX-ANDROID-FIXME)
26 # See https://github.com/android/ndk/issues/693.
27 compile_flags += ' -mstackrealign'
28 config.substitutions.append(('%{compile_flags}', compile_flags))
30 # The NDK library is called "libc++_shared.so". Use LD_LIBRARY_PATH to find
31 # libc++_shared.so because older Bionic dynamic loaders don't support rpath
33 config.substitutions.append(('%{link_flags}',
34 '-nostdlib++ -L %{lib} -lc++_shared'
36 config.substitutions.append(('%{exec}',
38 ' --job-limit-socket ' + libcxx.test.android.adb_job_limit_socket() +
39 ' --prepend-path-env LD_LIBRARY_PATH /data/local/tmp/libc++ --execdir %T -- '
42 libcxx.test.config.configure(
43 libcxx.test.params.DEFAULT_PARAMETERS,
44 libcxx.test.features.DEFAULT_FEATURES,