mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-09-05 17:14:28 +00:00
Fix chained firmware patch data flow
This commit is contained in:
@@ -298,6 +298,31 @@ struct BinaryBufferTests {
|
||||
}
|
||||
}
|
||||
|
||||
struct IBootPatcherIdempotencyTests {
|
||||
@Test func serialLabelsPatchTwoBannerRunsWhenLabelAbsent() {
|
||||
let banner = String(repeating: "=", count: 32)
|
||||
let payload = Data("prefix \(banner) middle \(banner) suffix".utf8)
|
||||
let patcher = IBootPatcher(data: payload, mode: .ibss, verbose: false)
|
||||
|
||||
patcher.patchSerialLabels()
|
||||
|
||||
#expect(patcher.patches.count == 2)
|
||||
#expect(patcher.patches.allSatisfy {
|
||||
String(data: $0.patchedBytes, encoding: .ascii) == "Loaded iBSS"
|
||||
})
|
||||
}
|
||||
|
||||
@Test func serialLabelsSkipWhenLabelAlreadyPresent() {
|
||||
let banner = String(repeating: "=", count: 32)
|
||||
let payload = Data("Loaded iBSS\0 prefix \(banner) middle \(banner) suffix".utf8)
|
||||
let patcher = IBootPatcher(data: payload, mode: .ibss, verbose: false)
|
||||
|
||||
patcher.patchSerialLabels()
|
||||
|
||||
#expect(patcher.patches.isEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
struct IM4PPayloadParityTests {
|
||||
@Test func ibssIM4PPayloadMatchesRawAndJBPatcherFindsNoncePatch() throws {
|
||||
let baseDir = URL(fileURLWithPath: #filePath)
|
||||
|
||||
Reference in New Issue
Block a user