[LTP] [PATCH] getrusage03: skip on small RAM system
Cyril Hrubis
chrubis@suse.cz
Mon Feb 7 14:19:42 CET 2022
Hi!
> ---
>
> Notes:
> Ps. I also think we might need .min_mem_[avai|total] field but
> not sure if it is really necessary to add that.
Actually this would be very useful from the long term perspective. If we
ever manage to run tests in parallel the scheduller should make sure
that we do not hit OOM due to running more than one processe that
consume significant amount of memory at the same time.
> diff --git a/testcases/kernel/syscalls/getrusage/getrusage03.c b/testcases/kernel/syscalls/getrusage/getrusage03.c
> index bf5127483..5aa0b2326 100644
> --- a/testcases/kernel/syscalls/getrusage/getrusage03.c
> +++ b/testcases/kernel/syscalls/getrusage/getrusage03.c
> @@ -173,6 +173,14 @@ static void run(unsigned int i)
> }
> }
>
> +static void setup(void)
> +{
> + long long mem_avail = tst_available_mem();
> +
> + if (mem_avail < 512L*1024)
> + tst_brk(TCONF, "Needed > 512MB availabe, only have: %ld kB", mem_avail);
> +}
> +
> static struct tst_test test = {
> .forks_child = 1,
> .child_needs_reinit = 1,
> @@ -182,6 +190,7 @@ static struct tst_test test = {
> {"linux-git", "1f10206cf8e9"},
> {}
> },
> + .setup = setup,
> .test = run,
> .tcnt = ARRAY_SIZE(testfunc_list),
> };
Looks good:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list