Skip to content

Commit 5f5afac

Browse files
committed
[Test Only] Add a sleep to 'testInputModifiedDuringSingleJobBuild' to accomodate filesystems with insufficient timestamp precision
1 parent e02fad1 commit 5f5afac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Tests/SwiftDriverTests/JobExecutorTests.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,17 @@ final class JobExecutorTests: XCTestCase {
355355
let jobs = try driver.planBuild()
356356
XCTAssertEqual(jobs.count, 1)
357357
XCTAssertTrue(jobs[0].requiresInPlaceExecution)
358+
let soleJob = try XCTUnwrap(jobs.first)
359+
360+
// Sleep for 1s to allow for quiescing mtimes on filesystems with
361+
// insufficient timestamp precision.
362+
Thread.sleep(forTimeInterval: 1)
358363

359364
// Change the file
360365
try localFileSystem.writeFileContents(main, bytes: "let foo = 1")
361-
362-
XCTAssertThrowsError(try driver.run(jobs: jobs)) {
366+
// Ensure that the file modification since the start of the build planning process
367+
// results in a corresponding error.
368+
XCTAssertThrowsError(try soleJob.verifyInputsNotModified(since: driver.recordedInputModificationDates, fileSystem: localFileSystem)) {
363369
XCTAssertEqual($0 as? Job.InputError,
364370
.inputUnexpectedlyModified(TypedVirtualPath(file: VirtualPath.absolute(main).intern(), type: .swift)))
365371
}

0 commit comments

Comments
 (0)