[libcxx-commits] [PATCH] D137110: [libc++] Option to specify a different compiler for testing

David Tenty via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 8 19:04:27 PST 2022


daltenty added a comment.

In D137110#3916097 <https://reviews.llvm.org/D137110#3916097>, @philnik wrote:

> In D137110#3899667 <https://reviews.llvm.org/D137110#3899667>, @hubert.reinterpretcast wrote:
>
>> In D137110#3899449 <https://reviews.llvm.org/D137110#3899449>, @ldionne wrote:
>>
>>> But first, I'd like to understand why you're not setting `CMAKE_CXX_COMPILER` to the compiler you're trying to run the tests with?
>>
>> Is my understanding correct that changing `CMAKE_CXX_COMPILER` also changes the build compiler for the shared libraries?
>> The intention is to build using a "stable" compiler, but still allow testing with a compiler under development.
>
> Why can't you compile the library with the experimental compiler? If it can't properly compile that, it surely can't run the test suite.

That's simply not the same test though. In practice the same built shared library + headers can be consumed by multiple different compilers (which may encounter unique issues) when deployed. We'd like a hook to test such scenarios.

> I think the preferred way forward here would be to make the libc++ test suite usable on its own, outside of LLVM. And then, you could use CMAKE_CXX_COMPILER to configure it, but you'd only be configuring the test suite, not the build of libc++ itself.



> I think that would be extremely useful to other implementations as well, like libstdc++ and MSVC who want to run our test suite but don't care about building our runtimes.

Would we accomplish that by means of some flags we pass to the CMake config then? Essentially some options to say, skip building the library, just stand up the test hardness (maybe with an option to control whether the libc++ specific or just standard test are included). Very roughly, that would make configuring and invoking it something like this (assuming the library isn't the compiler search paths) IIUC:

  $ cmake  -DCMAKE_CXX_COMPILER=/some/c++  -DLLVM_ENABLE_RUNTIMES=libcxx -DLIBCXX_TEST_ONLY=ON  -DLIBCXX_LIBRARY_DIR=/path/to/build/lib -DLIBCXX_HEADER_DIR=/path/to/build/include/c++/v1 -DLIBCXX_TEST_CONFIG="appropriate.cfg.in"
  $ make check-cxx


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137110/new/

https://reviews.llvm.org/D137110



More information about the libcxx-commits mailing list