ta/os_test: add bget test
Enables bget test if CFG_TA_BGET_TEST=y.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/ta/os_test/os_test.c b/ta/os_test/os_test.c
index 8670944..9ffbdea 100644
--- a/ta/os_test/os_test.c
+++ b/ta/os_test/os_test.c
@@ -719,6 +719,38 @@
}
#endif /*CFG_TA_FLOAT_SUPPORT*/
+#if defined(CFG_TA_BGET_TEST)
+/* From libutils */
+int bget_main_test(void *(*malloc_func)(size_t), void (*free_func)(void *));
+
+static void *malloc_wrapper(size_t size)
+{
+ return tee_map_zi(size, 0);
+}
+
+static void free_wrapper(void *ptr __unused)
+{
+}
+
+static TEE_Result test_bget(void)
+{
+ DMSG("Testing bget");
+ if (bget_main_test(malloc_wrapper, free_wrapper)) {
+ EMSG("bget_main_test failed");
+ return TEE_ERROR_GENERIC;
+ }
+ DMSG("Bget OK");
+ return TEE_SUCCESS;
+}
+#else
+static TEE_Result test_bget(void)
+{
+ IMSG("Bget test disabled");
+ return TEE_SUCCESS;
+}
+#endif
+
+
static __noinline __noreturn void call_longjmp(jmp_buf env)
{
DMSG("Calling longjmp");
@@ -769,6 +801,10 @@
if (res != TEE_SUCCESS)
return res;
+ res = test_bget();
+ if (res != TEE_SUCCESS)
+ return res;
+
return TEE_SUCCESS;
}