| 1 |
# Testing configuration for back-deployment against older Apple system libc++. |
| 2 |
# |
| 3 |
# Under this configuration, we compile and link all the test suite against the latest libc++, |
| 4 |
# however we run against the libc++ on a different platform. This emulates the workflow of |
| 5 |
# a developer building their application using recent tools but with the goal of deploying |
| 6 |
# on existing devices running an older OS (and hence an older dylib). |
| 7 |
|
| 8 |
import os, site |
| 9 |
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) |
| 10 |
import libcxx.test.params, libcxx.test.config, libcxx.test.dsl |
| 11 |
|
| 12 |
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') |
| 13 |
|
| 14 |
BACKDEPLOYMENT_PARAMETERS = [ |
| 15 |
libcxx.test.dsl.Parameter(name='cxx_runtime_root', type=str, |
| 16 |
actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{cxx-runtime-root}', root)], |
| 17 |
help=""" |
| 18 |
The simulated root of the system (for libc++) when running tests. |
| 19 |
|
| 20 |
This should be a directory hierarchy under which the libc++ dylib can be found. |
| 21 |
The dylib in that hierarchy is the one that will be used at runtime when running |
| 22 |
the tests. |
| 23 |
"""), |
| 24 |
libcxx.test.dsl.Parameter(name='abi_runtime_root', type=str, |
| 25 |
actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{abi-runtime-root}', root)], |
| 26 |
help=""" |
| 27 |
The simulated root of the system (for libc++abi) when running tests. |
| 28 |
|
| 29 |
This should be a directory hierarchy under which the libc++abi dylib can be found. |
| 30 |
The dylib in that hierarchy is the one that will be used at runtime when running |
| 31 |
the tests. |
| 32 |
"""), |
| 33 |
libcxx.test.dsl.Parameter(name='unwind_runtime_root', type=str, |
| 34 |
actions=lambda root: [libcxx.test.dsl.AddSubstitution('%{unwind-runtime-root}', root)], |
| 35 |
help=""" |
| 36 |
The simulated root of the system (for libunwind) when running tests. |
| 37 |
|
| 38 |
This should be a directory hierarchy under which the libunwind dylib can be found. |
| 39 |
The dylib in that hierarchy is the one that will be used at runtime when running |
| 40 |
the tests. |
| 41 |
"""), |
| 42 |
] |
| 43 |
|
| 44 |
config.substitutions.append(('%{flags}', |
| 45 |
'-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '' |
| 46 |
)) |
| 47 |
config.substitutions.append(('%{compile_flags}', |
| 48 |
'-nostdinc++ -I %{include-dir} -I %{libcxx-dir}/test/support' |
| 49 |
)) |
| 50 |
config.substitutions.append(('%{link_flags}', |
| 51 |
'-nostdlib++ -L %{lib-dir} -lc++' |
| 52 |
)) |
| 53 |
config.substitutions.append(('%{exec}', |
| 54 |
'%{executor} --execdir %T --env DYLD_LIBRARY_PATH="%{cxx-runtime-root}:%{abi-runtime-root}:%{unwind-runtime-root}" -- ' |
| 55 |
)) |
| 56 |
|
| 57 |
config.stdlib = 'apple-libc++' |
| 58 |
config.using_system_stdlib = True |
| 59 |
|
| 60 |
libcxx.test.config.configure( |
| 61 |
libcxx.test.params.DEFAULT_PARAMETERS + BACKDEPLOYMENT_PARAMETERS, |
| 62 |
libcxx.test.features.DEFAULT_FEATURES, |
| 63 |
config, |
| 64 |
lit_config |
| 65 |
) |