[libc++] Add from-scratch testing configs for Windows

The paths to the compiler and to the python executable may need to
be quoted (if they're installed into e.g. C:\Program Files).

All testing commands that are executed expect a gcc compatible command
line interface, while clang-cl uses different command line options.
In the original testing config, if the chosen compiler was clang-cl, it
was replaced with clang++ by looking for such an executable in the path.

For the new from-scratch test configs, I instead chose to add
"--driver-mode=g++" to flags - invoking "clang-cl --driver-mode=g++"
has the same effect as invoking "clang++", without needing to run any
heuristics for picking a different compiler executable.

Differential Revision: https://reviews.llvm.org/D111202
This commit is contained in:
Martin Storsjö 2021-12-08 20:54:21 +02:00
parent fd64544fbe
commit 7176799a7e
5 changed files with 105 additions and 3 deletions

View File

@ -2,6 +2,8 @@
@SERIALIZED_LIT_PARAMS@
import shlex
#
# This file performs the bridge between the CMake configuration and the Lit
# configuration files by setting up the LitConfig object and various Lit
@ -23,7 +25,7 @@ config.recursiveExpansionLimit = 10
config.test_exec_root = '@CMAKE_BINARY_DIR@'
# Add substitutions for bootstrapping the test suite configuration
config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@')))
config.substitutions.append(('%{libcxx}', '@LIBCXX_SOURCE_DIR@'))
config.substitutions.append(('%{install}', '@CMAKE_BINARY_DIR@'))
config.substitutions.append(('%{include}', '%{install}/@LIBCXX_INSTALL_INCLUDE_DIR@'))

View File

@ -0,0 +1,32 @@
# This testing configuration handles running the test suite against LLVM's libc++
# using either a DLL or a static library, with MinGW/Clang on Windows.
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -L %{lib} -lc++'
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --env PATH=%{lib} -- '
))
# LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the
# initial Windows failures until they can be properly diagnosed
# and fixed. This allows easier detection of new test failures
# and regressions. Note: New failures should not be suppressed
# using this feature. (Also see llvm.org/PR32730)
config.available_features.add('LIBCXX-WINDOWS-FIXME')
import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.newconfig
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)

View File

@ -0,0 +1,32 @@
# This testing configuration handles running the test suite against LLVM's libc++
# using a DLL, with Clang-cl on Windows.
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib -L %{lib} -lc++ -lmsvcrt -lmsvcprt -loldnames'
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --env PATH=%{lib} -- '
))
# LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the
# initial Windows failures until they can be properly diagnosed
# and fixed. This allows easier detection of new test failures
# and regressions. Note: New failures should not be suppressed
# using this feature. (Also see llvm.org/PR32730)
config.available_features.add('LIBCXX-WINDOWS-FIXME')
import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.newconfig
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)

View File

@ -0,0 +1,32 @@
# This testing configuration handles running the test suite against LLVM's libc++
# using a static library, with Clang-cl on Windows.
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
config.substitutions.append(('%{flags}', '--driver-mode=g++'))
config.substitutions.append(('%{compile_flags}',
'-nostdinc++ -isystem %{include} -isystem %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib -L %{lib} -llibc++ -lmsvcrt -lmsvcprt -loldnames'
))
config.substitutions.append(('%{exec}',
'%{executor} --execdir %T --env PATH=%{lib} -- '
))
# LIBCXX-WINDOWS-FIXME is the feature name used to XFAIL the
# initial Windows failures until they can be properly diagnosed
# and fixed. This allows easier detection of new test failures
# and regressions. Note: New failures should not be suppressed
# using this feature. (Also see llvm.org/PR32730)
config.available_features.add('LIBCXX-WINDOWS-FIXME')
import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.newconfig
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)

View File

@ -597,13 +597,15 @@ clang-cl-dll)
# correctly when libc++ visibility attributes indicate dllimport linkage
# anyway), thus just disable the experimental library. Remove this
# setting when cmake and the test driver does the right thing automatically.
generate-cmake-libcxx-win -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
generate-cmake-libcxx-win -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared-clangcl.cfg.in"
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
clang-cl-static)
clean
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXX_TEST_CONFIG="llvm-libc++-static-clangcl.cfg.in"
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
;;
@ -617,6 +619,7 @@ mingw-dll)
generate-cmake \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-DLIBCXX_TEST_CONFIG="llvm-libc++-mingw.cfg.in" \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
echo "+++ Running the libc++ tests"
${NINJA} -vC "${BUILD_DIR}" check-cxx
@ -626,6 +629,7 @@ mingw-static)
generate-cmake \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \
-DLIBCXX_TEST_CONFIG="llvm-libc++-mingw.cfg.in" \
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBUNWIND_ENABLE_SHARED=OFF