Files
HaloKeymind/tools/hil/profile_pair_run.py
T
mikecarper 091c8d8324 Preserve radio lab experiments and reuse unchanged SX1262 modulation
Skip redundant modulation writes during owned fast RX retunes when the last
acknowledged SF/BW/CR/LDRO tuple matches. Invalidate that cache after ordinary
setters, failed writes, and lifecycle changes.

Include the remaining scan, preamble, settling, and memory-soak experiments,
their collectors, validation notes, and original capture records. Preserve
capture bytes across checkouts and keep private soak credentials local.

Run lab collector and compiled contract tests in CI. Update the expectation,
profile mapping, and result-buffer tests for the extended lab tools, and make
the private WiFi override header optional for ordinary soak diagnostics.

Validation: 145 host tests passed from the staged source snapshot. Clean
heltec_v4_repeater and Xiao_S3_WIO_companion_radio_usb builds passed their
RAM/flash gates. All 229 staged capture files retain their original bytes;
all 75 local documentation links resolve in the clean snapshot.
2026-09-14 22:34:17 -07:00

31 lines
1.5 KiB
Python

"""Run the finite pair test with explicit ModemManager restoration."""
import argparse
import json
from pathlib import Path
import signal
import subprocess
parser=argparse.ArgumentParser()
parser.add_argument('--collector',choices=('profile_pair.py','profile_pair_4p6_collect.py'),default='profile_pair.py')
args=parser.parse_args()
root=Path(__file__).resolve().parent
if (root/'run-control.json').exists():raise RuntimeError('Already started')
if subprocess.run(['systemctl','is-active','--quiet','meshcore-memory-soak.service']).returncode==0:
raise RuntimeError('Soak active')
mm=subprocess.run(['systemctl','is-active','--quiet','ModemManager.service']).returncode==0
stopped=False;child=None;rc=1
try:
if mm:
subprocess.run(['sudo','-n','systemctl','stop','ModemManager.service'],check=True,timeout=15);stopped=True
child=subprocess.Popen(['python3','-u',str(root/args.collector)],cwd=root)
(root/'run-control.json').write_text(json.dumps({'pid':child.pid,'collector':args.collector,'modemmanager_before':mm}))
rc=child.wait(timeout=2400)
finally:
if child is not None and child.poll() is None:
child.send_signal(signal.SIGINT)
try:child.wait(timeout=30)
except subprocess.TimeoutExpired:child.terminate();child.wait(timeout=10)
if stopped:subprocess.run(['sudo','-n','systemctl','start','ModemManager.service'],check=True,timeout=15)
(root/'run-exit.json').write_text(json.dumps({'collector_exit':rc,'modemmanager_restored':not mm or stopped}))
raise SystemExit(rc)