mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The Swift build system does not generate DWARF symbols in the unittests build directory. For build systems that do, however, files would be generated with the test suffix "Tests". These need to be excluded because otherwise `lit.formats.GoogleTest` tries to execute them.
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
# test/Unit/lit.cfg - Configuration for the 'lit' test runner. -*- python -*-
|
|
#
|
|
# This source file is part of the Swift.org open source project
|
|
#
|
|
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
# Licensed under Apache License v2.0 with Runtime Library Exception
|
|
#
|
|
# See http://swift.org/LICENSE.txt for license information
|
|
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
import os
|
|
|
|
import lit.formats
|
|
import lit.util
|
|
|
|
###
|
|
|
|
# Check that the object root is known.
|
|
swift_obj_root = getattr(config, 'swift_obj_root', None)
|
|
if swift_obj_root is None:
|
|
# Check for 'swift_unit_site_config' user parameter, and use that if available.
|
|
site_cfg = lit_config.params.get('swift_unit_site_config', None)
|
|
if not site_cfg:
|
|
base_site_cfg = lit_config.params.get('swift_site_config', None)
|
|
if base_site_cfg:
|
|
test_dir = os.path.dirname(base_site_cfg)
|
|
site_cfg = os.path.join(test_dir, 'Unit', 'lit.site.cfg')
|
|
|
|
if site_cfg and os.path.exists(site_cfg):
|
|
lit_config.load_config(config, site_cfg)
|
|
raise SystemExit
|
|
|
|
lit_config.fatal("lit must be pointed at a build folder")
|
|
|
|
###
|
|
|
|
# name: The name of this test suite.
|
|
config.name = 'Swift-Unit'
|
|
|
|
# suffixes: A list of file extensions to treat as test files.
|
|
config.suffixes = []
|
|
|
|
# excludes: A path component to ignore when discovering tests.
|
|
# The Swift build system does not generate DWARF symbols in the unittests build
|
|
# directory. For build systems that do, however, files would be generated with
|
|
# the test suffix "Tests". These need to be excluded because otherwise
|
|
# `lit.formats.GoogleTest` tries to execute them.
|
|
# See http://reviews.llvm.org/D18647 for details.
|
|
config.excludes = ['DWARF']
|
|
|
|
# test_source_root: The root path where tests are located.
|
|
# test_exec_root: The root path where tests should be run.
|
|
config.test_exec_root = os.path.join(swift_obj_root, 'unittests')
|
|
config.test_source_root = config.test_exec_root
|
|
|
|
# testFormat: The test format to use to interpret tests.
|
|
config.test_format = lit.formats.GoogleTest(config.build_mode, 'Tests')
|