()
| 328 | |
| 329 | |
| 330 | def main(): |
| 331 | if len(sys.argv) != 2: |
| 332 | print("usage: python3 test_daemon_open_readiness.py <ui-binary>") |
| 333 | return 2 |
| 334 | binary = os.path.abspath(sys.argv[1]) |
| 335 | if not os.path.isfile(binary): |
| 336 | print("SETUP FAIL: binary not found: %s" % binary) |
| 337 | return 2 |
| 338 | if os.name == "nt": |
| 339 | with open(binary, "rb") as handle: |
| 340 | if OPEN_MARKER_ENV.encode("ascii") not in handle.read(): |
| 341 | print("SETUP FAIL: Windows fixture must be built with TEST_SEAMS=1") |
| 342 | return 2 |
| 343 | |
| 344 | # macOS sockaddr_un paths are capped at 104 bytes. Anchor the isolated |
| 345 | # runtime directly under /private/tmp rather than the much longer per-user |
| 346 | # Darwin temporary root so the product endpoint itself remains valid. |
| 347 | short_temp_root = "/private/tmp" if sys.platform == "darwin" else tempfile.gettempdir() |
| 348 | with tempfile.TemporaryDirectory(prefix="cbm_uiopen_", dir=short_temp_root) as work: |
| 349 | if not assert_delayed_success(binary, work): |
| 350 | return 1 |
| 351 | if not assert_bounded_foreign_port_failure(binary, work): |
| 352 | return 1 |
| 353 | if not assert_active_daemon_open(binary, work): |
| 354 | return 1 |
| 355 | print("\nGREEN: daemon --open is bound to verified UI endpoint readiness.") |
| 356 | return 0 |
| 357 | |
| 358 | |
| 359 | if __name__ == "__main__": |
no test coverage detected