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

From: Jakub Kicinski

Date: Mon Feb 23 2026 - 20:23:12 EST


On Sun, 22 Feb 2026 19:18:46 +0800 Sun Jian wrote:
> XFAIL_ADD() registers expected failures using constructor order, but the
> associated struct __test_metadata pointer may not be initialized yet.
> As a result, xfail entries can end up with a NULL test pointer and never
> match at runtime, causing expected failures to be reported as FAIL.
>
> Store the test case name in the xfail entry and fall back to name-based
> matching when the test pointer is unavailable, while keeping the original
> pointer-based matching for compatibility.

This looks a bit inelegant, what compiler is this failing on for you?

Constructors seem to have a concept of priority so if we have to,
we should probably used those for the fix.
--
pw-bot: cr