2015-03-14 04:55:07 +08:00
|
|
|
# -*- Python -*-
|
|
|
|
|
|
|
|
# Configuration file for the 'lit' test runner.
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
import lit.formats
|
|
|
|
|
[LIT] First pass of LLDB LIT support
Summary:
This patch supplies basic infrastructure for LLDB to use LIT, and ports a few basic test cases from the LLDB test suite into LIT.
With this patch the LLDB lit system is not capable or intended to fully replace the existing LLDB test suite, but this first patch enables people to write lit tests for LLDB.
The lit substitution for %cc and %cxx default to the host compiler unless the CMake option LLDB_TEST_CLANG is On, in which case the in-tree clang will be used.
The target check-lldb-lit will run all lit tests including the lit-based executor for the unit tests. Alternatively there is a target generated for each subdirectory under the lit directory, so check-lldb-unit and check-lldb-expr will run just the tests under their respective directories.
The ported tests are not removed from the existing suite, and should not be until such a time when the lit runner is mature and in use by bots and workflows.
Reviewers: zturner, labath, jingham, tfiala
Subscribers: beanz, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D24591
llvm-svn: 281651
2016-09-16 04:13:55 +08:00
|
|
|
# Check that the object root is known.
|
|
|
|
if config.test_exec_root is None:
|
|
|
|
# Otherwise, we haven't loaded the site specific configuration (the user is
|
|
|
|
# probably trying to run on a test file directly, and either the site
|
|
|
|
# configuration hasn't been created by the build system, or we are in an
|
|
|
|
# out-of-tree build situation).
|
|
|
|
|
|
|
|
# Check for 'llvm_unit_site_config' user parameter, and use that if available.
|
|
|
|
site_cfg = lit_config.params.get('lldb_unit_site_config', None)
|
|
|
|
if site_cfg and os.path.exists(site_cfg):
|
|
|
|
lit_config.load_config(config, site_cfg)
|
|
|
|
raise SystemExit
|
|
|
|
|
2015-03-14 04:55:07 +08:00
|
|
|
# name: The name of this test suite.
|
|
|
|
config.name = 'lldb-Unit'
|
|
|
|
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
|
|
|
config.suffixes = []
|
|
|
|
|
|
|
|
# test_source_root: The root path where unit test binaries are located.
|
|
|
|
# test_exec_root: The root path where tests should be run.
|
|
|
|
config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests')
|
|
|
|
config.test_exec_root = config.test_source_root
|
|
|
|
|
|
|
|
# testFormat: The test format to use to interpret tests.
|
|
|
|
if not hasattr(config, 'llvm_build_mode'):
|
|
|
|
lit_config.fatal("unable to find llvm_build_mode value on config")
|
|
|
|
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
|