Run a virtual iPhone on an Apple Silicon Mac.
Swift
Expect the restore errors the code actually reports
Lakrd0269bc9b67d
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestore/Support/VPhoneRestoreBackendError.swift b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestore/Support/VPhoneRestoreBackendError.swiftindex da7d4d65..664a835a 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestore/Support/VPhoneRestoreBackendError.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestore/Support/VPhoneRestoreBackendError.swift@@ -8,9 +8,10 @@ import Foundation/// type by that name and `vphone-cli` imports both, so sharing it would make/// every unqualified use ambiguous.///-/// The messages of the first five cases are word for word the ones-/// `scripts/pymobiledevice3_bridge.py` printed, because scripts and people-/// have been reading them for a while.+/// The first five cases are the ones `scripts/pymobiledevice3_bridge.py` used+/// to raise, and the notes below record what it reported for each. The+/// messages themselves are no longer its wording: they were rewritten to say+/// what failed and what to do next.public enum VPhoneRestoreBackendError: Error, Equatable {// MARK: ECIDdiff --git a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreEventTests.swift b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreEventTests.swiftindex 2e4764b4..3291a93d 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreEventTests.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreEventTests.swift@@ -124,18 +124,22 @@ struct RestoreEventTests {}}- @Test func `the timeout message is the pythons word for word`() {+ @Test func `the timeout message names the mode and what to do next`() {let error = VPhoneRestoreBackendError.recoveryProbeTimedOut(mode: "dfu/recovery")- #expect("\(error)" == "Timed out waiting for dfu/recovery endpoint")+ #expect("\(error)"+ == "The device did not enter dfu/recovery mode in time. Check the connection, then try again.")}// MARK: - Error messages- @Test func `the restore tree messages are the pythons word for word`() {+ @Test func `the restore tree messages say which folder is wrong`() {+ // These once repeated Python's wording verbatim. They were rewritten to+ // say what to do next; the one that can name a path still names it.let none = VPhoneRestoreBackendError.noRestoreDirectory(URL(fileURLWithPath: "/tmp/vm"))- #expect("\(none)" == "No iPhone*_Restore directory found in /tmp/vm")+ #expect("\(none)"+ == "No restore folder was found in /tmp/vm. Prepare the firmware, then try again.")let several = VPhoneRestoreBackendError.multipleRestoreDirectories(["a", "b"])#expect("\(several)"- == "Multiple iPhone*_Restore directories found; keep only one active restore tree")+ == "More than one restore folder was found. Keep only one, then try again.")}}diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreIdentityTests.swift b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreIdentityTests.swiftindex 332b2ab3..783787ac 100644--- a/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreIdentityTests.swift+++ b/VPhoneExecutable/VPhoneCommand/VPhoneRestore/VPhoneRestoreTests/RestoreIdentityTests.swift@@ -73,9 +73,14 @@ struct RestoreIdentityTests {}}- @Test func `invalid ECID carries the python message`() {- #expect("\(VPhoneRestoreBackendError.ecidEmpty)" == "ECID is empty")- #expect("\(VPhoneRestoreBackendError.ecidInvalid("zz"))" == "Invalid ECID: zz")+ @Test func `an invalid ECID says what to enter instead`() {+ // The bridge once reported Python's wording; the messages were rewritten+ // to say what failed and what to do next. Both still name the rejected+ // value and the format that would be accepted.+ #expect("\(VPhoneRestoreBackendError.ecidEmpty)"+ == "The ECID is empty. Enter up to 16 hexadecimal digits.")+ #expect("\(VPhoneRestoreBackendError.ecidInvalid("zz"))"+ == "zz is not a valid ECID. Enter up to 16 hexadecimal digits.")}// MARK: - UDID