Skip to content

Commit 30461d6

Browse files
committed
Move WASI check out of runner main source
1 parent 250fbf6 commit 30461d6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/Build/LLBuildCommands.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ final class TestEntryPointCommand: CustomLLBuildCommand, TestBuildCommand {
233233
"false"
234234
}
235235

236+
/// On WASI, we can't block the main thread, so XCTestMain is defined as async.
237+
let awaitXCTMainKeyword = if context.productsBuildParameters.triple.isWASI() {
238+
"await"
239+
} else {
240+
""
241+
}
242+
236243
// FIXME: work around crash on Amazon Linux 2 when main function is async (rdar://128303921)
237244
let asyncMainKeyword = if context.productsBuildParameters.triple.isLinux() {
238245
"async"
@@ -292,12 +299,7 @@ final class TestEntryPointCommand: CustomLLBuildCommand, TestBuildCommand {
292299
#if \#(xctestImportCondition)
293300
if testingLibrary == "xctest" {
294301
\#(testObservabilitySetup)
295-
#if os(WASI)
296-
/// On WASI, we can't block the main thread, so XCTestMain is defined as async.
297-
await XCTMain(__allDiscoveredTests()) as Never
298-
#else
299-
XCTMain(__allDiscoveredTests()) as Never
300-
#endif
302+
\#(awaitXCTMainKeyword) XCTMain(__allDiscoveredTests()) as Never
301303
}
302304
#endif
303305
}

0 commit comments

Comments
 (0)