[LTP] [PATCH 1/1] lib: Skip tst_{disable, enable}_oom_protection() for non-root
Li Wang
liwang@redhat.com
Wed Dec 22 12:25:34 CET 2021
Hi Cyril, Petr, Xu,
On Wed, Dec 22, 2021 at 6:39 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > We use just FILE_PRINTF(), but we check the result and TWARN, which
> causes the
> > failure in CI.
>
> Which is why I argued that we should add a version that does not print
> anything and just returns if the operation was successful or not. I
> guess it could be called TRY_FILE_PRINTF() or something.
>
or SILENT_FILE_PRINTF()?
>
> > I've sent v2, which checks CAP_SYS_ADMIN and CAP_SYS_RESOURCE,
> > but feel free just to bring simpler solution.
>
> I still think that the most acurate test would be just writing to the
> file and checking the result.
>
Yes, this method is simpler.
But checking the CAP_SYS_RESOURCE cap can show the
original problem more clearly, people read code easily to know
why here we do that cap check.
(e.g. like me cost much time debugging but not know the root cause)
So I think both of your solutions are great. Can we add the
silent file_printf into lib? I think it is useful to LTP as well.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20211222/338965da/attachment.htm>
More information about the ltp
mailing list