|
| 1 | +# |
| 2 | +# This testing configuration runs the test suite using the libstdc++ Standard library. |
| 3 | +# |
| 4 | +# The additional '--param libstdcxx-install-prefix=<PATH>', '--param libstdcxx-triple=<TRIPLE>' and |
| 5 | +# '--param libstdcxx-version=<VERSION>' lit parameters must be provided when invoking lit for the |
| 6 | +# configuration to find the appropriate headers and library. |
| 7 | +# |
| 8 | +# For example: |
| 9 | +# |
| 10 | +# $ ./libcxx/utils/libcxx-lit <BUILD> -sv libcxx/test/std --param libstdcxx-install-prefix=/opt/homebrew/Cellar/gcc/14.1.0_1 \ |
| 11 | +# --param libstdcxx-version=14 \ |
| 12 | +# --param libstdcxx-triple=aarch64-apple-darwin22 |
| 13 | +# |
| 14 | + |
| 15 | +lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') |
| 16 | + |
| 17 | +import os, site |
| 18 | +site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) |
| 19 | +import libcxx.test.params, libcxx.test.config, libcxx.test.dsl |
| 20 | + |
| 21 | +# Additional parameters for libstdc++ |
| 22 | +LIBSTDCXX_PARAMETERS = [ |
| 23 | + libcxx.test.dsl.Parameter(name='libstdcxx-install-prefix', type=str, |
| 24 | + actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-install-prefix}', path)], |
| 25 | + help=""" |
| 26 | + The installation prefix where libstdc++ was installed. This is used to find the libstdc++ headers, |
| 27 | + link against its built library, etc. |
| 28 | + """), |
| 29 | + libcxx.test.dsl.Parameter(name='libstdcxx-triple', type=str, |
| 30 | + actions=lambda triple: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-triple}', triple)], |
| 31 | + help=""" |
| 32 | + The target triple used for the target-specific include directory of libstdc++. This is used to find the |
| 33 | + libstdc++ headers. |
| 34 | + """), |
| 35 | + libcxx.test.dsl.Parameter(name='libstdcxx-version', type=str, |
| 36 | + actions=lambda version: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-version}', version)], |
| 37 | + help=""" |
| 38 | + The version of libstdc++. This is used to find the libstdc++ headers and library. |
| 39 | + """), |
| 40 | +] |
| 41 | + |
| 42 | +# Configure the compiler and flags |
| 43 | +config.substitutions.append(('%{flags}', |
| 44 | + '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '') |
| 45 | +)) |
| 46 | +config.substitutions.append(('%{compile_flags}', |
| 47 | + '-nostdinc++ -isystem %{libstdcxx-install-prefix}/include/c++/%{libstdcxx-version} -isystem %{libstdcxx-install-prefix}/include/c++/%{libstdcxx-version}/%{libstdcxx-triple} -I %{libcxx-dir}/test/support' |
| 48 | +)) |
| 49 | +config.substitutions.append(('%{link_flags}', |
| 50 | + '-nostdlib++ -L %{libstdcxx-install-prefix}/lib/gcc/%{libstdcxx-version} -Wl,-rpath,%{libstdcxx-install-prefix}/lib/gcc/%{libstdcxx-version} -lstdc++' |
| 51 | +)) |
| 52 | +config.substitutions.append(('%{exec}', |
| 53 | + '%{executor} --execdir %T -- ' |
| 54 | +)) |
| 55 | + |
| 56 | +import os, site |
| 57 | +site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) |
| 58 | +import libcxx.test.params, libcxx.test.config |
| 59 | +libcxx.test.config.configure( |
| 60 | + libcxx.test.params.DEFAULT_PARAMETERS + LIBSTDCXX_PARAMETERS, |
| 61 | + libcxx.test.features.DEFAULT_FEATURES, |
| 62 | + config, |
| 63 | + lit_config |
| 64 | +) |
0 commit comments