Re: [PATCH 16/29] selftests/mm: UFFDIO_API test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 03, 2023 at 09:59:50AM +0200, David Hildenbrand wrote:
> There is ksft_print_msg, ksft_test_result, ksft_test_result_fail, ... do we
> maybe want to convert properly to ksft while already at it?

Yes, I started with trying to use that but found that there're not a lot of
things that I can leverage.

Starting with ksft_set_plan() - I think this is something we call first. I
want the current unit test to skip everything if UFFD API test failed here,
then I need to feed in a dynamic number of "plan" into ksft_set_plan().
But I never know after I ran the 1st test..

I can call ksft_set_plan() later than this, but it misses a few tests which
also looks weird.

It also seems to not really help anything at all and not obvious to use.
E.g. ksft_finished() will reference ksft_plan then it'll trigger
ksft_exit_fail() but here I want to make it SKIP if the 1st test failed
simply because the kernel probably doesn't have CONFIG_USERFAULTFD.

Another example: I never figured what does x{fail|pass|skip} meant in the
header..  e.g. ksft_inc_xfail_cnt() is used nowhere so I cannot reference
either.  Then I don't know when I should increase them.

In short, to make the unit test behave as expected, I figured I'll just
write these few helpers and that's good enough for this unit test.  That
takes perhaps 5 min anyway and isn't hugely bad for an unit test.

Then I keep the exit code matching kselftests (KSFT_SKIP, etc.).

What I can do here, though, is at least reuse the counters, e.g:

 ksft_inc_pass_cnt() / ksft_inc_fail_cnt()

There's no ksft_inc_skip_cnt() so, maybe, I can just reuse
ksft_inc_xskip_cnt() assuming that counts "skip"s?

Let me know if you have better ideas, I'll be happy to switch in that case.

Thanks,

-- 
Peter Xu





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux