Skip to content

Commit

Permalink
feat(devtool): teach sandbox how to run natively in AL2023 and Ubuntu
Browse files Browse the repository at this point in the history
The current `devtool sandbox` command uses our devctr .

It is desirable to be able to run in the host OS directly when running
performance tests or when troubleshooting.

Add a command to run Firecracker natively, by installing the necessary
Python packages.

Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o authored and zulinx86 committed May 9, 2024
1 parent 5d624bc commit 1f4982c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,11 @@ cmd_help() {
test_debug [-- [<pytest args>]]
Run tests in a debugging environment
test_sandbox
Run Firecracker in an IPython REPL
sandbox
Run Firecracker in an IPython REPL (in devctr)
sandbox_native
Run Firecracker in an IPython REPL (AL2023/Ubuntu)
mkdocs
Use 'cargo doc' to generate rustdoc documentation
Expand Down Expand Up @@ -851,6 +854,26 @@ cmd_sandbox() {
cmd_sh "tmux new env PYTEST_ADDOPTS=--pdbcls=IPython.terminal.debugger:TerminalPdb PYTHONPATH=tests IPYTHONDIR=\$PWD/.ipython ipython -i ./tools/sandbox.py $@"
}

cmd_sandbox_native() {
cmd_build --release

source /etc/os-release
case $ID-$VERSION_ID in
ubuntu-22.04)
sudo apt install python3-pip python3.11-dev gcc tmux
;;
al2023)
sudo yum -y install python3.11-pip python3.11-devel gcc tmux
;;
esac
python3.11 -m venv sandbox
source sandbox/bin/activate
pip3.11 install ipython requests requests_unixsocket "urllib3<2" psutil tenacity filelock
pip3.11 install packaging pytest
ensure_ci_artifacts
tmux neww sudo --preserve-env=HOME,PATH,TMUX env PYTHONPATH=tests IPYTHONDIR=\$PWD/.ipython ipython -i ./tools/sandbox.py $@
}

cmd_test_debug() {
cmd_sh "tmux new ./tools/test.sh --pdb $@"
}
Expand Down

0 comments on commit 1f4982c

Please sign in to comment.