32 lines
1.7 KiB
Python
32 lines
1.7 KiB
Python
import hashlib
|
|
import json
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
root=Path(__file__).resolve().parent
|
|
project=root.parents[1]
|
|
data=json.loads((root/'gpio-can-results.json').read_text(encoding='utf-8'))
|
|
assert len(data['checks'])==36
|
|
assert data['physical_port']=='CAN1' and data['bitrate']==500000
|
|
for row in data['checks']:
|
|
assert row['pcan_status']=='0x0'
|
|
assert row['snapshot']['debug_state']==[0]*16
|
|
assert row['snapshot']['can_errors']==row['snapshot']['uart_errors']==0
|
|
for bit in range(15):
|
|
high=next(r for r in data['checks'] if r['name']==f'PD{bit}_high')
|
|
low=next(r for r in data['checks'] if r['name']==f'PD{bit}_low')
|
|
assert high['snapshot']['state']==1<<bit and low['snapshot']['state']==0
|
|
assert high['snapshot']['timestamp']==2000+bit*2
|
|
assert low['snapshot']['timestamp']==2001+bit*2
|
|
assert (root/'flash-readback.bin').read_bytes()==(project/'output/firmware/AMI_Controller.bin').read_bytes()
|
|
data['result']='Raw GPIO reception passed; DEBUG page state changes FAILED'
|
|
data['firmware_sha256']=hashlib.sha256((root/'flash-readback.bin').read_bytes()).hexdigest().upper()
|
|
(root/'gpio-can-results.json').write_text(json.dumps(data,indent=2),encoding='utf-8')
|
|
out=project/'docs/evidence/2026-10-03/debug-can-retest'
|
|
out.mkdir(parents=True,exist_ok=True)
|
|
for pattern in ('*.json','*_ram.log','test_gpio_can.py','probe_link.py','publish_results.py'):
|
|
for src in root.glob(pattern): shutil.copy2(src,out/src.name)
|
|
for name in ('mcu_all_high.png','mcu_PD0_high.png','mcu_PD14_high.png','mcu_final_zero.png','current_hmi.png'):
|
|
shutil.copy2(root/name,out/name)
|
|
print(json.dumps({'raw_checks':36,'high_checks':15,'low_checks':15,'debug_page_passed':False,'evidence':str(out)}))
|