Skip to content

Commit

Permalink
test: integ test for FC-DEV-1903
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Barbáchano <pablob@amazon.com>
Signed-off-by: Roman Kovtyukh <HelloDearGrandma@gmail.com>
  • Loading branch information
pb8o authored and Grandmother committed Jan 19, 2024
1 parent 2043ebf commit 41ac44d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions tests/integration_tests/test_FC-DEV-1903.py
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down

0 comments on commit 41ac44d

Please sign in to comment.