mem/oom: check for multiple outcomes if overcommit_memory is 0 or 1
There is no guarantee that mmap() will fail before OOM tries to kill the
process if overcommit is set to 0 or 1. So allow such tests to
PASS if child is killed with SIGKILL.
This patch adds 2 parameters to oom()/testoom() functions:
retcode - expected child return code
allow_sigkill - flag which specifies if child killed by SIGKILL
is also PASS result
Child process will return 0 if all allocations succeeded,
otherwise it returns last errno.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index 3f17400..7a726c8 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -65,13 +65,13 @@
tst_count = 0;
tst_resm(TINFO, "OOM on MPOL_BIND mempolicy...");
- testoom(MPOL_BIND, 0);
+ testoom(MPOL_BIND, 0, ENOMEM, 1);
tst_resm(TINFO, "OOM on MPOL_INTERLEAVE mempolicy...");
- testoom(MPOL_INTERLEAVE, 0);
+ testoom(MPOL_INTERLEAVE, 0, ENOMEM, 1);
tst_resm(TINFO, "OOM on MPOL_PREFERRED mempolicy...");
- testoom(MPOL_PREFERRED, 0);
+ testoom(MPOL_PREFERRED, 0, ENOMEM, 1);
}
cleanup();
tst_exit();