Skip to content

Commit c5fe015

Browse files
authored
Merge pull request #23599 from shajrawi/testing_os
2 parents d06f051 + ad59d90 commit c5fe015

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

docs/Testing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ out with ``lit.py -h``. We document some of the more useful ones below:
113113
* ``--param swift_test_mode=<MODE>`` drives the various suffix variations
114114
mentioned above. Again, it's best to get the invocation from the existing
115115
build system targets and modify it rather than constructing it yourself.
116+
* ``--param use_os_stdlib`` will run all tests with the standard libraries
117+
coming from the OS.
116118

117119
##### Remote testing options
118120

test/lit.cfg

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#
1313
# This is a configuration file for the 'lit' test runner.
1414
#
15-
# Refer to docs/Testing.rst for documentation.
15+
# Refer to docs/Testing.md for documentation.
1616
#
17-
# Update docs/Testing.rst when changing this file.
17+
# Update docs/Testing.md when changing this file.
1818
#
1919
# -----------------------------------------------------------------------------
2020

@@ -1088,6 +1088,15 @@ if (not getattr(config, 'target_run', None) and
10881088
remote_run_host = lit_config.params['remote_run_host']
10891089
remote_tmp_dir = lit_config.params['remote_run_tmpdir']
10901090
remote_lib_dir = os.path.join(remote_tmp_dir, 'stdlib')
1091+
remote_run_lib_path = ''
1092+
if 'use_os_stdlib' not in lit_config.params:
1093+
remote_run_lib_path = remote_lib_dir
1094+
else:
1095+
os_stdlib_path = ''
1096+
if run_vendor == 'apple':
1097+
#If we get swift-in-the-OS for non-Apple platforms, add a condition here
1098+
os_stdlib_path = "/usr/lib/swift"
1099+
remote_run_lib_path = os.path.pathsep.join((os_stdlib_path, remote_lib_dir))
10911100

10921101
remote_run_extra_args_param = lit_config.params.get('remote_run_extra_args')
10931102
remote_run_extra_args = shlex.split(remote_run_extra_args_param or '')
@@ -1136,7 +1145,7 @@ if (not getattr(config, 'target_run', None) and
11361145
"REMOTE_RUN_CHILD_DYLD_LIBRARY_PATH='{0}' " # Apple option
11371146
"REMOTE_RUN_CHILD_LD_LIBRARY_PATH='{0}' " # Linux option
11381147
"'{1}'/remote-run --input-prefix '{2}' --output-prefix %t "
1139-
"--remote-dir '{3}'%t {4} {5}".format(remote_lib_dir,
1148+
"--remote-dir '{3}'%t {4} {5}".format(remote_run_lib_path,
11401149
config.swift_utils,
11411150
config.swift_src_root,
11421151
remote_tmp_dir,
@@ -1456,6 +1465,29 @@ if os.path.exists(libswiftCore_path):
14561465
config.substitutions.append(('%target-static-stdlib-path', static_stdlib_path))
14571466
lit_config.note('using static stdlib path: %s' % static_stdlib_path)
14581467

1468+
# Set up testing with the standard libraries coming from the OS / just-built libraries
1469+
# default Swift tests to use the just-built libraries
1470+
target_stdlib_path = platform_module_dir
1471+
if 'use_os_stdlib' not in lit_config.params:
1472+
lit_config.note('Testing with the just-built libraries at ' + target_stdlib_path)
1473+
config.target_run = (
1474+
"/usr/bin/env "
1475+
"DYLD_LIBRARY_PATH='{0}' " # Apple option
1476+
"LD_LIBRARY_PATH='{0}' " # Linux option
1477+
.format(target_stdlib_path))
1478+
else:
1479+
os_stdlib_path = ''
1480+
if run_vendor == 'apple':
1481+
#If we get swift-in-the-OS for non-Apple platforms, add a condition here
1482+
os_stdlib_path = "/usr/lib/swift"
1483+
all_stdlib_path = os.path.pathsep.join((os_stdlib_path, target_stdlib_path))
1484+
lit_config.note('Testing with the standard libraries coming from the OS ' + all_stdlib_path)
1485+
config.target_run = (
1486+
"/usr/bin/env "
1487+
"DYLD_LIBRARY_PATH='{0}' " # Apple option
1488+
"LD_LIBRARY_PATH='{0}' " # Linux option
1489+
.format(all_stdlib_path))
1490+
14591491
if config.lldb_build_root != "":
14601492
config.available_features.add('lldb')
14611493
# Note: using the same approach to locating the lib dir as in

0 commit comments

Comments
 (0)