Skip to content

Commit b24afe5

Browse files
[Testing] Try fix windows build
1 parent b989609 commit b24afe5

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

Tests/SwiftDriverTests/Helpers/IncrementalTestHarness.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ extension IncrementalTestHarness {
915915
}
916916

917917
func doTheCompile(_ driver: inout Driver) {
918+
touch(tempDir.appending(component: "timestamp"))
918919
let jobs = try! driver.planBuild()
919920
try? driver.run(jobs: jobs)
920921
}

Tests/SwiftDriverTests/IncrementalExplicitBuildTests.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ struct IncrementalExplicitBuildTests: DiagVerifiable {
9191

9292
let GInterfacePath = h.explicitSwiftDependenciesPath.appending(component: "G.swiftinterface")
9393
h.touch(GInterfacePath)
94+
h.touch(GInterfacePath) // touch twice to make sure it is newer than build output.
9495

9596
try h.doABuild(
9697
"update dependency (G) interface timestamp",
@@ -232,7 +233,8 @@ struct IncrementalExplicitBuildTests: DiagVerifiable {
232233

233234
let EInterfacePath = h.explicitSwiftDependenciesPath.appending(component: "E.swiftinterface")
234235
// Just update the time-stamp of one of the module dependencies and use a value
235-
// it is defined in.
236+
// it is defined in. Touch twice to make sure it is newer than the build product.
237+
h.touch(EInterfacePath)
236238
h.touch(EInterfacePath)
237239
h.replace(contentsOf: "other", with: "import E;let bar = foo + moduleEValue")
238240

@@ -293,7 +295,8 @@ struct IncrementalExplicitBuildTests: DiagVerifiable {
293295
// Just update the time-stamp of one of the module dependencies' outputs.
294296
h.touch(pathToGModule)
295297
// Touch one of the inputs to actually trigger the incremental build.
296-
h.touch(h.inputPath(basename: "other"))
298+
try h.touch("other")
299+
try h.touch("other") // touch twice to make sure it is newer than build output.
297300

298301
try h.doABuild(
299302
"update dependency (G) result timestamp",
@@ -341,7 +344,8 @@ struct IncrementalExplicitBuildTests: DiagVerifiable {
341344
try h.buildInitialState(checkDiagnostics: false)
342345

343346
// Touch one of the inputs to actually trigger the incremental build.
344-
h.touch(h.inputPath(basename: "other"))
347+
try h.touch("other")
348+
try h.touch("other") // touch twice to make sure it is newer than build output.
345349

346350
// Touch the output of a dependency of 'G', to ensure that it is newer than 'G', but 'G' still
347351
// does not get "invalidated".
@@ -399,7 +403,8 @@ struct IncrementalExplicitBuildTests: DiagVerifiable {
399403
try h.buildInitialState(checkDiagnostics: false)
400404

401405
// Touch one of the inputs to actually trigger the incremental build.
402-
h.touch(h.inputPath(basename: "other"))
406+
try h.touch("other")
407+
try h.touch("other") // touch twice to make sure it is newer than build output.
403408

404409
// Touch 'G.swiftmodule' to trigger the dependency scanner to re-scan it.
405410
h.touch(newPathToGModule)

Tests/SwiftDriverTests/ToolchainTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,17 @@ import CRT
188188
try localFileSystem.createSymbolicLink(customSwiftFrontend, pointingAt: defaultSwiftFrontend, relative: false)
189189

190190
try withTemporaryDirectory { tempDirectory in
191+
let fs = TestLocalFileSystem(cwd: tempDirectory)
191192
let anotherSwiftFrontend = tempDirectory.appending(component: executableName("swift-frontend"))
192-
try localFileSystem.createSymbolicLink(anotherSwiftFrontend, pointingAt: defaultSwiftFrontend, relative: false)
193+
try fs.createSymbolicLink(anotherSwiftFrontend, pointingAt: defaultSwiftFrontend, relative: false)
193194

194195
// test if SWIFT_DRIVER_TOOLNAME_EXEC is respected
195196
do {
196197
var driver = try Driver.forTesting(args: ["swiftc", "-print-target-info"],
197198
env: [PATH: ProcessEnv.path!,
198199
SWIFT_FRONTEND_EXEC: customSwiftFrontend.pathString,
199-
SWIFT_SCANNER_LIB: customSwiftScan.pathString])
200+
SWIFT_SCANNER_LIB: customSwiftScan.pathString],
201+
fileSystem: fs)
200202
let jobs = try driver.planBuild()
201203
#expect(jobs.count == 1)
202204
expectEqual(jobs.first!.tool.name, customSwiftFrontend.pathString)
@@ -205,7 +207,8 @@ import CRT
205207
// test if tools directory is respected
206208
do {
207209
var driver = try Driver.forTesting(args: ["swiftc", "-print-target-info", "-tools-directory", toolsDirectory.pathString],
208-
env: [PATH: tempDirectory.pathString, SWIFT_SCANNER_LIB: customSwiftScan.pathString])
210+
env: [PATH: tempDirectory.pathString, SWIFT_SCANNER_LIB: customSwiftScan.pathString],
211+
fileSystem: fs)
209212
let jobs = try driver.planBuild()
210213
#expect(jobs.count == 1)
211214
expectEqual(jobs.first!.tool.name, customSwiftFrontend.pathString)
@@ -219,8 +222,8 @@ import CRT
219222
let separator = ":"
220223
#endif
221224
var driver = try Driver.forTesting(args: ["swiftc", "-print-target-info"],
222-
cwd: tempDirectory,
223-
env: [PATH: [toolsDirectory.pathString, ProcessEnv.path!].joined(separator: separator), SWIFT_SCANNER_LIB: customSwiftScan.pathString])
225+
env: [PATH: [toolsDirectory.pathString, ProcessEnv.path!].joined(separator: separator), SWIFT_SCANNER_LIB: customSwiftScan.pathString],
226+
fileSystem: fs)
224227
let jobs = try driver.planBuild()
225228
#expect(jobs.count == 1)
226229
expectEqual(jobs.first!.tool.name, anotherSwiftFrontend.pathString)

0 commit comments

Comments
 (0)