[LTP] [PATCH v4 1/1] swapon03: Try to swapon() as many files until it fails
Petr Vorel
pvorel@suse.cz
Fri Dec 19 15:41:02 CET 2025
> [ Removing Michal to not bother him with LTP internals ]
> > Hi!
> > > tst_res(TINFO, "Successfully created %d swap files", swapfiles);
> > > - MAKE_SMALL_SWAPFILE(TEST_FILE);
> > This should stay here, right? I suppose that the test works even when we
> > pass non-existing file in the verify_swapon() but we shouldn't bet on
> > that.
> FYI swap file is created by is_swap_supported(TEST_FILE). But sure, I can
> also keep MAKE_SMALL_SWAPFILE(TEST_FILE) to make sure file is also created.
> We talked about related cleanup, which I wanted to postpone, but should I
> refactor is_swap_supported() to not include swapon() call. Because when there
> are too many swap files already mounted, tests is skipped with:
> libswap.c:224: TCONF: Permission denied for swapon()
> due EPERM, which is actually subject of testing for swapon03.c
And, as I posted in v3 [1], we can avoid this work, if we require at least
single swap created by the test. Or, allow a corner case all swaps are used,
but just verify that by counting swap in /proc/swaps.
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/20251219142512.GC247368@pevik/
> I'm not sure about naming. Maybe have is_swap_supported() without swapon() call
> (for swapon03.c) and create new function is_swapon_supported(), which would call
> is_swap_supported() + swapon() and swapoff() (for all other tests).
> Kind regards,
> Petr
More information about the ltp
mailing list