Skip to content

Commit 524c5e0

Browse files
committed
When running with the interpreter on Darwin, force the usage of the just built, stdlib when running the frontend.
This is because we currently JIT in process resulting in weirdness around swift-frontend wanting to link against the host stdlib and the exec swift code wanting to link against the target stdlib. For now, we work around this by just saying in that case we will force swift-frontend to use the just built runtime so we are consistent. The only potential problem is that a bug in the just built runtime may now cause these tests to fail. But overall, that would suggest a problem we may want to catch in it of itself, so the work around I think makes sense until JITing is done in a separate process (which I think is the right fix). rdar://78768013
1 parent 554e1e4 commit 524c5e0

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

test/Interpreter/process_arguments.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %swift -interpret %s | %FileCheck %s -check-prefix=CHECK-NONE
2-
// RUN: %swift -interpret %s -Onone -g | %FileCheck %s -check-prefix=CHECK-NONE
3-
// RUN: %swift -interpret %s -Onone -g -- | %FileCheck %s -check-prefix=CHECK-NONE
4-
// RUN: %swift -interpret %s -Onone -g -- a b c | %FileCheck %s -check-prefix=CHECK-THREE
1+
// RUN: %target-jit-run -interpret %s | %FileCheck %s -check-prefix=CHECK-NONE
2+
// RUN: %target-jit-run -interpret %s -Onone -g | %FileCheck %s -check-prefix=CHECK-NONE
3+
// RUN: %target-jit-run -interpret %s -Onone -g -- | %FileCheck %s -check-prefix=CHECK-NONE
4+
// RUN: %target-jit-run -interpret %s -Onone -g -- a b c | %FileCheck %s -check-prefix=CHECK-THREE
55

66
// REQUIRES: swift_interpreter
77

test/Interpreter/protocol_lookup_jit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Test protocol_lookup.swift in JIT mode.
2-
// RUN: %swift -interpret %S/protocol_lookup.swift | %FileCheck %S/protocol_lookup.swift
2+
// RUN: %target-jit-run %S/protocol_lookup.swift | %FileCheck %S/protocol_lookup.swift
33
// REQUIRES: executable_test
44

55
// REQUIRES: swift_interpreter

test/Serialization/operator.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/def_operator.swift
33
// RUN: llvm-bcanalyzer %t/def_operator.swiftmodule | %FileCheck %s
44
// RUN: %target-swift-frontend -typecheck -I%t %s
5-
// RUN: %target-swift-frontend -interpret -I %t -DINTERP %s | %FileCheck --check-prefix=OUTPUT %s
6-
5+
//
6+
// Run with the interpreter using the proper filecheck pattern.
7+
// RUN: %target-jit-run -I %t -DINTERP %s | %FileCheck --check-prefix=OUTPUT %s
78
// REQUIRES: swift_interpreter
89

910
// FIXME: iOS doesn't work because this test needs the interpreter to handle

test/lit.cfg

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ if lit_config.params.get('disable_unittests', None) is not None:
207207
# test_source_root: The root path where tests are located.
208208
config.test_source_root = os.path.dirname(__file__)
209209

210-
# test_exec_root: The root path where tests should be run.
210+
# swift_obj_root: The path to the swift build root.
211211
swift_obj_root = getattr(config, 'swift_obj_root', None)
212212

213213
# cmake. The path to the cmake executable we used to configure swift.
@@ -1799,12 +1799,6 @@ if sftp_server_path:
17991799
config.substitutions.append(('%sftp-server',
18001800
sftp_server_path or 'no-sftp-server'))
18011801

1802-
subst_target_jit_run = ""
1803-
if 'swift_interpreter' in config.available_features:
1804-
subst_target_jit_run = (
1805-
"%s -interpret %s" %
1806-
(config.target_swift_frontend, sdk_overlay_link_path))
1807-
18081802
subst_target_repl_run_simple_swift = ""
18091803
if 'swift_repl' in config.available_features:
18101804
subst_target_repl_run_simple_swift = (
@@ -1891,6 +1885,17 @@ if not kIsWindows:
18911885
"SIMCTL_CHILD_DYLD_LIBRARY_PATH='{0}' " # Simulator option
18921886
.format(all_stdlib_path, libdispatch_path)) + config.target_run
18931887

1888+
subst_target_jit_prefix = ""
1889+
if platform.system() == 'Darwin' and config.target_run:
1890+
subst_target_jit_prefix = config.target_run
1891+
1892+
subst_target_jit_run = ""
1893+
if 'swift_interpreter' in config.available_features:
1894+
subst_target_jit_run = (
1895+
"%s %s -interpret %s" %
1896+
(subst_target_jit_prefix,
1897+
config.target_swift_frontend, sdk_overlay_link_path))
1898+
18941899
if not getattr(config, 'target_run_simple_swift', None):
18951900
config.target_run_simple_swift_parameterized = SubstituteCaptures(
18961901
r"%%empty-directory(%%t) && "
@@ -2080,10 +2085,14 @@ config.substitutions.append(('%target-swift-reflection-test', config.target_swif
20802085

20812086
config.substitutions.append(('%target-swift-reflection-dump', '{} {} {}'.format(config.swift_reflection_dump, '-arch', run_cpu)))
20822087
config.substitutions.append(('%target-swiftc_driver', config.target_swiftc_driver))
2088+
20832089
config.substitutions.append(('%target-swift-remoteast-test-with-sdk',
2084-
'%s -sdk %r' %
2085-
(config.swift_remoteast_test, config.variant_sdk)))
2086-
config.substitutions.append(('%target-swift-remoteast-test', config.swift_remoteast_test))
2090+
'%s %s -sdk %r' %
2091+
(subst_target_jit_prefix,
2092+
config.swift_remoteast_test, config.variant_sdk)))
2093+
config.substitutions.append(('%target-swift-remoteast-test',
2094+
'%s %s' % (subst_target_jit_prefix,
2095+
config.swift_remoteast_test)))
20872096

20882097
if hasattr(config, 'target_swift_autolink_extract'):
20892098
config.available_features.add('autolink-extract')

0 commit comments

Comments
 (0)