[libcxx-commits] [PATCH] D155554: [libcxx] [test] Fix running tests with Clang-cl in Debug mode
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 18 00:41:47 PDT 2023
mstorsjo created this revision.
mstorsjo added reviewers: jyknight, Mordante, andrewng.
Herald added a subscriber: arichardson.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a subscriber: wangpc.
Herald added a project: libc++.
Herald added a reviewer: libc++.
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 <https://reviews.llvm.org/rGa48f018bb7d8fadc67c08e71409c31713daa0071>).
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155554
Files:
libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in
libcxx/test/support/set_windows_crt_report_mode.h
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155554.541360.patch
Type: text/x-patch
Size: 6038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230718/ce62fb81/attachment-0001.bin>
More information about the libcxx-commits
mailing list