Re: [PATCH 1/2] selftests/harness: fix XFAIL_ADD matching when test metadata is not initialized
From: sun jian
Date: Tue Feb 24 2026 - 03:06:36 EST
On Tue, 24 Feb 2026 10:43:15 +0800 Jakub Kicinski wrote:
> I thought constructor priorities were specifically created to avoid the
> problem you are seeing. What it is the point of constructor priorities
> if not to order constructors??
Hi Jakub,
You're right. Looking closer at the harness ctor ordering, the NULL comes
from TEST_F() setting _##fixture##_##test##_object inside its constructor
(after the mmap() allocation), while XFAIL_ADD() reads that pointer in its
constructor. If XFAIL_ADD runs first, xfail->test can be NULL.
Using constructor priorities should fix this cleanly by ordering the TEST_F
registration ctor before XFAIL_ADD, without adding new fields or runtime
lookups.
I'll respin a v2 along those lines and drop the fallback approach.
Thanks,
sun jian