From 8bc31ce732af2c8a57b99b94c72cdba37dbd760c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Fri, 19 Jan 2024 10:26:29 +0100 Subject: [PATCH] test: integ test for FC-DEV-1903 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Barbáchano Signed-off-by: Roman Kovtyukh --- tests/integration_tests/test_FC-DEV-1903.py | 49 +++++++++++++++++++++ tools/devtool | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/integration_tests/test_FC-DEV-1903.py diff --git a/tests/integration_tests/test_FC-DEV-1903.py b/tests/integration_tests/test_FC-DEV-1903.py new file mode 100644 index 00000000000..7857bba2ddd --- /dev/null +++ b/tests/integration_tests/test_FC-DEV-1903.py @@ -0,0 +1,49 @@ +import subprocess +import time +from pathlib import Path + + +def test_FC_DEV_1903(uvm_plain, microvm_factory): + """ + https://sim.amazon.com/issues/FC-DEV-1903 + + Make the test pass + + ./tools/devtool test_debug integration_tests/test_FC-DEV-1903.py + + file:../../src/vmm/src/persist.rs::.dump_dirty(&mut file, &dirty_bitmap) + Around here we would have to handle an error: + file:../../src/vmm/src/vstate/memory.rs:285 + """ + vm_mem_size = 128 + uvm = uvm_plain + uvm.spawn() + uvm.basic_config(mem_size_mib=vm_mem_size, track_dirty_pages=True) + uvm.add_net_iface() + uvm.start() + uvm.ssh.run("true") + + chroot = Path(uvm.chroot()) + + # Create a large file, so we run out of space (ENOSPC) during the snapshot + # Assumes a Docker /srv tmpfs of 1G, derived by trial and error + fudge = chroot / "fudge" + subprocess.check_call(f"fallocate -l 550M {fudge}", shell=True) + + try: + uvm.snapshot_diff() + except RuntimeError: + msg = "No space left on device" + uvm.check_log_message(msg) + else: + assert False, "This should fail" + + fudge.unlink() + + # Now there is enough space for it to work + snap2 = uvm.snapshot_diff() + + vm2 = microvm_factory.build() + vm2.spawn() + vm2.restore_from_snapshot(snap2, resume=True) + vm2.ssh.run("true") diff --git a/tools/devtool b/tools/devtool index 07bde385ec4..379135015d8 100755 --- a/tools/devtool +++ b/tools/devtool @@ -309,7 +309,7 @@ run_devctr() { --rm \ --volume /dev:/dev \ --volume "$FC_ROOT_DIR:$CTR_FC_ROOT_DIR:z" \ - --tmpfs /srv:exec,dev,size=32G \ + --tmpfs /srv:exec,dev,size=1G \ -v /boot:/boot \ --env PYTHONDONTWRITEBYTECODE=1 \ "$DEVCTR_IMAGE" "${ctr_args[@]}"