Skip to content

Commit eba1952

Browse files
committed
Tests: avoid forming an in-place driver job
We would previously form an in-place job on Windows which would then terminate the tests. Explicitly use an output file map which generates a build record which prevents the in-place job.
1 parent a55602c commit eba1952

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,15 +1257,24 @@ final class ExplicitModuleBuildTests: XCTestCase {
12571257
let moduleBarPath = path.appending(component: "Bar.swiftmodule").nativePathString(escaped: true)
12581258
try localFileSystem.writeFileContents(srcBar, bytes: "public class KlassBar {}")
12591259

1260+
// Explicitly use an output file map to avoid an in-place job.
1261+
let outputFileMap = path.appending(component: "output-file-map.json")
1262+
try localFileSystem.writeFileContents(outputFileMap, bytes: """
1263+
{
1264+
"": {
1265+
"swift-dependencies": "Bar.swiftdeps"
1266+
}
1267+
}
1268+
""")
1269+
12601270
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
12611271
let (stdLibPath, shimsPath, _, _) = try getDriverArtifactsForScanning()
12621272

12631273
var driver1 = try Driver(args: ["swiftc",
12641274
"-explicit-module-build",
1265-
"-module-name",
1266-
"Bar",
1267-
"-working-directory",
1268-
path.nativePathString(escaped: true),
1275+
"-module-name", "Bar",
1276+
"-working-directory", path.nativePathString(escaped: true),
1277+
"-output-file-map", outputFileMap.nativePathString(escaped: false),
12691278
"-emit-module",
12701279
"-emit-module-path", moduleBarPath,
12711280
"-module-cache-path", moduleCachePath.nativePathString(escaped: true),
@@ -1298,15 +1307,13 @@ final class ExplicitModuleBuildTests: XCTestCase {
12981307
var driver2 = try Driver(args: ["swiftc",
12991308
"-I", path.nativePathString(escaped: true),
13001309
"-explicit-module-build",
1301-
"-module-name",
1302-
"Foo",
1303-
"-working-directory",
1304-
path.nativePathString(escaped: true),
1310+
"-module-name", "Foo",
1311+
"-working-directory", path.nativePathString(escaped: true),
1312+
"-output-file-map", outputFileMap.nativePathString(escaped: false),
13051313
"-emit-module",
13061314
"-emit-module-path", moduleFooPath,
13071315
"-module-cache-path", moduleCachePath.nativePathString(escaped: true),
1308-
"-module-alias",
1309-
"Car=Bar",
1316+
"-module-alias", "Car=Bar",
13101317
srcFoo.nativePathString(escaped: true),
13111318
"-I", stdLibPath.nativePathString(escaped: true),
13121319
"-I", shimsPath.nativePathString(escaped: true),

0 commit comments

Comments
 (0)