Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Explicit Incremental Module Build tests to use own module cache #1392

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions Tests/SwiftDriverTests/IncrementalCompilationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import TestUtilities
final class IncrementalCompilationTests: XCTestCase {

var tempDir: AbsolutePath = AbsolutePath("/tmp")
var explicitModuleCacheDir: AbsolutePath = AbsolutePath("/tmp/ModuleCache")

var derivedDataDir: AbsolutePath {
tempDir.appending(component: "derivedData")
Expand Down Expand Up @@ -64,8 +65,8 @@ final class IncrementalCompilationTests: XCTestCase {
[
"swiftc",
"-module-name", module,
"-o", derivedDataPath.appending(component: module + ".o").pathString,
"-output-file-map", OFM.pathString,
"-o", derivedDataPath.appending(component: module + ".o").nativePathString(escaped: true),
"-output-file-map", OFM.nativePathString(escaped: true),
"-driver-show-incremental",
"-driver-show-job-lifecycle",
"-enable-batch-mode",
Expand All @@ -74,10 +75,11 @@ final class IncrementalCompilationTests: XCTestCase {
"-incremental",
"-no-color-diagnostics",
]
+ inputPathsAndContents.map {$0.0.pathString} .sorted()
+ inputPathsAndContents.map {$0.0.nativePathString(escaped: true)} .sorted()
}
var explicitBuildArgs: [String] {
["-explicit-module-build",
"-module-cache-path", explicitModuleCacheDir.nativePathString(escaped: true),
// Disable implicit imports to keep tests simpler
"-Xfrontend", "-disable-implicit-concurrency-module-import",
"-Xfrontend", "-disable-implicit-string-processing-module-import",
Expand All @@ -87,6 +89,7 @@ final class IncrementalCompilationTests: XCTestCase {

override func setUp() {
self.tempDir = try! withTemporaryDirectory(removeTreeOnDeinit: false) {$0}
self.explicitModuleCacheDir = tempDir.appending(component: "ModuleCache")
try! localFileSystem.createDirectory(derivedDataPath)
OutputFileMapCreator.write(module: module,
inputPaths: inputPathsAndContents.map {$0.0},
Expand Down