from test_driver.machine import Machine, StartCommand, NixStartScript from test_driver.logger import TerminalLogger from pathlib import Path import os def make_machine(out_dir: Path, tmp_dir: Path) -> Machine: out_dir.mkdir(parents=True, exist_ok=True) tmp_dir.mkdir(parents=True, exist_ok=True) return Machine( out_dir = out_dir.absolute(), tmp_dir = tmp_dir.absolute(), start_command = NixStartScript(os.getenv("ROUTER_CMD") + "/bin/run-nixos-vm"), logger = TerminalLogger(), name = "router", ) router = make_machine(Path("router/out"), Path("router/tmp")) router.start() router.wait_for_unit("multi-user.target") router.shutdown()