Skip to contentSkip to conversation

selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering

PATCH Superseded Sun Jian 3 participants 6 messages Mar 9 – Apr 30

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sun Jian

author
#0 lore raw

PATCH 1/1 selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering

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.

---
 .../kselftest_harness/harness-selftest.c      | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
tools/testing/selftests/kselftest_harness/harness-selftest.c +23 -0
index 7820bb5d0e6d..9920ef7e4385 100644
@@ -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

Signature · 1 line
2.43.0
#1 lore raw

Hi!

Quoted 6 lines · Sun Jian

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.

I used my wrong email address for this.
Could you switch it to:
Thomas Weißschuh <[email protected]>

Quoted 3 lines
---
 .../kselftest_harness/harness-selftest.c      | 23 +++++++++++++++++++

Also update harness-selftest.expected with the new output. To verify that everything works, run 'make run_tests' from the test directory.

Quoted 1 line
 1 file changed, 23 insertions(+)

(...)

author
#2 lore raw

PATCH v2 1/1 selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering

In reply to Sun Jian

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.

---
v2:
- update Suggested-by address
- update harness-selftest.expected
- verify with 'make run_tests'

 .../kselftest_harness/harness-selftest.c      | 23 ++++++++++
 .../harness-selftest.expected                 | 43 +++++++++++--------
 2 files changed, 47 insertions(+), 19 deletions(-)
tools/testing/selftests/kselftest_harness/harness-selftest.c +23 -0
index 7820bb5d0e6d..9920ef7e4385 100644
@@ -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)
 {
 	/*
tools/testing/selftests/kselftest_harness/harness-selftest.expected +24 -19

62 lines not on this page · raw message

base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681

Signature · 1 line
2.43.0
Tested-by on v2 1/1
#3 lore raw
Quoted 7 lines · Sun Jian

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.

Tested on Amazon Linux 2023 kernel 6.18.20 on both x86_64 and arm64.

Best,
Bjoern

Amazon Web Services Development Center Germany GmbH Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597

#4 lore raw
In reply to Sun Jian

Hi!

Quoted 13 lines · Sun Jian

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.

---
v2:
- update Suggested-by address
- update harness-selftest.expected
- verify with 'make run_tests'

Quoted 3 lines
 .../kselftest_harness/harness-selftest.c      | 23 ++++++++++
 .../harness-selftest.expected                 | 43 +++++++++++--------
 2 files changed, 47 insertions(+), 19 deletions(-)

Can you rebase this on kselftest/fixes?
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=fixes

This doesn't apply anymore and I suspect the proposed ordering suffers from the issue fixed by commit 465b05bae5ac ("selftests: harness:
Restore order of test functions")

Thomas

author
#5 lore raw
Quoted 24 lines · Thomas Weißschuh

Hi!

Quoted 13 lines · Sun Jian

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.

---
v2:
- update Suggested-by address
- update harness-selftest.expected
- verify with 'make run_tests'

Quoted 3 lines
 .../kselftest_harness/harness-selftest.c      | 23 ++++++++++
 .../harness-selftest.expected                 | 43 +++++++++++--------
 2 files changed, 47 insertions(+), 19 deletions(-)

Can you rebase this on kselftest/fixes?
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=fixes

Quoted 6 lines

This doesn't apply anymore and I suspect the proposed ordering suffers from the issue fixed by commit 465b05bae5ac ("selftests: harness:
Restore order of test functions")

Thomas

Hi Thomas,

Thanks, I will send a v3 shortly.

Sun Jian