Re: [PATCH] selftests: Use kselftest skip code for skipped tests

From: Willem de Bruijn
Date: Tue May 25 2021 - 10:04:12 EST


On Tue, May 25, 2021 at 2:17 AM Po-Hsu Lin <po-hsu.lin@xxxxxxxxxxxxx> wrote:
>
> There are several test cases still using exit 0 when they need to be
> skipped. Use kselftest framework skip code instead so it can help us
> to distinguish the proper return status.
>
> Criterion to filter out what should be fixed in selftests directory:
> grep -r "exit 0" -B1 | grep -i skip
>
> This change might cause some false-positives if people are running
> these test scripts directly and only checking their return codes,
> which will change from 0 to 4. However I think the impact should be
> small as most of our scripts here are already using this skip code.
> And there will be no such issue if running them with the kselftest
> framework.
>
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@xxxxxxxxxxxxx>

Perhaps it's a good time to mention this patch to add a kselftest
helper library for shell tests again:

[PATCH] tools/testing: add kselftest shell helper library
https://lore.kernel.org/linux-kselftest/20201123162508.585279-1-willemdebruijn.kernel@xxxxxxxxx/

That can avoid redefining this constant in every file.