selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering
Subsystems (2)
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
@@ -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
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 betweenTEST_F()registration andXFAIL_ADD()registration.Suggested-by Thomas Weißschuh <[email protected]>
I used my wrong email address for this.
Could you switch it to:
Thomas Weißschuh <[email protected]>
Quoted 3 lines
Signed-off-by Sun Jian <[email protected]>--- .../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(+)
(...)
PATCH v2 1/1 selftests/harness: harness-selftest: cover XFAIL_ADD ctor ordering
In reply to Sun JianAdd 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
@@ -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
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 betweenTEST_F()registration andXFAIL_ADD()registration.Suggested-by Thomas Weißschuh <[email protected]>Signed-off-by Sun Jian <[email protected]>
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
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 betweenTEST_F()registration andXFAIL_ADD()registration.Suggested-by Thomas Weißschuh <[email protected]>Signed-off-by Sun Jian <[email protected]>---
v2:
- update Suggested-by address
- update harness-selftest.expected
- verify with 'makerun_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
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 betweenTEST_F()registration andXFAIL_ADD()registration.Suggested-by Thomas Weißschuh <[email protected]>Signed-off-by Sun Jian <[email protected]>---
v2:
- update Suggested-by address
- update harness-selftest.expected
- verify with 'makerun_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