[all-commits] [llvm/llvm-project] e346fd: [libcxx] [test] Fix running tests with Clang-cl in...
Martin Storsjö via All-commits
all-commits at lists.llvm.org
Fri Jul 28 13:51:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e346fd8a60d4969b29bdd1740a89b1ea43635331
https://github.com/llvm/llvm-project/commit/e346fd8a60d4969b29bdd1740a89b1ea43635331
Author: Martin Storsjö <martin at martin.st>
Date: 2023-07-28 (Fri, 28 Jul 2023)
Changed paths:
M libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
M libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
M libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
M libcxx/test/support/set_windows_crt_report_mode.h
M libcxx/utils/ci/buildkite-pipeline.yml
M libcxx/utils/ci/run-buildbot
Log Message:
-----------
[libcxx] [test] Fix running tests with Clang-cl in Debug mode
When building in debug mode, the debug version of the MSVC CRT
gets linked in. (This is the default in CMake in general. In the case
of libcxx, we manually link the CRT though - and in debug mode,
we pick the debug version of the CRT.) When building the tests,
we need to use the same version of the CRT as was used for building
the library.
Additionally; the debug CRT defaults to pop up a dialog box when
asserts fail, which blocks running tests. By including the
set_windows_crt_report_mode.h helper header, we change the assert
behaviour back to that of release mode - printing a message and
exiting immediately.
This was supported by the old libcxx test system, where support for
it was added in 7e3ee09ad24cbca3ea7687c50b53be5269127fb1. When porting
over to the newer test setup, this mechanism wasn't brought over (and the
old test infrastructure was removed in
a48f018bb7d8fadc67c08e71409c31713daa0071).
Thus: In debug mode, link against the debug versions of msvcrt and
msvcprt, define _DEBUG (enabling CRT debug mode code patterns),
and include the set_windows_crt_report_mode.h header.
Based on a patch by Andrew Ng.
Linking of the debug version of the CRT can also be done by using
the new -fms-runtime-lib= Clang option. However that option was
added in Clang 16, and libcxx only requires Clang 15 for now;
therefore doing the CRT linking entirely manually for now (just as
before).
Additionally, adjust set_windows_crt_report_mode.h to avoid including
the body of the file when building in C mode or in C++03 mode.
This fixes the following two tests:
libcxx/include_as_c.sh.cpp
libcxx/selftest/dsl/dsl.sh.py
The former test is built in C mode. The latter tries compiling things
as C++03. Some of the vcruntime headers that we include break in
C++03 mode when MS CRT debug mode is enabled.
Differential Revision: https://reviews.llvm.org/D155554
Commit: cd1b8be8de91bc1c43bac3eea7ebf3b5643b031c
https://github.com/llvm/llvm-project/commit/cd1b8be8de91bc1c43bac3eea7ebf3b5643b031c
Author: Andrew Ng <andrew.ng at sony.com>
Date: 2023-07-28 (Fri, 28 Jul 2023)
Changed paths:
M libcxx/test/support/set_windows_crt_report_mode.h
Log Message:
-----------
[libcxx] [test] Make set_windows_crt_report_mode.h more explicit
This header is included when building with a debug CRT in
MSVC/Clang-cl environments. By default, failed asserts with the
debug CRT pops up a blocking dialog box alerting the user about
the failed assert. When running more than one test in an automated
fashion, this isn't ideal.
This header tries to run initializers to set the behaviour of the
failed asserts to print a message to the console, just like the
default is in release mode.
This is previously done by setting the reporting mode to
_CRTDBG_MODE_DEBUG, which means outputting to the debugger's
output window. In some setups, this is enough for making it work,
but in others it instead can pop up a dialog asking for which
debugger to use.
Instead set the mode explicitly to _CRTDBG_MODE_FILE and set the
destination to be explicitly to stderr.
For setups where the previous code worked correctly, it doesn't make
any difference other than that a failed assert prints an additional
"abort() has been called" message that wasn't printed before.
Differential Revision: https://reviews.llvm.org/D155823
Commit: e777e44546f903146e7cfcd241a9dd9d7f217865
https://github.com/llvm/llvm-project/commit/e777e44546f903146e7cfcd241a9dd9d7f217865
Author: Martin Storsjö <martin at martin.st>
Date: 2023-07-28 (Fri, 28 Jul 2023)
Changed paths:
M libcxx/CMakeLists.txt
M libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
M libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
M libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
M libcxx/utils/ci/buildkite-pipeline.yml
M libcxx/utils/ci/run-buildbot
Log Message:
-----------
[libcxx] Allow linking against the MSVC static CRT
This respects the CMAKE_MSVC_RUNTIME_LIBRARY option for selecting
the right CRT to use.
Add a CI configuration that tests building this way.
Based on a patch by Andrew Ng.
The test config files end up accumulating and duplicating a fair
bit of cmake-specific logic here; if preferred, we could also add
that in `libcxx/test/CMakeLists.txt` and export a few more variables
to `cmake-bridge.cfg.in` instead.
Differential Revision: https://reviews.llvm.org/D155560
Compare: https://github.com/llvm/llvm-project/compare/c57d249cd917...e777e44546f9
More information about the All-commits
mailing list