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 <thomas.weissschuh@linutronix.de>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250505-nolibc-kselftest-harness-v4-11-ee4dd5257135@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
Thomas Weißschuh 2025-05-05 17:15:29 +02:00 committed by Thomas Weißschuh
parent 5f036a2a8e
commit f46ddc2cba

View File

@ -423,6 +423,8 @@
self = &self_private; \
} \
} \
_metadata->variant = variant->data; \
_metadata->self = self; \
if (setjmp(_metadata->env) == 0) { \
/* _metadata and potentially self are shared with all forks. */ \
child = fork(); \
@ -926,6 +928,8 @@ struct __test_metadata {
bool aborted; /* stopped test due to failed ASSERT */
bool *no_teardown; /* fixture needs teardown */
jmp_buf env; /* for exiting out of test early */
void *self;
const void *variant;
struct __test_results *results;
struct __test_metadata *prev, *next;
};