Re: [PATCH v2 16/31] selftests/mm: UFFDIO_API test
From: Peter Xu
Date: Wed Apr 12 2023 - 16:09:31 EST
On Wed, Apr 12, 2023 at 12:47:39PM -0700, Axel Rasmussen wrote:
> > +#define uffd_test_fail(...) do { \
> > + printf("failed [reason: "); \
> > + printf(__VA_ARGS__); \
> > + printf("]\n"); \
> > + ksft_inc_fail_cnt(); \
> > + } while (0)
> > +
> > +#define uffd_test_skip(...) do { \
> > + printf("skipped [reason: "); \
> > + printf(__VA_ARGS__); \
> > + printf("]\n"); \
> > + ksft_inc_xskip_cnt(); \
> > + } while (0)
>
> Some of this is duplicating what's in kselftest_harness.h - e.g.
> assertions, printing test summary, keeping track of pass/fail/skip
> counts, etc.
>
> I wonder how you feel about using the standard harness? E.g. is the
> plan to do this (more straightforward?) refactor first, and then
> switch later? Or is there some reason it can't be used?
David asked similar question. I wanted to arrange the output mostly for:
(1) one test per line, (2) dump test name before anything (even failing).
The 2nd one is important for uffd tests since it uses err() which bails out
immediately on unexpected failures (comparing to uffd_test_fail).
To achieve that I found I can use ksft_inc_xskip_cnt() etc. so I kept using
the counters in the harness but leave the print format on my own. I assume
that's also why these were exported in kselftests.h so when tests want to
have customized output it can still use the counters.
Thanks,
--
Peter Xu