Skip to content

Commit

Permalink
test: sandbox: add option to use custom firecracker binary
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o committed Oct 9, 2023
1 parent 747baf8 commit 800fdb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion tools/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import argparse
import re
from pathlib import Path

from framework.artifacts import disks, kernels
from framework.microvm import MicroVMFactory
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 800fdb3

Please sign in to comment.