Skip to content

eBPF-based security platform

testing: define the memory summary before the exit path can call it

Daniel Borkmannf3ea6eb547cd
diff --git a/contrib/test-vm.sh b/contrib/test-vm.sh
index e1f37ebc..d0bfbc99 100755
--- a/contrib/test-vm.sh
+++ b/contrib/test-vm.sh
@@ -761,6 +761,20 @@ save_failure_logs()
fi
}
+print_memory_summary()
+{
+ local report
+
+ if [[ -s "$RUN_DIR/result/boot-memory" ]]; then
+ report="$(tr '\n' ' ' <"$RUN_DIR/result/boot-memory")"
+ summary_log "guest memory: ${report% }"
+ fi
+ if [[ -s "$HOST_MEMORY_REPORT" ]]; then
+ report="$(tr '\n' ' ' <"$HOST_MEMORY_REPORT")"
+ summary_log "host QEMU memory: ${report% }"
+ fi
+}
+
format_elapsed()
{
local elapsed="$1"
@@ -1636,20 +1650,6 @@ capture_host_memory_report()
HOST_MEMORY_REPORT="$report"
}
-print_memory_summary()
-{
- local report
-
- if [[ -s "$RUN_DIR/result/boot-memory" ]]; then
- report="$(tr '\n' ' ' <"$RUN_DIR/result/boot-memory")"
- summary_log "guest memory: ${report% }"
- fi
- if [[ -s "$HOST_MEMORY_REPORT" ]]; then
- report="$(tr '\n' ' ' <"$HOST_MEMORY_REPORT")"
- summary_log "host QEMU memory: ${report% }"
- fi
-}
-
if [[ "$VM_MODE" == interactive ]]; then
if user_systemd_available; then
QEMU_UNIT_FILE="$RUN_DIR/qemu.unit"