Skip to content

Commit

Permalink
TBD: logging for debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Babis Chalios <bchalios@amazon.es>
  • Loading branch information
bchalios committed Mar 12, 2024
1 parent 852d57b commit 9f43105
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/integration_tests/security/test_vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def configure_microvm(
else:
microvm = factory.build(kernel, rootfs)

microvm.help.enable_console()
microvm.spawn()
microvm.basic_config(vcpu_count=2, mem_size_mib=256, cpu_template=cpu_template)
if custom_cpu_template:
Expand Down Expand Up @@ -122,6 +123,18 @@ def with_restore(factory, microvm_factory):

def restore(firecracker=None, jailer=None):
microvm = factory(firecracker, jailer)
print("")
print("========= base VM's console ========")
print(microvm.console_data)
print("====================================")
print("========= base VM's logs ========")
print(microvm.log_data)
print("====================================")
print("========= base VM's dmesg ========")
rc, stdout, stderr = microvm.ssh.run("dmesg")
assert rc == 0, stderr
print(stdout)
print("==================================")
snapshot = microvm.snapshot_full()

if firecracker:
Expand All @@ -130,6 +143,8 @@ def restore(firecracker=None, jailer=None):
)
else:
dst_vm = microvm_factory.build()

dst_vm.help.enable_console()
dst_vm.spawn()
# Restore the destination VM from the snapshot
dst_vm.restore_from_snapshot(snapshot, resume=True)
Expand Down Expand Up @@ -435,6 +450,9 @@ def check_vulnerabilities_files_on_guest(microvm):
See also: https://elixir.bootlin.com/linux/latest/source/Documentation/ABI/testing/sysfs-devices-system-cpu
and search for `vulnerabilities`.
"""
print("========= resumed VM's logs ========")
print(microvm.log_data)
print("====================================")
# Retrieve a list of vulnerabilities files available inside guests.
vuln_dir = "/sys/devices/system/cpu/vulnerabilities"
ecode, stdout, stderr = microvm.ssh.run(f"find {vuln_dir} -type f")
Expand Down

0 comments on commit 9f43105

Please sign in to comment.