Re: [PATCH v4 09/14] selftests: harness: Move teardown conditional into test metadata

From: Jason Gunthorpe
Date: Tue Jun 10 2025 - 08:09:27 EST


On Tue, Jun 10, 2025 at 01:38:22PM +0200, Thomas Weißschuh wrote:
> Hi Nicolin,
>
> On Mon, Jun 09, 2025 at 11:49:05PM -0700, Nicolin Chen wrote:
> > CC += Jason
> >
> > On Mon, May 05, 2025 at 05:15:27PM +0200, Thomas Weißschuh wrote:
> > > To get rid of setjmp()/longjmp(), the teardown logic needs to be usable
> > > from __bail(). To access the atomic teardown conditional from there,
> > > move it into the test metadata.
> > > This also allows the removal of "setup_completed".
> > >
> > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> > > Acked-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
> >
> > Certain hugepage tests in iommufd selftest (CONFIG_IOMMUFD_TEST)
> > start to fail since v6.16-rc1, though the test functions weren't
> > changed during last cycle:
>
> Thanks for the report.
>
> > ------------------------------------------------------------------
> > # RUN iommufd_dirty_tracking.domain_dirty128M_huge.enforce_dirty ...
> > # enforce_dirty: Test terminated unexpectedly by signal 11

Sig 11 is weird..

> I can't reproduce this report.
> On my development machine or a virtme-ng VM I get the following failure:
>
> # ./iommufd -r iommufd_dirty_tracking.domain_dirty128M_huge.enforce_dirty
> TAP version 13
> 1..1
> # Starting 1 tests from 1 test cases.
> # RUN iommufd_dirty_tracking.domain_dirty128M_huge.enforce_dirty ...
> iommufd: iommufd.c:2042: iommufd_dirty_tracking_setup: Assertion `vrc == self->buffer' failed.
> # enforce_dirty: Test terminated by assertion
> # FAIL iommufd_dirty_tracking.domain_dirty128M_huge.enforce_dirty
> not ok 1 iommufd_dirty_tracking.domain_dirty128M_huge.enforce_dirty
> # FAILED: 0 / 1 tests passed.
> # Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
>
> Specifically the mmap() fails with ENOMEM.
>
> When booting the VM with "hugepages=100" the test succeeds.

Yes, that is required

> On another note, the selftest should use the kselftest_harness' ASSERT_*()
> macros instead of plain assert().

IIRC the kselftest stuff explodes if you try to use it's assert
functions within a fixture setup/teardown context.

I also wasn't able to reproduce this (x86 ubuntu 24 LTS OS) Maybe
it is ARM specific, I think Nicolin is running on ARM..

I did see the other warnings that Nicolin reported.

Jason