From: Sun Jian <sun.jian.kdev@gmail.com>
To: shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, kees@kernel.org,
thomas@t-8ch.de, linux-kernel@vger.kernel.org,
Sun Jian <sun.jian.kdev@gmail.com>
Subject: [PATCH] selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering
Date: Mon, 9 Mar 2026 17:37:52 +0800 [thread overview]
Message-ID: <20260309093752.808533-1-sun.jian.kdev@gmail.com> (raw)
Add a fixture-based test with a single variant and mark it with
XFAIL_ADD(). The test intentionally fails and is expected to be
accounted as XFAIL, covering the constructor ordering dependency
between TEST_F() registration and XFAIL_ADD() registration.
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
---
.../kselftest_harness/harness-selftest.c | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tools/testing/selftests/kselftest_harness/harness-selftest.c b/tools/testing/selftests/kselftest_harness/harness-selftest.c
index 7820bb5d0e6d..9920ef7e4385 100644
--- a/tools/testing/selftests/kselftest_harness/harness-selftest.c
+++ b/tools/testing/selftests/kselftest_harness/harness-selftest.c
@@ -118,6 +118,29 @@ TEST_F(fixture_setup_failure, pass) {
TH_LOG("after");
}
+FIXTURE(xfail_ctor_ordering) {
+};
+
+FIXTURE_SETUP(xfail_ctor_ordering) {
+}
+
+FIXTURE_TEARDOWN(xfail_ctor_ordering) {
+}
+
+FIXTURE_VARIANT(xfail_ctor_ordering) {
+ int dummy;
+};
+
+FIXTURE_VARIANT_ADD(xfail_ctor_ordering, only) {
+ .dummy = 0,
+};
+
+TEST_F(xfail_ctor_ordering, expected_fail) {
+ ASSERT_EQ(1, 0);
+}
+
+XFAIL_ADD(xfail_ctor_ordering, only, expected_fail);
+
int main(int argc, char **argv)
{
/*
base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
--
2.43.0
next reply other threads:[~2026-03-09 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 9:37 Sun Jian [this message]
2026-03-09 9:44 ` [PATCH] selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering Thomas Weißschuh
2026-03-09 10:10 ` [PATCH v2] " Sun Jian
2026-04-29 16:09 ` Bjoern Doebel
2026-04-29 16:21 ` Thomas Weißschuh
2026-04-30 2:23 ` sun jian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260309093752.808533-1-sun.jian.kdev@gmail.com \
--to=sun.jian.kdev@gmail.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=thomas@t-8ch.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox