[libc++] Add support for generated tests in the libc++ test format
authorLouis Dionne <ldionne.2@gmail.com>
Tue, 23 May 2023 18:50:05 +0000 (11:50 -0700)
committerLouis Dionne <ldionne.2@gmail.com>
Thu, 25 May 2023 21:17:45 +0000 (14:17 -0700)
commitf039caec338300b794f0edf0ef10df49b297ec37
tree56123f5d75b36263cd2d94d9e500595ace2b2b4a
parent65c78933ae22a9a26b56ed763f5827765ce7eadf
[libc++] Add support for generated tests in the libc++ test format

A recurring problem recently has been that libc++ has several generated
tests which all need to be re-generated before committing a change. This
creates noise during code reviews and friction for contributors.

Furthermore, the way we generated most of these tests resulted in
extremely bad compilation times when using modules, because we defined
a macro before compiling each file.

This commit introduces a new kind of test called a '.gen' test. These
tests are normal shell tests, however the Lit test format will run the
test to discover the actual Lit tests it should run. This basically
allows generating a Lit test suite on the fly using arbitrary code,
which can be used in the future to generate tests like our __verbose_abort
tests and several others.

Differential Revision: https://reviews.llvm.org/D151258
libcxx/test/libcxx/selftest/gen.cpp/empty.gen.cpp [new file with mode: 0644]
libcxx/test/libcxx/selftest/gen.cpp/one.gen.cpp [new file with mode: 0644]
libcxx/test/libcxx/selftest/gen.cpp/two.gen.cpp [new file with mode: 0644]
libcxx/utils/libcxx/test/dsl.py
libcxx/utils/libcxx/test/format.py