|
| 1 | +# |
| 2 | +# This testing configuration runs the test suite using the libstdc++ Standard library. |
| 3 | +# |
| 4 | +# The additional '--param libstdcxx-install-prefix=<PATH>' must be provided when invoking |
| 5 | +# lit for the configuration to find the appropriate headers and library. |
| 6 | +# |
| 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 | +# Basic configuration of the test suite |
| 13 | +config.name = 'libstdc++' |
| 14 | +config.test_source_root = os.path.join('@LIBCXX_SOURCE_DIR@', 'test') |
| 15 | +config.test_format = libcxx.test.format.CxxStandardLibraryTest() |
| 16 | +config.recursiveExpansionLimit = 10 |
| 17 | +config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test') |
| 18 | + |
| 19 | +# Additional parameters for libstdc++ |
| 20 | +LIBSTDCXX_PARAMETERS = [ |
| 21 | + libcxx.test.dsl.Parameter(name='libstdcxx-install-prefix', type=str, |
| 22 | + actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{libstdcxx-install-prefix}', path)], |
| 23 | + help=""" |
| 24 | + The installation prefix where libstdc++ was installed. This is used to find the libstdc++ headers, |
| 25 | + link against its built library, etc. |
| 26 | + """), |
| 27 | +] |
| 28 | + |
| 29 | +config.substitutions.append(('%{libcxx-dir}', '@LIBCXX_SOURCE_DIR@')) |
| 30 | + |
| 31 | +# Configure the compiler and flags |
| 32 | +config.compiler = "@CMAKE_CXX_COMPILER@" |
| 33 | +config.target_triple = "@LLVM_DEFAULT_TARGET_TRIPLE@" |
| 34 | +config.stdlib = 'libstdc++' |
| 35 | + |
| 36 | +config.substitutions.append(('%{flags}', |
| 37 | + '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '') |
| 38 | +)) |
| 39 | +config.substitutions.append(('%{compile_flags}', |
| 40 | + '-nostdinc++ -isystem %{libstdcxx-install-prefix}/include/c++/14 -isystem %{libstdcxx-install-prefix}/include/c++/14/aarch64-apple-darwin23 -I %{libcxx-dir}/test/support' |
| 41 | +)) |
| 42 | +config.substitutions.append(('%{link_flags}', |
| 43 | + '-nostdlib++ -L %{libstdcxx-install-prefix}/lib/gcc/14 -Wl,-rpath,%{libstdcxx-install-prefix}/lib/gcc/14 -lstdc++' |
| 44 | +)) |
| 45 | +config.substitutions.append(('%{exec}', |
| 46 | + '%{executor} --execdir %T -- ' |
| 47 | +)) |
| 48 | + |
| 49 | +import os, site |
| 50 | +site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) |
| 51 | +import libcxx.test.params, libcxx.test.config |
| 52 | +libcxx.test.config.configure( |
| 53 | + libcxx.test.params.DEFAULT_PARAMETERS + LIBSTDCXX_PARAMETERS, |
| 54 | + libcxx.test.features.DEFAULT_FEATURES, |
| 55 | + config, |
| 56 | + lit_config |
| 57 | +) |
0 commit comments