From 1f4982c78eb41e2e9e4d3bd173b83d51785ea783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Thu, 7 Mar 2024 10:15:40 +0100 Subject: [PATCH] feat(devtool): teach sandbox how to run natively in AL2023 and Ubuntu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tools/devtool | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/devtool b/tools/devtool index bc289da11bd..82ca079bc52 100755 --- a/tools/devtool +++ b/tools/devtool @@ -413,8 +413,11 @@ cmd_help() { test_debug [-- []] 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 @@ -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 $@" }