On Tue, Jun 17, 2025 at 09:35:12AM +0200, Thomas Weißschuh wrote: >Good idea. >
Thanks. >On Mon, Jun 16, 2025 at 12:23:38PM +0000, Wei Yang wrote: >> Each fixture could support variant. Add fixture with variant to verify >> the behavior, so we can validate for further change. >> >> Signed-off-by: Wei Yang <richard.weiy...@gmail.com> >> --- >> .../kselftest_harness/harness-selftest.c | 34 +++++++++++++++++++ >> .../harness-selftest.expected | 22 +++++++++--- >> 2 files changed, 52 insertions(+), 4 deletions(-) >> >> diff --git a/tools/testing/selftests/kselftest_harness/harness-selftest.c >> b/tools/testing/selftests/kselftest_harness/harness-selftest.c >> index b555493bdb4d..2fd5310b33c7 100644 >> --- a/tools/testing/selftests/kselftest_harness/harness-selftest.c >> +++ b/tools/testing/selftests/kselftest_harness/harness-selftest.c >> @@ -118,6 +118,40 @@ TEST_F(fixture_setup_failure, pass) { >> TH_LOG("after"); >> } >> >> +FIXTURE(fixture_variant) { >> + pid_t testpid; >> +}; >> + >> +FIXTURE_VARIANT(fixture_variant) >> +{ >> + int value; >> +}; >> + >> +FIXTURE_VARIANT_ADD(fixture_variant, v32) >> +{ >> + .value = 32, >> +}; >> + >> +FIXTURE_VARIANT_ADD(fixture_variant, v64) >> +{ >> + .value = 64, >> +}; >> + >> +FIXTURE_SETUP(fixture_variant) { >> + TH_LOG("setup %d", variant->value); >> + self->testpid = getpid(); >> +} >> + >> +FIXTURE_TEARDOWN(fixture_variant) { >> + TH_LOG("teardown same-process=%d", self->testpid == getpid()); >> +} >> + >> +TEST_F(fixture_variant, pass) { >> + TH_LOG("before"); >> + ASSERT_EQ(0, 0); > >Please log the variant value from the test itself and the teardown function. >Also I don't think we need the pid logging and before/after/ASSERT in this test >also, it is already validated in the other ones. > Sure, per my understanding, is this what you prefer? FIXTURE_SETUP(fixture_variant) { TH_LOG("setup %d", variant->value); } FIXTURE_TEARDOWN(fixture_variant) { TH_LOG("teardown %d", variant->value); } TEST_F(fixture_variant, pass) { TH_LOG("before %d", variant->value); ASSERT_EQ(0, 0); TH_LOG("after %d", variant->value); } -- Wei Yang Help you, Help me