Run a virtual iPhone on an Apple Silicon Mac.
Swift
Use canonical scratch paths in firmware confinement tests
Lakr95e9bc87f6b5
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/CryptexFileOpsTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/CryptexFileOpsTests.swiftindex bdf37458..f0490afa 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/CryptexFileOpsTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/CryptexFileOpsTests.swift@@ -64,7 +64,9 @@ struct CryptexFileOpsTests {let url = FileManager.default.temporaryDirectory.appendingPathComponent("vphone-fileops-\(UUID().uuidString)")try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)- return url+ guard let path = realpath(url.path, nil) else { throw POSIXError(.ENOENT) }+ defer { free(path) }+ return URL(fileURLWithPath: String(cString: path))}private func mode(of url: URL) throws -> Int {diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/KernelCacheMixerTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/KernelCacheMixerTests.swiftindex 4006477e..d5ee1861 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/KernelCacheMixerTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/KernelCacheMixerTests.swift@@ -46,8 +46,11 @@ struct KernelCacheMixerTests {@Test("Firmware snapshot excludes disks and untrusted tools, and publication replaces links")func confinedFirmwareSnapshot() throws {- let base = FileManager.default.temporaryDirectory.appending(path: UUID().uuidString).resolvingSymlinksInPath()- try FileManager.default.createDirectory(at: base, withIntermediateDirectories: true, attributes: [.posixPermissions: 0o700])+ let temporary = FileManager.default.temporaryDirectory.appending(path: UUID().uuidString)+ try FileManager.default.createDirectory(at: temporary, withIntermediateDirectories: true, attributes: [.posixPermissions: 0o700])+ guard let path = realpath(temporary.path, nil) else { throw POSIXError(.ENOENT) }+ let base = URL(fileURLWithPath: String(cString: path))+ free(path)defer { try? FileManager.default.removeItem(at: base) }let vm = base.appending(path: "vm")let restore = vm.appending(path: "Test_Restore")