forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlit.cfg
97 lines (80 loc) · 3.85 KB
/
lit.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# 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 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://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']
# Exclude LongTests directories when not executing long tests.
swift_test_subset = lit_config.params.get('swift_test_subset', 'validation')
if swift_test_subset in ['primary', 'validation', 'only_validation']:
config.excludes += ['LongTests']
elif swift_test_subset == 'all':
pass
elif swift_test_subset == 'only_long':
# FIXME: this doesn't exclude not-long tests from the only_long subset.
# Currently those tests are very fast so it doesn't matter much.
pass
elif swift_test_subset == 'only_stress':
# FIXME: this doesn't exclude not-stress tests from the only_stress subset.
# Currently those tests are very fast so it doesn't matter much.
pass
else:
lit_config.fatal("Unknown test subset %r" % swift_test_subset)
# 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')
# XDG_CACHE_HOME can be used to influence the position of the clang
# module cache for all those tests that do not set that explicitly
if 'XDG_CACHE_HOME' in os.environ:
config.environment['XDG_CACHE_HOME'] = os.environ['XDG_CACHE_HOME']
# Find the resource directory. Assume it's near the swift compiler if not set.
test_resource_dir = lit_config.params.get('test_resource_dir')
if not test_resource_dir:
test_resource_dir = config.swiftlib_dir
if 'use_os_stdlib' not in lit_config.params:
# Ensure we load the libraries from the just built compiler
# when building on Darwin
# This is needed in addition to what is done in `add_swift_unittest`
# to handle dependencies of the dylibs loaded by `SwiftRuntimeTests`
# (for which we cannot run `swift-rpathize.py`)
config.environment['DYLD_LIBRARY_PATH'] = os.path.join(test_resource_dir, 'macosx')
if 'use_os_stdlib' in lit_config.params:
# Runtime tests are failing in back-deployment due to missing _Concurrency.
# rdar://78139218
config.excludes += ['runtime']