testsuite: ztress: First sys_rand_get32 from thread
Added a workaround to call random generator once during the
initialization. It is done to handle XOSHIRO generator limitation
which performs initialization in the first sys_rand32_get call.
And for some entropy generators it cannot be done from an interrupt
context and it happens if k_timer context is used which expires first.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
diff --git a/subsys/testsuite/ztest/src/ztress.c b/subsys/testsuite/ztest/src/ztress.c
index 1833e96..9ab23a5 100644
--- a/subsys/testsuite/ztest/src/ztress.c
+++ b/subsys/testsuite/ztest/src/ztress.c
@@ -467,6 +467,12 @@
*/
cpu_sys_clock_ok = t <= 12;
+ /* Read first random number. There are some generators which do not support
+ * reading first random number from an interrupt context (initialization
+ * is performed at the first read).
+ */
+ (void)sys_rand32_get();
+
return 0;
}