Skip to content

Commit cdaab7b

Browse files
authored
Set Explicit Incremental Module Build tests to use own module cache (#1392)
With the timeline of the module cache being tied to the current run of the test suite. To try and avoid possible conflicts with stale cached modules.
1 parent bb3fdfe commit cdaab7b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import TestUtilities
2121
final class IncrementalCompilationTests: XCTestCase {
2222

2323
var tempDir: AbsolutePath = AbsolutePath("/tmp")
24+
var explicitModuleCacheDir: AbsolutePath = AbsolutePath("/tmp/ModuleCache")
2425

2526
var derivedDataDir: AbsolutePath {
2627
tempDir.appending(component: "derivedData")
@@ -64,8 +65,8 @@ final class IncrementalCompilationTests: XCTestCase {
6465
[
6566
"swiftc",
6667
"-module-name", module,
67-
"-o", derivedDataPath.appending(component: module + ".o").pathString,
68-
"-output-file-map", OFM.pathString,
68+
"-o", derivedDataPath.appending(component: module + ".o").nativePathString(escaped: true),
69+
"-output-file-map", OFM.nativePathString(escaped: true),
6970
"-driver-show-incremental",
7071
"-driver-show-job-lifecycle",
7172
"-enable-batch-mode",
@@ -74,10 +75,11 @@ final class IncrementalCompilationTests: XCTestCase {
7475
"-incremental",
7576
"-no-color-diagnostics",
7677
]
77-
+ inputPathsAndContents.map {$0.0.pathString} .sorted()
78+
+ inputPathsAndContents.map {$0.0.nativePathString(escaped: true)} .sorted()
7879
}
7980
var explicitBuildArgs: [String] {
8081
["-explicit-module-build",
82+
"-module-cache-path", explicitModuleCacheDir.nativePathString(escaped: true),
8183
// Disable implicit imports to keep tests simpler
8284
"-Xfrontend", "-disable-implicit-concurrency-module-import",
8385
"-Xfrontend", "-disable-implicit-string-processing-module-import",
@@ -87,6 +89,7 @@ final class IncrementalCompilationTests: XCTestCase {
8789

8890
override func setUp() {
8991
self.tempDir = try! withTemporaryDirectory(removeTreeOnDeinit: false) {$0}
92+
self.explicitModuleCacheDir = tempDir.appending(component: "ModuleCache")
9093
try! localFileSystem.createDirectory(derivedDataPath)
9194
OutputFileMapCreator.write(module: module,
9295
inputPaths: inputPathsAndContents.map {$0.0},

0 commit comments

Comments
 (0)