marionette / tests /run_smoke_on_robot.py
RemiFabre
Add smoke test to verify full playback pipeline on robot
8adddec
Raw
History Blame
1.95 kB
#!/usr/bin/env python3
"""Run the smoke test on the robot via SSH.
Syncs code, then runs smoke_test_on_robot.py on the robot.
Streams output in real-time so you can see if the robot moves
and audio plays.
Usage:
cd marionette
python tests/run_smoke_on_robot.py
python tests/run_smoke_on_robot.py --host 192.168.1.42
"""
import argparse
import subprocess
import sys
from pathlib import Path
# Reuse sync logic from run_on_robot
sys.path.insert(0, str(Path(__file__).parent))
from run_on_robot import sync_to_robot, ensure_deps, ssh_cmd, REMOTE_DIR, ROBOT_PYTHON
def main():
parser = argparse.ArgumentParser(
description="Run smoke test on the Reachy Mini robot via SSH.",
)
parser.add_argument("--host", default="reachy-mini.local")
parser.add_argument("--user", default="pollen")
parser.add_argument("--dry-run", action="store_true")
args = parser.parse_args()
# Sync code
print(f"Syncing code to {args.user}@{args.host}...")
ok = sync_to_robot(args.host, args.user, dry_run=args.dry_run)
if not ok:
print("Failed to sync.")
sys.exit(1)
if args.dry_run:
print("Dry run — not running test.")
sys.exit(0)
# Ensure deps
if not ensure_deps(args.host, args.user):
print("Failed to install deps.")
sys.exit(1)
# Run smoke test
remote_cmd = (
f"cd {REMOTE_DIR} && "
f"PYTHONPATH={REMOTE_DIR} "
f"{ROBOT_PYTHON} tests/smoke_test_on_robot.py"
)
print(f"\n{'=' * 60}")
print(f"Running smoke test on {args.user}@{args.host}")
print(f"{'=' * 60}\n")
proc = subprocess.Popen(
ssh_cmd(args.host, args.user, remote_cmd),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
bufsize=1,
)
for line in proc.stdout:
print(line, end="")
proc.wait()
sys.exit(proc.returncode)
if __name__ == "__main__":
main()