[LTP] [PATCH 08/10] readahead02: Add max_runtime

Cyril Hrubis chrubis@suse.cz
Wed Aug 31 13:29:11 CEST 2022


Hi!
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  testcases/kernel/syscalls/readahead/readahead02.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
> index 4fa8cfaf8..dc96eaef4 100644
> --- a/testcases/kernel/syscalls/readahead/readahead02.c
> +++ b/testcases/kernel/syscalls/readahead/readahead02.c
> @@ -406,6 +406,7 @@ static struct tst_test test = {
>  	},
>  	.test = test_readahead,
>  	.tcnt = ARRAY_SIZE(tcases),
> +	.max_runtime = 30,
>  	.tags = (const struct tst_tag[]) {
>  		{"linux-git", "b833a3660394"},
>  		{"linux-git", "5b910bd615ba"},

There are actually couple of things to consider here. First of all the
testfile_size defaults to 64MB but it can be changed by a command line
parameter, so we can easily overrun the 30 seconds by asking for large
enough file. The best solution would be to add runtime 30 seconds as
this patch does but if user passes -s parameter adjust the runtime in
the test setup as well. Something as (30 * size / 64_MB) should be
better than nothing.

However as we run the test with a loop device it will fail with ENOSPC
if we pass -s bigger than the loop device, we should at least check if
the device is large enough in the test setup too.

Also as we run the test inside a loop device I guess that we can also
sync and drop caches just for the device, which should be faster than
syncing and dropping the whole system. Possibly we just need to umount
it and mount it again.

And lastly we should as well use tst_parse_filesize() so that we can
pass -s 128M but that is very minor.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list