Re: [PATCHv2] selftests: Use kselftest skip code for skipped tests
From: Petr Machata
Date: Wed May 26 2021 - 04:54:07 EST
Po-Hsu Lin <po-hsu.lin@xxxxxxxxxxxxx> writes:
> 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.
>
> V2: router_mpath_nh.sh and outer_mpath_nh_res.sh sources lib.sh,
> there is no need to assign ksft_skip value in these two.
>
> Signed-off-by: Po-Hsu Lin <po-hsu.lin@xxxxxxxxxxxxx>
I want to note that defining ksft_skip=4 in every test separately is the
current practice. I agree with Willem (in a parallel thread) that this
stuff should live in a library of its own, but there is none currently.
When there is, it looks like the conversion would be mechanical.
Which is to say, IMHO this patch makes sense on its own as an
incremental improvement.
Reviewed-by: Petr Machata <petrm@xxxxxxxxxx>