[LTP] [PATCH 1/3] swapping01: skip test if zram-swap is being used
xuyang2018.jy@fujitsu.com
xuyang2018.jy@fujitsu.com
Fri Dec 10 03:57:38 CET 2021
Hi Cyril, Petr
> Hi Xu, Cyril,
>
>> Hi!
>>> ---
>>> testcases/kernel/mem/swapping/swapping01.c | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>
>>> diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c
>>> index 392b79d65..29c1e0443 100644
>>> --- a/testcases/kernel/mem/swapping/swapping01.c
>>> +++ b/testcases/kernel/mem/swapping/swapping01.c
>>> @@ -67,6 +67,11 @@ static void test_swapping(void)
>>> #ifdef TST_ABI32
>>> tst_brk(TCONF, "test is not designed for 32-bit system.");
>>> #endif
>>> + int ret;
>>> +
>>> + ret = tst_system("zramctl | grep SWAP");
>>> + if (!ret)
>>> + tst_brk(TCONF, "zram-swap is being used!");
>
>> Actually what the zramctl does is to open the /proc/swaps file and looks
>> for the /dev/zram* in there. I guess that we can as well read the the
>> file ourselves...
>
> +1
> Because requiring zramctl disables this test for all systems without it.
Although I seen zramctl source code before, I did't realize that get
info from /proc/swap. Will do it on v2.
Best Regards
Yang Xu
>
>
> Kind regards,
> Petr
>
>>> init_meminfo();
>
>>> @@ -155,4 +160,8 @@ static struct tst_test test = {
>>> .needs_root = 1,
>>> .forks_child = 1,
>>> .test_all = test_swapping,
>>> + .needs_cmds = (const char *[]) {
>>> + "zramctl",
>>> + NULL
>>> + }
>>> };
More information about the ltp
mailing list