[LTP] tse_swap: Add fallback definitions for swapon
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Fri Aug 28 13:30:24 CEST 2026
Hi Andrea,
On August 28, 2026, Andrea Cervesato wrote:
> tse_swap: Add fallback definitions for swapon
--- [PATCH 2/3] ---
> + if (tst_syscall(__NR_swapoff, loop_dev) != 0)
> + tst_brk(TBROK | TTERRNO, "swapoff(%s) failed", loop_dev);
> [...]
> + if (swap_active && tst_syscall(__NR_swapoff, loop_dev) != 0)
> + tst_res(TWARN | TTERRNO, "swapoff(%s) failed", loop_dev);
Could these reports use TERRNO instead? These calls bypass TEST(), so
TTERRNO reads the TST_ERR left by the earlier successful swapon() call.
That value is normally zero, causing a real swapoff() failure to be
reported as "Success".
> +/*\
> + * Check that :manpage:`swapon(2)` discard flags control swapon-time area discard:
> [...]
> + .needs_root = 1,
Could the description state why root is required? Root-only tests are
expected to document the reason; here swapon(), swapoff(), and loop-device
setup require it.
--- [PATCH 3/3] ---
> + if (TST_RET == 0 && tst_syscall(__NR_swapoff, tc->path) != 0)
> + tst_res(TWARN | TTERRNO, "swapoff(%s) failed", tc->path);
Could this use TERRNO as well? On this recovery path the preceding
TST_EXP_FAIL() captured a successful swapon(), leaving TST_ERR equal to
zero, so TTERRNO cannot report the swapoff() failure's errno.
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