On Tue, Mar 31, 2026, Ackerley Tng wrote:
> Ackerley Tng <[email protected]> writes:
Please trim your replies (even more, since you did trim a little).
> > +static void run_guest_do_rmw(struct kvm_vcpu *vcpu, loff_t pgoff,
> > + char expected_val, char write_val)
> > +{
> > + struct ucall uc;
> > + int r;
> > +
> > + guest_data.mem = (void *)GUEST_MEMFD_SHARING_TEST_GVA + pgoff *
> > page_size;
> > + guest_data.expected_val = expected_val;
> > + guest_data.write_val = write_val;
> > + sync_global_to_guest(vcpu->vm, guest_data);
> > +
> > + do {
> > + r = __vcpu_run(vcpu);
> > + } while (r == -1 && errno == EINTR);
> > +
> > + TEST_ASSERT_EQ(r, 0);
>
> TEST_ASSERT_EQ() ends up calling exit() on failures, which skips
> FIXTURE_TEARDOWN().
>
> Other than the explicit assertions not working with the
> kselftest_harness, kvm selftest library functions like vm_mem_add() also
> call TEST_ASSERT, which doesn't play nice with kselftest_harness.
>
> Any suggestions for this? Should we use the kselftest framework with
> these tests?
>
> (I ran into this issue while trying to test something else, where I
> needed FIXTURE_TEARDOWN() to clean up system state.)
>
> Or is it "okay" in this case since FIXTURE_TEARDOWN() only cleans up
> stuff that would happen if the program exits anyway?
Can you see if any of the ideas in
https://lore.kernel.org/all/[email protected]
would help? Converting more tests to TAP+FIXTURE is still on my wish list, I've
just never been able to carve out cycles to see it through.