diff --git a/tests/conftest.py b/tests/conftest.py index 552ba25c4ef..e3aea3a8dfa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -336,11 +336,12 @@ def microvm_factory(request, record_property, results_dir, netns_factory): # if the test failed, save important files from the root of the uVM into `test_results` for troubleshooting report = request.node.stash[PHASE_REPORT_KEY] if "call" in report and report["call"].failed: - dmesg = utils.run_cmd(["dmesg", "-dPx"]) for uvm in uvm_factory.vms: uvm_data = results_dir / uvm.id uvm_data.mkdir() - uvm_data.joinpath("host-dmesg.log").write_text(dmesg.stdout) + uvm_data.joinpath("host-dmesg.log").write_text( + utils.run_cmd(["dmesg", "-dPx"]).stdout + ) shutil.copy(f"/firecracker/build/img/{platform.machine()}/id_rsa", uvm_data) uvm_root = Path(uvm.chroot()) diff --git a/tests/host_tools/memory.py b/tests/host_tools/memory.py index 690cda38701..93380a9321d 100644 --- a/tests/host_tools/memory.py +++ b/tests/host_tools/memory.py @@ -62,7 +62,7 @@ def run(self): guest_mem_bytes = self._vm.mem_size_bytes try: ps = psutil.Process(self._vm.firecracker_pid) - except psutil.NoSuchProcess: + except (psutil.NoSuchProcess, FileNotFoundError): return while not self._should_stop: try: diff --git a/tools/devtool b/tools/devtool index 1e53cc6c6bb..7bf8d4ad6fb 100755 --- a/tools/devtool +++ b/tools/devtool @@ -228,7 +228,7 @@ cmd_fix_perms() { run_devctr \ --workdir "$CTR_FC_ROOT_DIR" \ -- \ - chown -f -R "$(id -u):$(id -g)" "$CTR_FC_BUILD_DIR" "$CTR_TEST_RESULTS_DIR" "$CTR_CI_ARTIFACTS_PATH" + chown -f -R "$(id -u):$(id -g)" "$CTR_FC_BUILD_DIR" "$CTR_TEST_RESULTS_DIR" "$CTR_CI_ARTIFACTS_PATH" $@ } # Builds the development container from its Dockerfile. @@ -890,6 +890,7 @@ cmd_sandbox() { cmd_build --release ensure_ci_artifacts cmd_sh "tmux new env PYTEST_ADDOPTS=--pdbcls=IPython.terminal.debugger:TerminalPdb PYTHONPATH=tests IPYTHONDIR=\$PWD/.ipython ipython -i ./tools/sandbox.py $@" + cmd_fix_perms ".ipython" } cmd_sandbox_native() {