summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-05-05 18:15:29 +0300
committerThomas Weißschuh <linux@weissschuh.net>2025-05-21 16:32:36 +0300
commitf46ddc2cbac34d73f959c798505d81413866ecf0 (patch)
tree69ccbdb6c2091c86125068a51e9a102f4f4eb23d
parent5f036a2a8e0985e52f7cf63a06f51911b5e8cae2 (diff)
downloadlinux-f46ddc2cbac34d73f959c798505d81413866ecf0.tar.xz
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>
-rw-r--r--tools/testing/selftests/kselftest_harness.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index acb476093b74..088c875df91a 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -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;
};