Skip to content

Commit 4e349ef

Browse files
committed
tests: capture host dmesg on test failure
In some situations it would be useful to have the dmesg output to troubleshoot. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 45a1a1b commit 4e349ef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ def microvm_factory(request, record_property, results_dir):
284284
# if the test failed, save important files from the root of the uVM into `test_results` for troubleshooting
285285
report = request.node.stash[PHASE_REPORT_KEY]
286286
if "call" in report and report["call"].failed:
287+
dmesg = utils.run_cmd(["dmesg", "-dPx"])
287288
for uvm in uvm_factory.vms:
288289
uvm_data = results_dir / uvm.id
289290
uvm_data.mkdir()
291+
uvm_data.joinpath("host-dmesg.log").write_text(dmesg.stdout)
290292

291293
uvm_root = Path(uvm.chroot())
292294
for item in os.listdir(uvm_root):

0 commit comments

Comments
 (0)