[all-commits] [llvm/llvm-project] 80a2dd: [libc++] Add an alternative Lit test format

Louis Dionne via All-commits all-commits at lists.llvm.org
Fri Apr 3 08:36:23 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 80a2ddf65ccd9837a7cdd0dfb96bb57863dd57d5
      https://github.com/llvm/llvm-project/commit/80a2ddf65ccd9837a7cdd0dfb96bb57863dd57d5
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2020-04-03 (Fri, 03 Apr 2020)

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

  Log Message:
  -----------
  [libc++] Add an alternative Lit test format

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.

Differential Revision: https://reviews.llvm.org/D77338




More information about the All-commits mailing list