Skip to content

Commit b938328

Browse files
authored
build-using-self use a self build of swift-test instead (#8548)
We are seeing hangs in swift test on Windows. Instead of build-using-self using the underlying toolchain, build swift-test and use that for the tests. When we make improvements to it to fix the underlying problem, we will be able to take advantage of that fix right away.
1 parent 95ce2a3 commit b938328

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

IntegrationTests/Sources/IntegrationTestSupport/Helpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public let lldb: AbsolutePath = {
106106
}()
107107

108108
public let swiftpmBinaryDirectory: AbsolutePath = {
109-
if let environmentPath = ProcessInfo.processInfo.environment["SWIFTPM_BIN_DIR"] {
109+
if let environmentPath = ProcessInfo.processInfo.environment["SWIFTPM_CUSTOM_BIN_DIR"] {
110110
return try! AbsolutePath(validating: environmentPath)
111111
}
112112

Utilities/build-using-self

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def is_on_darwin() -> bool:
102102
def set_environment(*, swiftpm_bin_dir: pathlib.Path,) -> None:
103103
os.environ["SWIFTCI_IS_SELF_HOSTED"] = "1"
104104

105-
# Set the SWIFTPM_BIN_DIR path
106-
os.environ["SWIFTPM_BIN_DIR"] = str(swiftpm_bin_dir)
105+
# Set the SWIFTPM_CUSTOM_BIN_DIR path
106+
os.environ["SWIFTPM_CUSTOM_BIN_DIR"] = str(swiftpm_bin_dir)
107107

108108
# Ensure SDKROOT is configure
109109
if is_on_darwin():
@@ -133,6 +133,7 @@ def run_bootstrap(swiftpm_bin_dir: pathlib.Path) -> None:
133133

134134
def main() -> None:
135135
args = get_arguments()
136+
ignore = "-Xlinker /ignore:4217" if os.name == "nt" else ""
136137
logging.getLogger().setLevel(logging.DEBUG if args.is_verbose else logging.INFO)
137138
logging.debug("Args: %r", args)
138139

@@ -144,31 +145,27 @@ def main() -> None:
144145
shlex.split("swift --version"),
145146
)
146147

147-
# call(
148-
# shlex.split("swift package reset"),
149-
# )
150148
call(
151149
shlex.split("swift package update"),
152150
)
153151
call(
154-
shlex.split(f"swift build --configuration {args.config}"),
155-
)
156-
swift_testing_arg= "--enable-swift-testing" if args.enable_swift_testing else ""
157-
xctest_arg= "--enable-xctest" if args.enable_swift_testing else ""
158-
call(
159-
shlex.split(f"swift test --configuration {args.config} --parallel {swift_testing_arg} {xctest_arg}"),
152+
shlex.split(f"swift build --configuration {args.config} {ignore}"),
160153
)
161154

162-
with change_directory(REPO_ROOT_PATH / "IntegrationTests"):
163-
call(
164-
shlex.split("swift package update"),
165-
)
166-
call(
167-
shlex.split(
168-
f"{swiftpm_bin_dir / 'swift-test'} --parallel",
169-
posix=(os.name == "posix"), # must be set correctly, otherwhsie shlex.split("C:\\Foo\\bar") become ['CFoobar']
170-
),
171-
)
155+
if os.name != "nt": # turn off for Windows until we get the hang resolved
156+
swift_testing_arg= "--enable-swift-testing" if args.enable_swift_testing else ""
157+
xctest_arg= "--enable-xctest" if args.enable_swift_testing else ""
158+
call(
159+
shlex.split(f"swift run swift-test --configuration {args.config} --parallel {swift_testing_arg} {xctest_arg} --scratch-path .test {ignore}"),
160+
)
161+
162+
integration_test_dir = REPO_ROOT_PATH / "IntegrationTests"
163+
call(
164+
shlex.split(f"swift package --package-path {integration_test_dir} update"),
165+
)
166+
call(
167+
shlex.split(f"swift run swift-test --package-path {integration_test_dir} --parallel {ignore}"),
168+
)
172169

173170
if is_on_darwin():
174171
run_bootstrap(swiftpm_bin_dir=swiftpm_bin_dir)

Utilities/test-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def get_env(args):
128128
if args.lldb_path:
129129
env['LLDB_PATH'] = args.lldb_path
130130
if args.swiftpm_bin_dir:
131-
env["SWIFTPM_BIN_DIR"] = args.swiftpm_bin_dir
131+
env["SWIFTPM_CUSTOM_BIN_DIR"] = args.swiftpm_bin_dir
132132

133133
return env
134134

0 commit comments

Comments
 (0)