2 from pathlib import Path
4 ROOT = Path(__file__).resolve().parents[1]
5 DISC_C = (ROOT / "libfriidump" / "disc.c").read_text(encoding="utf-8")
6 DISC_H = (ROOT / "libfriidump" / "disc.h").read_text(encoding="utf-8")
7 DVD_C = (ROOT / "libfriidump" / "dvd_drive.c").read_text(encoding="utf-8")
8 DVD_H = (ROOT / "libfriidump" / "dvd_drive.h").read_text(encoding="utf-8")
9 MAIN_C = (ROOT / "src" / "friidump.c").read_text(encoding="utf-8")
12 "always-visible seed diagnostic prefix": '[SEED-DIAG]' in DISC_C,
13 "seed block and sector evidence": 'seed_block_index' in DISC_H and 'sector_start' in DISC_H and 'sector_end' in DISC_H,
14 "retry evidence": 'int retry;' in DISC_H,
15 "prefetch stage": 'stage=prefetch' in DISC_C,
16 "streaming stage": '"streaming-read"' in DISC_C,
17 "header memdump stage": '"header-memdump"' in DISC_C,
18 "EDC memdump stage": '"edc-memdump"' in DISC_C,
19 "EDC validation stage": '"edc-unscramble-validation"' in DISC_C,
20 "split recovery stages": '"split-streaming-read"' in DISC_C and '"split-header-memdump"' in DISC_C and '"split-edc-memdump"' in DISC_C,
21 "transport command snapshot type": 'dvd_command_diagnostic' in DVD_H,
22 "transport result capture": 'transport_result' in DVD_C,
23 "Linux errno and SCSI evidence": 'saved_errno' in DVD_C and 'cgc.stat' in DVD_C and 'sense.sense_key' in DVD_C,
24 "Windows status and sense evidence": 'sptd -> ScsiStatus' in DVD_C and 'win_error' in DVD_C,
25 "public seed diagnostic getter": 'disc_get_seed_diagnostic' in DISC_H and 'disc_get_seed_diagnostic' in DISC_C,
26 "final seed diagnostic summary": 'Seed diagnostic final failure:' in MAIN_C,
27 "native report diagnostic note": 'Seed diagnostic: block %u/20' in MAIN_C,
28 "STOP UNIT after seed failure": 'STOP UNIT / spin-down after seed failure' in MAIN_C,
29 "STOP UNIT result note": 'STOP UNIT after seed failure succeeded.' in MAIN_C,
33 for name, ok in checks.items():
34 print(f"{'PASS' if ok else 'FAIL'}: {name}")
39 raise SystemExit("SEED DIAGNOSTICS CONTRACT: FAIL: " + ", ".join(failed))
41 print("SEED DIAGNOSTICS CONTRACT: PASS")