Thread (13 messages) 13 messages, 2 authors, 2026-02-25

Re: [PATCH 1/2] selftests/harness: fix XFAIL_ADD matching when test metadata is not initialized

From: sun jian <hidden>
Date: 2026-02-24 08:05:34
Also in: linux-kselftest, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help