()
| 6290 | } |
| 6291 | |
| 6292 | fn check_rust_startup_abi_boundary() -> Result<()> { |
| 6293 | let path = Path::new("src/pglite/postgres_mod.rs"); |
| 6294 | let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?; |
| 6295 | |
| 6296 | for marker in [ |
| 6297 | "struct PgliteLifecycleExports", |
| 6298 | "struct WasixProtocolExports", |
| 6299 | "fn ensure_integrated_pglite_contract", |
| 6300 | "fn record_backend_c_timings", |
| 6301 | "pgl_backend_timing_reset", |
| 6302 | "pgl_backend_timing_elapsed_us", |
| 6303 | "host_requires_process_exit_error_recovery", |
| 6304 | "pgl_set_force_host_error_recovery", |
| 6305 | "The upstream lifecycle is already running by this point", |
| 6306 | ] { |
| 6307 | if !text.contains(marker) { |
| 6308 | bail!( |
| 6309 | "{} must keep upstream lifecycle exports separate from WASIX protocol ABI; missing {marker:?}", |
| 6310 | path.display() |
| 6311 | ); |
| 6312 | } |
| 6313 | } |
| 6314 | if text.contains("struct Exports") { |
| 6315 | bail!( |
| 6316 | "{} must not collapse PGlite lifecycle and WASIX protocol exports into a generic Exports struct", |
| 6317 | path.display() |
| 6318 | ); |
| 6319 | } |
| 6320 | |
| 6321 | let lifecycle_start = text |
| 6322 | .find("struct PgliteLifecycleExports") |
| 6323 | .ok_or_else(|| anyhow!("missing PgliteLifecycleExports"))?; |
| 6324 | let protocol_start = text |
| 6325 | .find("struct WasixProtocolExports") |
| 6326 | .ok_or_else(|| anyhow!("missing WasixProtocolExports"))?; |
| 6327 | let lifecycle_block = &text[lifecycle_start..protocol_start]; |
| 6328 | for protocol_marker in [ |
| 6329 | "ProcessStartupPacket", |
| 6330 | "PostgresMainLoopOnce", |
| 6331 | "pgl_wasix_input", |
| 6332 | ] { |
| 6333 | if lifecycle_block.contains(protocol_marker) { |
| 6334 | bail!( |
| 6335 | "{} lifecycle export block leaked WASIX protocol marker {protocol_marker:?}", |
| 6336 | path.display() |
| 6337 | ); |
| 6338 | } |
| 6339 | } |
| 6340 | for lifecycle_marker in [ |
| 6341 | "wasi_start", |
| 6342 | "set_force_host_error_recovery", |
| 6343 | "set_active", |
| 6344 | "start_pglite", |
| 6345 | ] { |
| 6346 | if !lifecycle_block.contains(lifecycle_marker) { |
| 6347 | bail!( |
| 6348 | "{} must drive the integrated PGlite lifecycle; missing {lifecycle_marker:?}", |
| 6349 | path.display() |
no outgoing calls
no test coverage detected