Skip to content

Commit

Permalink
Create 'security' directory test should try writing files too (swiftl…
Browse files Browse the repository at this point in the history
…ang#3941)

Motivation:
Source compat test continues to fail even with swiftlang#3928:

```
"You don’t have permission to save the file “fingerprints” in the folder “security”
```

https://ci.swift.org/job/swift-PR-source-compat-suite/5709/artifact/

The tests we did with swiftlang#3938 shows that we can create directories but not write files.

Modifications:
Test creating `security` directory and writing file in it, and disable TOFU feature if the test fails.
  • Loading branch information
yim-lee committed Dec 14, 2021
1 parent b64b34a commit 1b0a937
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/Commands/SwiftTool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ public class SwiftTool {
if !fileSystem.exists(sharedSecurityDirectory) {
try fileSystem.createDirectory(sharedSecurityDirectory, recursive: true)
}
// And make sure we can write files (locking the directory writes a lock file)
try fileSystem.withLock(on: sharedSecurityDirectory, type: .exclusive) { }
return sharedSecurityDirectory
} catch {
self.observabilityScope.emit(warning: "Failed creating shared security directory: \(error)")
Expand Down

0 comments on commit 1b0a937

Please sign in to comment.