"""Manual replay of independent transcoder fixtures through a supplied CLI.""" from pathlib import Path import subprocess,sys,json,hashlib if len(sys.argv) not in [2,3]:raise SystemExit('usage: check_transcoders.py BINARY [REPORT_JSON]') binary=str(Path(sys.argv[1]).resolve());fixture=Path(__file__).with_name('transcoders.tsv') rows=[line.split('\t') for line in fixture.read_text().splitlines() if line and not line.startswith(';')] valid=[r for r in rows if r[0]=='text'];errors=[r for r in rows if r[0]=='error'] for at in range(0,len(valid),32): batch=valid[at:at+32];cmd=[binary,'-s'] for _,source,_ in batch:cmd+=['-e',source] p=subprocess.run(cmd,capture_output=True,text=True,timeout=30);assert p.returncode==0 and not p.stderr,(batch,p.stderr) lines=p.stdout.splitlines();assert len(lines)==len(batch),(batch,lines) for (_,source,wanted),actual in zip(batch,lines):assert actual==wanted,(source,actual,wanted) for _,source,_ in errors: p=subprocess.run([binary,'-s','-e',source],capture_output=True,text=True,timeout=10);assert p.returncode!=0 and p.stderr,(source,p.stdout) report={'status':'passed','fixture_cases':len(rows),'successful_outputs':len(valid),'expected_errors':len(errors),'binary_sha256':hashlib.sha256(Path(binary).read_bytes()).hexdigest(),'fixture_sha256':hashlib.sha256(fixture.read_bytes()).hexdigest(),'scope':'Manual independent fixture replay, not additional V test-function count.'} if len(sys.argv)==3:Path(sys.argv[2]).write_text(json.dumps(report,indent=2)+'\n') print(json.dumps(report))