This is only a draft for asking questions due to I am not familiar with testing infrastructure. No reviewing is required. We need some higher level discussion now.
The main problem I meet now is how can I add another test mode with new macro definitions (or new compiler options).
See test/std_modules/language.support/support.coroutines/end.to.end/generator.pass.cpp and https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/language.support/support.coroutines/end.to.end/generator.pass.cpp, there two differences only:
- the modules version add another unsupported testing mode: c++20
- the modules version uses import std; while the original one includes <vector> and <coroutine>.
What I want to achieve is the following one:
// UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: libcpp-no-coroutines // See https://llvm.org/PR33271 // UNSUPPORTED: ubsan #include <cassert> #include "test_macros.h" #ifdef USE_STD_MODULES import std; #else #include <coroutine> #include <vector> #endif
Then for every testing mode with std version higher than C++20, it will test the file twice. One with the macro USE_STD_MODULES and one without it. But I failed to make it so I am wondering if it is better to ask questions here.
(I updated the discussion in https://discourse.llvm.org/t/maybe-we-could-start-to-play-with-std-modules/64093/15. And the question here should be independent with the concrete implementation methods.)