llvm-project/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
Louis Dionne 0e8208eca1
[libc++] Run the Lit test suite against an installed version of the library (#96910)
We always strive to test libc++ as close as possible to the way we are
actually shipping it. This was approximated reasonably well by setting
up the minimal driver flags when running the test suite, however we were
running the test suite against the library located in the build
directory.

This patch improves the situation by installing the library (the
headers, the built library, modules, etc) into a fake location and then
running the test suite against that fake "installation root".

This should open the door to getting rid of the temporary copy of the
headers we make during the build process, however this is left for a
future improvement.

Note that this adds quite a bit of verbosity whenever running the test
suite because we install the headers beforehand every time. We should be
able to override this to silence it, however CMake doesn't currently
give us a way to do that, see https://gitlab.kitware.com/cmake/cmake/-/issues/26085.
2024-08-28 09:23:00 -04:00

41 lines
1.5 KiB
INI

# This testing configuration handles running the test suite against LLVM's libc++
# using a DLL, with Clang-cl on Windows. This variant sets _HAS_EXCEPTIONS = 0
# which removes exception class definitions from the vcruntime.
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
dbg_include = ''
runtime_library = '@CMAKE_MSVC_RUNTIME_LIBRARY@'
if runtime_library == '' or runtime_library.endswith('DLL'):
fms_runtime_lib = 'dll'
cxx_lib = 'msvcprt'
else:
fms_runtime_lib = 'static'
cxx_lib = 'libcpmt'
if '@CMAKE_BUILD_TYPE@'.upper() == 'DEBUG':
dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h'
fms_runtime_lib += '_dbg'
cxx_lib += 'd'
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
'-fms-runtime-lib=' + fms_runtime_lib + ' -nostdinc++ -I %{include-dir} -I %{target-include-dir} -I %{libcxx-dir}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + dbg_include
))
config.substitutions.append(('%{link_flags}',
'-nostdlib -L %{lib-dir} -lc++ -l' + cxx_lib
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --prepend_env PATH=%{install-prefix}/bin -- '
))
import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.config
libcxx.test.config.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)