Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions tools/factory_test/run_factory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def main():

result = default_result()
deadline = time.monotonic() + args.timeout
fault_event_seen = False
adc_out_of_range_seen = False

try:
ser = serial.Serial(args.port, args.baud, timeout=0.25)
Expand Down Expand Up @@ -122,19 +124,24 @@ def main():
result["last_fault"] = fault
result["checks"]["telemetry_seen"] = result["telemetry_packets"] >= 5
if args.adc_min <= adc_raw <= args.adc_max:
result["checks"]["adc_sane"] = True
if fault == "NONE":
if not adc_out_of_range_seen:
result["checks"]["adc_sane"] = True
else:
result["checks"]["adc_sane"] = False
adc_out_of_range_seen = True
if fault == "NONE" and not fault_event_seen:
result["checks"]["fault_none"] = True

m = HEALTH_RE.search(line)
if m:
heap_min = int(m.group("heap_min"))
result["min_heap_seen"] = heap_min
if heap_min >= args.heap_floor:
result["checks"]["heap_above_floor"] = True
if result["min_heap_seen"] is None or heap_min < result["min_heap_seen"]:
result["min_heap_seen"] = heap_min
result["checks"]["heap_above_floor"] = (result["min_heap_seen"] >= args.heap_floor)

if FAULT_EVENT_RE.search(line):
result["checks"]["fault_none"] = False
fault_event_seen = True

if all(result["checks"].values()):
result["result"] = "PASS"
Expand Down
Loading