[LTP] cgroup_core02: modernize test using LTP cgroup API

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Thu Oct 1 16:18:08 CEST 2026


Hi Sushmitha,

On Thu, 1 Oct 2026 16:39:53 +0530, Sushmitha wrote:
> cgroup_core02: modernize test using LTP cgroup API

> diff --git a/cgroup_core02.c b/cgroup_core02.c
> new file mode 100644
> --- /dev/null
> +++ b/cgroup_core02.c

This adds an unbuilt root-level copy; normal builds and the existing
runtest entries still use the unchanged original test. Apply the changes
to testcases/kernel/controllers/cgroup/cgroup_core02.c instead and remove
the root-level copy.

> +		if (pid < 0)
> +			tst_brk(TBROK, "clone failed");

In a forked child, tst_brk(TBROK) kills the main test process with SIGKILL,
skipping cleanup(). If clone fails with EAGAIN, child_a and child_b remain,
and tst_cg_cleanup() cannot remove their parent because it does not remove
these descendants. Propagate the error to the main process and report
TBROK there so cleanup() runs.

> +			TST_EXP_FAIL(write(targ.fds[i], "0", 1), ENOENT,
> +				     "write to cgroup.procs from different namespace");

Use TST_EXP_FAIL2() here: write() returns a byte count on success, not zero.
TST_EXP_FAIL() diagnoses a successful one-byte write as "invalid retval 1"
instead of an unexpectedly successful migration.

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list