From 561791ed224629df3c1c984431f607bdee054551 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Mon, 25 Jul 2022 11:28:29 +0200 Subject: [PATCH] tests: Reliably trigger a guest OOM Rely on /proc/sysrq-trigger to forcibly trigger an OOM in the guest. Signed-off-by: Sebastien Boeuf --- tests/integration.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index 7b04cc234..7dc219948 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -5062,11 +5062,9 @@ mod parallel { assert!(orig_balloon == 2147483648); // Two steps to verify if the 'deflate_on_oom' parameter works. - // 1st: run a command in guest to eat up memory heavily, which - // will consume much more memory than $(total_mem - balloon_size) - // to trigger an oom. + // 1st: run a command to trigger an OOM in the guest. guest - .ssh_command("stress --vm 25 --vm-keep --vm-bytes 1G --timeout 20") + .ssh_command("echo f | sudo tee /proc/sysrq-trigger") .unwrap(); // Give some time for the OOM to happen in the guest and be reported