Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/synapse/blob/main/evidence/REPAIR-RECOVERY-L662/run-behavioral-red.py # synapse A component of the AienOS ecosystem. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `synapse / evidence / REPAIR-RECOVERY-L662 / run-behavioral-red.py` 17 lines ยท 2064 bytes Raw Blame History 1 from pathlib import Path 2 import os,json,subprocess,hashlib 3 h=Path.home();root=h/'workspace/hermes-loop-synapse105-L662';prior=h/'handoffs/L662-initial-host';out=h/'handoffs/L662-behavioral-red' 4 assert json.loads((prior/'state.json').read_text())['status']=='passed' 5 assert subprocess.check_output(['git','-C',str(root),'status','--porcelain'],text=True)=='' 6 out.mkdir(exist_ok=False) 7 src=h/'handoffs/L662-blockdev-tests-red.rs';dst=root/'crates/synapse-store/src/blockdev_tests.rs';dst.write_bytes(src.read_bytes()) 8 env=os.environ.copy();env['PATH']=str(h/'.cargo/bin')+':'+str(h/'.local/bin')+':'+env['PATH'];env['TMPDIR']=str(out/'tmp');Path(env['TMPDIR']).mkdir();head=subprocess.check_output(['git','-C',str(root),'rev-parse','HEAD'],text=True).strip();env['CARGO_TARGET_DIR']=str(h/'workspace/targets/L662'/head) 9 state={'production_head':head,'test_source_sha256':hashlib.sha256(dst.read_bytes()).hexdigest(),'results':[],'complete':False} 10 for label,test,needle in [('backup-overflow','r1_repair_backup_overflow_length_is_refused_without_panicking','attempt to add with overflow'),('inherited-lock','r1_repair_parent_drop_releases_lock_despite_inherited_helper_fd',"retained the departed owner's lock")]: 11 cmd=['timeout','--signal=TERM','120s',str(h/'.local/bin/quiet-build'),'cargo','test','--locked','-j','6','-p','synapse-store',test,'--','--nocapture','--test-threads=1'] 12 with (out/(label+'.log')).open('w') as f:rc=subprocess.run(cmd,cwd=root,env=env,stdout=f,stderr=subprocess.STDOUT).returncode 13 text=(out/(label+'.log')).read_text();observed=rc==101 and needle in text 14 state['results'].append({'case':label,'command':cmd,'exit':rc,'expected_behavior_failure_observed':observed});(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 15 print(label,'exit',rc,'behavioral RED',observed);print('\n'.join(text.splitlines()[-18:])) 16 state['complete']=all(x['expected_behavior_failure_observed'] for x in state['results']);(out/'state.json').write_text(json.dumps(state,indent=2)+'\n') 17 raise SystemExit(0 if state['complete'] else 1)