Skip to content

Instantly share code, notes, and snippets.

@ldionne
Last active September 1, 2020 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ldionne/193edbb0c47c79064f8324858a66de3b to your computer and use it in GitHub Desktop.
Save ldionne/193edbb0c47c79064f8324858a66de3b to your computer and use it in GitHub Desktop.
From-scratch Lit configuration for Wakely

Put the libstdcxx.cfg.in file in libcxx/test/configs/libstdcxx.cfg.in. Then, configure the LLVM tree with -DLIBCXX_TEST_CONFIG=<path-to-libstdcxx.cfg.in>.

Then, you should be able to use ./build/bin/llvm-lit -sv <whatever>.

@AUTO_GEN_COMMENT@
LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
import os
import pipes
import site
import sys
site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils'))
import libcxx.test.features
import libcxx.test.format
import libcxx.test.newconfig
import libcxx.test.params
# Configure basic properties of the test suite
config.name = 'libstdc++-trunk-shared'
config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = EXEC_ROOT
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
config.substitutions.append(('%{cxx}', <your-compiler>))
config.substitutions.append(('%{flags}', <your-common-link-and-compile-flags>))
config.substitutions.append(('%{compile_flags}', <your-compile-flags>))
config.substitutions.append(('%{link_flags}', <your-link-flags>))
config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format(pipes.quote(sys.executable), pipes.quote(runPy))))
# Add parameters and features to the config
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)
# Example of a lit config to run with the system Clang and against the system libc++ on macOS.
# I replaced `libcxx/test/lit.cfg.py` by this file.
LIBCXX_ROOT = "/Users/ldionne/work/llvm/libcxx"
EXEC_ROOT = "/tmp/libcxx-exec"
import os
import pipes
import site
import sys
site.addsitedir(os.path.join(LIBCXX_ROOT, 'utils'))
import libcxx.test.features
import libcxx.test.format
import libcxx.test.newconfig
import libcxx.test.params
# Configure basic properties of the test suite
config.name = 'libstdc++-trunk-shared'
config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = EXEC_ROOT
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
config.substitutions.append(('%{cxx}', 'clang++'))
config.substitutions.append(('%{flags}', ''))
config.substitutions.append(('%{compile_flags}', '-I {}'.format(os.path.join(LIBCXX_ROOT, 'test', 'support'))))
config.substitutions.append(('%{link_flags}', ''))
config.substitutions.append(('%{exec}', '{} {} --execdir %T -- '.format(pipes.quote(sys.executable), pipes.quote(runPy))))
# Add parameters and features to the config
libcxx.test.newconfig.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment