Re: [PATCH] selftests/cgroup: set the test plan after the setup checks
From: Sarthak Sharma
Date: Wed Aug 19 2026 - 08:10:47 EST
On 8/19/26 2:06 PM, Hemanth Selam wrote:
> The cgroup tests announce their plan before checking whether cgroup v2 is
> available, so on a host without it they promise a number of results and
> then skip out after the first one:
>
> TAP version 13
> 1..3
> ok 1 # SKIP cgroup v2 isn't mounted
> # Planned tests != run tests (3 != 1)
> # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
>
> ksft_exit_skip() can only emit a well formed "1..0 # SKIP" line while no
> plan has been printed, as the comment above it in kselftest.h points out.
>
> Move ksft_set_plan() below the setup checks that can skip, so that a
> skipped run reports:
>
> TAP version 13
> 1..0 # SKIP cgroup v2 isn't mounted
>
> Several of the tests skip more than once while setting up, for a missing
> or unwritable controller as well, so the plan goes after the last of
> them. test_core joins its two setup paths at the post_v2_setup label and
> sets the plan there.
>
> Reporting each planned test as skipped instead would keep the plan where
> it is, but the setup failures here mean the whole test cannot run rather
> than its individual cases being skipped, which is what "1..0 # SKIP" is
> for.
>
> Fixes: 1dc830ee4c15 ("selftests/cgroup: conform test to KTAP format output")
> Signed-off-by: Hemanth Selam <hemanth.selam@xxxxxxxxx>
> ---
LGTM, so:
Reviewed-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>