llvm-project/libunwind/test/configs/cmake-bridge.cfg.in
Louis Dionne e236a52a88
[libc++] Unify the benchmarks with the test suite (#101399)
Instead of building the benchmarks separately via CMake and running them
separately from the test suite, this patch merges the benchmarks into
the test suite and handles both uniformly.

As a result:
- It is now possible to run individual benchmarks like we run tests
  (e.g. using libcxx-lit), which is a huge quality-of-life improvement.

- The benchmarks will be run under exactly the same configuration as
  the rest of the tests, which is a nice simplification. This does
  mean that one has to be careful to enable the desired optimization
  flags when running benchmarks, but that is easy with e.g.
  `libcxx-lit <...> --param optimization=speed`.

- Benchmarks can use the same annotations as the rest of the test
  suite, such as `// UNSUPPORTED` & friends.

When running the tests via `check-cxx`, we only compile the benchmarks
because running them would be too time consuming. This introduces a bit
of complexity in the testing setup, and instead it would be better to
allow passing a --dry-run flag to GoogleBenchmark executables, which is
the topic of https://github.com/google/benchmark/issues/1827.

I am not really satisfied with the layering violation of adding the
%{benchmark_flags} substitution to cmake-bridge, however I believe
this can be improved in the future.
2024-11-07 09:07:50 -05:00

36 lines
1.5 KiB
INI

@AUTO_GEN_COMMENT@
@SERIALIZED_LIT_PARAMS@
#
# This file performs the bridge between the CMake configuration and the Lit
# configuration files by setting up the LitConfig object and various Lit
# substitutions from CMake variables.
#
# Individual configuration files can take advantage of this bridge by
# loading the file and then setting up the remaining Lit substitutions.
#
import os, site
site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
import libcxx.test.format
# Basic configuration of the test suite
config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@')
config.test_source_root = os.path.join('@LIBUNWIND_SOURCE_DIR@', 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = os.path.join('@LIBUNWIND_BINARY_DIR@', 'test')
# Add a few features that are common to all the configurations
if @LIBUNWIND_USES_ARM_EHABI@:
config.available_features.add('libunwind-arm-ehabi')
if not @LIBUNWIND_ENABLE_THREADS@:
config.available_features.add('libunwind-no-threads')
# Add substitutions for bootstrapping the test suite configuration
config.substitutions.append(('%{install-prefix}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@'))
config.substitutions.append(('%{include}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/include'))
config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBUNWIND_INSTALL_LIBRARY_DIR@'))
config.substitutions.append(('%{benchmark_flags}', ''))