[LTP] [PATCH v4 1/1] swapon03: Try to swapon() as many files until it fails

Petr Vorel pvorel@suse.cz
Fri Dec 19 15:02:16 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

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