On Fri, Oct 14, 2022 at 11:03:39AM -0400, Felix Kuehling wrote:
Am 2022-10-14 um 08:01 schrieb Jason Gunthorpe:
On Thu, Oct 13, 2022 at 06:54:24PM +0200, Vlastimil Babka wrote:
Hi,
I've been trying the hmm_tests as of today's commit:
a185a0995518 ("Merge tag 'linux-kselftest-kunit-6.1-rc1-2' ...)
and run into several issues that seemed worth reporting.
First, it seems the FIXTURE_TEARDOWN(hmm) in tools/testing/selftests/vm/hmm-tests.c using ASSERT_EQ(ret, 0); can run into an infinite loop of reporting the assertion failure. Dunno if it's a kselftests issue or it's a bug to use asserts in teardown. I hacked it up like this locally to proceed:
I've seen this too in other tests, it is a kselftests bug/limitation, AFAIK. You can't use assert macros in those functions.
I vaguely remember looking at this when I reviewed Alex's patches that added device-coherent support. We wanted to have these checks in the fixture setup so that we wouldn't have to duplicate them in all the tests.
I'm not sure if I missed it in review, and Alex missed it in testing, or if this is a regression that happened more recently. Sorry for the trouble. It looks like Alistair already figured out a fix.
I think the design is fine, it is just surprising you can't call ASSERT/etc in the fixture codes. Hopefully something like Alistair's fix gets merged.
Jason