| 1 |
# This testing configuration handles running the test suite against LLVM's |
| 2 |
# libc++ using adb and a libc++_shared.so library on Android. |
| 3 |
|
| 4 |
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') |
| 5 |
|
| 6 |
import re |
| 7 |
import site |
| 8 |
|
| 9 |
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) |
| 10 |
|
| 11 |
import libcxx.test.android |
| 12 |
import libcxx.test.config |
| 13 |
import libcxx.test.params |
| 14 |
|
| 15 |
config.substitutions.append(('%{flags}', |
| 16 |
'--sysroot @CMAKE_SYSROOT@' if '@CMAKE_SYSROOT@' else '' |
| 17 |
)) |
| 18 |
|
| 19 |
compile_flags = '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/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)) |
| 29 |
|
| 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 |
| 32 |
# lookup. |
| 33 |
config.substitutions.append(('%{link_flags}', |
| 34 |
'-nostdlib++ -L %{lib-dir} -lc++_shared' |
| 35 |
)) |
| 36 |
config.substitutions.append(('%{exec}', |
| 37 |
'%{executor}' + |
| 38 |
' --job-limit-socket ' + libcxx.test.android.adb_job_limit_socket() + |
| 39 |
' --prepend-path-env LD_LIBRARY_PATH /data/local/tmp/libc++ --execdir %T -- ' |
| 40 |
)) |
| 41 |
|
| 42 |
libcxx.test.config.configure( |
| 43 |
libcxx.test.params.DEFAULT_PARAMETERS, |
| 44 |
libcxx.test.features.DEFAULT_FEATURES, |
| 45 |
config, |
| 46 |
lit_config |
| 47 |
) |