[PATCH 10/32] selftests: harness: Always provide "self" and "variant"

From: Thomas Weißschuh
Date: Tue Mar 04 2025 - 02:13:22 EST


Some upcoming changes to the assertion macros need those two symbols
also to be available for tests without fixtures.
Provide them with a NULL value.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
tools/testing/selftests/kselftest_harness.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index df55b99d8abab2398d2eba5080c4d0c795688bc7..0ea3778a3a85fda6bc363d2b2e1038679920d22b 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -177,13 +177,13 @@
#define TEST_SIGNAL(test_name, signal) __TEST_IMPL(test_name, signal)

#define __TEST_IMPL(test_name, _signal) \
- static void test_name(struct __test_metadata *_metadata); \
+ static void test_name(struct __test_metadata *_metadata, void *self, const void *variant); \
static void wrapper_##test_name( \
struct __test_metadata *_metadata, \
struct __fixture_variant_metadata __attribute__((unused)) *variant) \
{ \
if (setjmp(_metadata->env) == 0) \
- test_name(_metadata); \
+ test_name(_metadata, NULL, NULL); \
__test_check_assert(_metadata); \
} \
static struct __test_metadata _##test_name##_object = \
@@ -197,7 +197,9 @@
__register_test(&_##test_name##_object); \
} \
static void test_name( \
- struct __test_metadata __attribute__((unused)) *_metadata)
+ struct __test_metadata __attribute__((unused)) *_metadata, \
+ void __attribute__((unused)) *self, \
+ const void __attribute__((unused)) *variant)

/**
* FIXTURE_DATA() - Wraps the struct name so we have one less

--
2.48.1