also looking at this
fix(ios): give getPendingNotifications a deadline, on the shared block table
#247
2 files
+164
-60
| @@ -2013,6 +2013,34 @@ test "no case the page waits on casts its argument without answering the other w | ||
| 2013 | 2013 | } |
| 2014 | 2014 | } |
| 2015 | 2015 | |
| 2016 | test "a module that parks a call on a completion block also gives it a deadline" { | |
| 2017 | // #223: a call parked on `ios_pending` is one whose only answer comes from | |
| 2018 | // a framework completion. The table makes a late completion harmless; it | |
| 2019 | // does not make one that never arrives answer at all. Both halves or | |
| 2020 | // neither — parking without a deadline is a promise that can wait for | |
| 2021 | // ever, which is what #211 found on CI twice. | |
| 2022 | var parked: usize = 0; | |
| 2023 | for (zig_sources) |source| { | |
| 2024 | if (std.mem.indexOf(u8, source, "ios_pending.Table(") == null) continue; | |
| 2025 | parked += 1; | |
| 2026 | if (std.mem.indexOf(u8, source, "scheduleDeadline(") != null) continue; | |
| 2027 | ||
| 2028 | // Named by the first action it declares, which is how these files are | |
| 2029 | // recognisable without embedding their paths. | |
| 2030 | const at = std.mem.indexOf(u8, source, "pub const") orelse 0; | |
| 2031 | const line_end = std.mem.indexOfScalarPos(u8, source, at, '\n') orelse at; | |
| 2032 | std.debug.print( | |
| 2033 | "a module parks calls on ios_pending.Table and never calls scheduleDeadline.\n" ++ | |
| 2034 | " Near: {s}\n" ++ | |
| 2035 | " A parked call whose completion never comes settles nothing at all.\n", | |
| 2036 | .{source[at..line_end]}, | |
| 2037 | ); | |
| 2038 | return error.ParkedCallHasNoDeadline; | |
| 2039 | } | |
| 2040 | // Non-vacuity: the scan has to be finding the modules that do park. | |
| 2041 | try testing.expect(parked >= 2); | |
| 2042 | } | |
| 2043 | ||
| 2016 | 2044 | test "every call the page waits on has a case that can resolve it" { |
| 2017 | 2045 | const region = dispatcherRegion(); |
| 2018 | 2046 | var awaited = try collectAwaitedActions(testing.allocator); |