[LTP] [PATCH v2 5/5] swapon03: Remove grep dependency

Petr Vorel pvorel@suse.cz
Tue Nov 18 13:41:51 CET 2025


> Hi!
> > Do you mean to use full swap file path from /proc/mounts, i.e.
> > /tmp/LTP_swaNzeMJr/mntpoint/testswap, /tmp/LTP_swamEVVAc/mntpoint/testswap03,
> > ... (example from run which created /tmp/LTP_swamEVVAc with all swap files,
> > cleanup interrupted by ctrl+C and following one which created /tmp/LTP_swaNzeMJr
> > single swap file only):

> If we make the swapfile names unique enough we can match just that
> instead. I think one of the patches did just that by including the test
> name in the swap filenames. If we want to be extra sure we can take last
> directory component of the test temporary directory as well.

FYI the problem I wanted to address here was during repeatedly running this test
(swapon03.c) during debugging. Therefore $TMPDIR directory component would help
or $PID would help in this case (but sure the test name itself would help in
possible clash of 2 different tests). I'll probably implement it by $TMPDIR
subset unless you see any usefulness of normalizing $TMPDIR.

But I'll postpone it, in v3 I'll just remove fork and "Try to swapon() as many
files until it fails" to get the original problem merged first.

> What I'm
> trying to point out is that the $TMPDIR part of the test temporary
> directory is not adding anything unique to the path since that is prefix
> that is used by all LTP tests.

Understand. FYI I added the full path to the file to avoid the need to create
full path from subset of the path. I'll probably go this way, although I still
think more tests expect normalized path to TMPDIR, but we don't normalize it
nor even check for it (it'd be interesting to see how many tests in
runtest/syscalls will fail with TMPDIR=/run/../tmp or TMPDIR=/tmp///).

Kind regards,
Petr


More information about the ltp mailing list