Skip to content

Commit f46ddc2

Browse files
committed
selftests: harness: Add "variant" and "self" to test metadata
To get rid of setjmp()/longjmp(), the variant and self need to be usable from __bail(). Make them available from the test metadata. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/20250505-nolibc-kselftest-harness-v4-11-ee4dd5257135@linutronix.de Signed-off-by: Thomas Weißschuh <[email protected]>
1 parent 5f036a2 commit f46ddc2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@
423423
self = &self_private; \
424424
} \
425425
} \
426+
_metadata->variant = variant->data; \
427+
_metadata->self = self; \
426428
if (setjmp(_metadata->env) == 0) { \
427429
/* _metadata and potentially self are shared with all forks. */ \
428430
child = fork(); \
@@ -926,6 +928,8 @@ struct __test_metadata {
926928
bool aborted; /* stopped test due to failed ASSERT */
927929
bool *no_teardown; /* fixture needs teardown */
928930
jmp_buf env; /* for exiting out of test early */
931+
void *self;
932+
const void *variant;
929933
struct __test_results *results;
930934
struct __test_metadata *prev, *next;
931935
};

0 commit comments

Comments
 (0)