[libcxx-commits] [PATCH] D77338: [libc++] Add an alternative Lit test format

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 2 14:39:10 PDT 2020


ldionne created this revision.
Herald added subscribers: libcxx-commits, broadwaylamb, dexonsmith, jkorous.
Herald added projects: libc++, libc++abi.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

This new test format is simpler and more flexible. It creates Lit ShTests
on the fly that reuse existing substitutions (like %{cxx}) instead of
having complex logic in Python to run the tests. This has the benefit
that virtually no coding is required to customize how the test suite is
run -- one can achieve pretty much anything by defining the appropriate
substitutions in a simple lit.cfg file.

For example, in order to run the tests on an embedded device after
building with a specific SDK, one can set the %{cxx} and %{compile_flags}
substitutions to use that SDK, and the %{exec} substitution to the ssh.py
script currently used for .sh.cpp tests with a remote executor. Dealing with
the SSHExecutor becomes unnecessary, since all tests are treated like ShTests.

As a side effect of this design, configuration files for the test
suite can be as simple as:

config.substitutions.append(('%{cxx}', '<path-to-compiler>'))
	config.substitutions.append(('%{compile_flags}', '<flags>'))
	config.substitutions.append(('%{link_flags}', '<flags>'))
	config.substitutions.append(('%{exec}', '<script-to-execute>'))

This should allow storing lit.cfg files for various configurations
directly in the repository instead of relying on complicated logic
in config.py to set up the right flags. I've found numerous problems
in that logic in the past years, and it seems like having simple and
explicit configuration files for the configurations we support is
going to solve most of these problems. Specifically, I am hoping to
store configuration files for testing other Standard Libraries in
the repository.

Improving the interaction with the test suite configuration is still a
work in progress, so for now this test format reuses the substitutions and
available features that are set up by the current config.py.

This new test format should support pretty much everything that the current
test format supports, however it will not be enabled by default at first to
make sure we're satisfied with it. For a short period of time, the new format
will require `--param=use_new_format=True` to be enabled, however it is a very
short term goal to replace the current testing format entirely and to simplify
the configuration accordingly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77338

Files:
  libcxx/test/libcxx/selftest/newformat/additional_compile_flags/substitutes-in-compile-flags.sh.cpp
  libcxx/test/libcxx/selftest/newformat/additional_compile_flags/substitutes-in-run.sh.cpp
  libcxx/test/libcxx/selftest/newformat/compile.fail.cpp/compile-error.compile.fail.cpp
  libcxx/test/libcxx/selftest/newformat/compile.fail.cpp/compile-success.compile.fail.cpp
  libcxx/test/libcxx/selftest/newformat/compile.fail.cpp/wrong-expected.compile.fail.cpp
  libcxx/test/libcxx/selftest/newformat/compile.pass.cpp/compile-error.compile.pass.cpp
  libcxx/test/libcxx/selftest/newformat/compile.pass.cpp/compile-success.compile.pass.cpp
  libcxx/test/libcxx/selftest/newformat/compile.pass.cpp/link-error.compile.pass.cpp
  libcxx/test/libcxx/selftest/newformat/compile.pass.cpp/run-error.compile.pass.cpp
  libcxx/test/libcxx/selftest/newformat/fail.cpp/compile-error-with-verify.fail.cpp
  libcxx/test/libcxx/selftest/newformat/fail.cpp/compile-error-without-verify.fail.cpp
  libcxx/test/libcxx/selftest/newformat/fail.cpp/compile-success.fail.cpp
  libcxx/test/libcxx/selftest/newformat/fail.cpp/wrong-expected.fail.cpp
  libcxx/test/libcxx/selftest/newformat/file_dependencies/no-dependencies.sh.cpp
  libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-dependencies.sh.cpp
  libcxx/test/libcxx/selftest/newformat/file_dependencies/substitute-in-run.sh.cpp
  libcxx/test/libcxx/selftest/newformat/link.fail.cpp/compile-error.link.fail.cpp
  libcxx/test/libcxx/selftest/newformat/link.fail.cpp/link-error.link.fail.cpp
  libcxx/test/libcxx/selftest/newformat/link.fail.cpp/link-success.link.fail.cpp
  libcxx/test/libcxx/selftest/newformat/link.pass.cpp/compile-error.link.pass.cpp
  libcxx/test/libcxx/selftest/newformat/link.pass.cpp/link-error.link.pass.cpp
  libcxx/test/libcxx/selftest/newformat/link.pass.cpp/link-success.link.pass.cpp
  libcxx/test/libcxx/selftest/newformat/link.pass.cpp/run-error.link.pass.cpp
  libcxx/test/libcxx/selftest/newformat/lit.local.cfg
  libcxx/test/libcxx/selftest/newformat/pass.cpp/compile-error.pass.cpp
  libcxx/test/libcxx/selftest/newformat/pass.cpp/link-error.pass.cpp
  libcxx/test/libcxx/selftest/newformat/pass.cpp/run-error.pass.cpp
  libcxx/test/libcxx/selftest/newformat/pass.cpp/run-success.pass.cpp
  libcxx/test/libcxx/selftest/newformat/pass.mm/compile-error.pass.mm
  libcxx/test/libcxx/selftest/newformat/pass.mm/link-error.pass.mm
  libcxx/test/libcxx/selftest/newformat/pass.mm/no-arc.pass.mm
  libcxx/test/libcxx/selftest/newformat/pass.mm/run-error.pass.mm
  libcxx/test/libcxx/selftest/newformat/pass.mm/run-success.pass.mm
  libcxx/test/libcxx/selftest/newformat/pass.mm/use-objective-cxx.pass.mm
  libcxx/test/libcxx/selftest/newformat/run.fail.cpp/compile-error.run.fail.cpp
  libcxx/test/libcxx/selftest/newformat/run.fail.cpp/link-error.run.fail.cpp
  libcxx/test/libcxx/selftest/newformat/run.fail.cpp/run-error.run.fail.cpp
  libcxx/test/libcxx/selftest/newformat/run.fail.cpp/run-success.run.fail.cpp
  libcxx/test/libcxx/selftest/newformat/sh.cpp/empty.sh.cpp
  libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp
  libcxx/test/libcxx/selftest/newformat/sh.cpp/run-error.sh.cpp
  libcxx/test/libcxx/selftest/newformat/sh.cpp/run-success.sh.cpp
  libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
  libcxx/test/lit.cfg
  libcxx/utils/libcxx/test/newformat.py
  libcxxabi/test/lit.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77338.254621.patch
Type: text/x-patch
Size: 48589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200402/de4af3df/attachment-0001.bin>


More information about the libcxx-commits mailing list