[LTP] [RFC PATCH 2/2] testcaes/lib: Add shell loader
Petr Vorel
pvorel@suse.cz
Thu Jul 25 23:44:19 CEST 2024
> On 25. 07. 24 13:02, Petr Vorel wrote:
> > Hi Martin, Cyril,
> > > > +mounted=$(grep $TST_MNTPOINT /proc/mounts)
> > > This check might produce false positive for example when another LTP shell
> > > script runs in parallel in another temp directory. I'd recommend using
> > > $(realpath ...) to disambiguate the mountpoints.
> > FYI this is just a test, not a library script.
> > Also maybe just prepend it with $PWD/ would be enough:
> > mounted=$(grep $PWD/$TST_MNTPOINT /proc/mounts)
> > (Not to require yet another binary. It's ok to have it here, because developers
> > have coreutils, but in case it's in the tst_test.sh or its dependencies some
> > minimal systems might have problem - busybox based embedded systems realpath is
> > configurable via CONFIG_REALPATH=y. It would help if we specify shell library
> > dependencies).
> The test could still get confused by leftover mounts from other tests or
> failed runs of itself. That'll be annoying to deal with when you try to
> modify something in the shell loader.
Fair point.
> I've checked what happens if you mount a filesystem on a mountpoint path
> that contains symlinks and in that case, /proc/mounts will report the real
> path. So $(realpath $TST_MNTPOINT) is what you need to search for. Grep
> might get confused by special characters in the path, though. Another
> problem is that /proc/mounts converts spaces to octal codes to prevent
> column parsing issues.
OK, I would hope users would not use symlinks, but OTOH I'm ok with using
realpath for tests, thus no reason to block using symlinks (which we would do
with my suggestion to use $PWD instead of realpath).
But I would not waste our time with effort to fix special characters:
1) Build system does not work with some of them anyway (Cyril reported at least
" due out-of-tree complexity of our build system).
2) Old doc somewhere warned that project would ignore broken compilation due
special characters.
3) I don't expect many people will be forced to have LTP on directory with
strange characters.
Kind regards,
Petr
More information about the ltp
mailing list