From 800fdb3b59f9b594fb49e86b935b9de3f4cc3404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Sun, 1 Oct 2023 21:56:13 +0200 Subject: [PATCH] test: sandbox: add option to use custom firecracker binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Barbáchano --- tests/README.md | 5 +++++ tools/sandbox.py | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index c3a3aca9e65b..c89b8814a7e2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -393,3 +393,8 @@ uvm.ssh.run("ls") snap = uvm.snapshot_full() uvm.help.tmux_ssh() ``` + +It supports a number of options, you can check with `devtool sandbox -- +--help`. + +## How to run tests outside of Docker diff --git a/tools/sandbox.py b/tools/sandbox.py index 4a50d6d24c07..3d3a43f0d06c 100755 --- a/tools/sandbox.py +++ b/tools/sandbox.py @@ -8,6 +8,7 @@ import argparse import re +from pathlib import Path from framework.artifacts import disks, kernels from framework.microvm import MicroVMFactory @@ -50,12 +51,19 @@ def parse_byte_size(param): default=128 * 2**20, # 128MB ) parser.add_argument("--rootfs-size", type=parse_byte_size, default=1 * 2**30) # 1GB +parser.add_argument("--binary-dir", help="Path to the firecracker binaries") args = parser.parse_args() print(args) +bins = None +if args.binary_dir: + binary_dir = Path(args.binary_dir).resolve() + bins = binary_dir / "firecracker", binary_dir / "jailer" +else: + bins = get_firecracker_binaries() print("This step may take a while to compile Firecracker ...") -vmfcty = MicroVMFactory("/srv", *get_firecracker_binaries()) +vmfcty = MicroVMFactory("/srv", *bins) uvm = vmfcty.build(args.kernel, args.rootfs) uvm.help.enable_console() uvm.help.resize_disk(uvm.rootfs_file, args.rootfs_size)