tests: crypto: rand32: Add test for z_early_boot_rand32_get

Add test for z_early_boot_rand32_get() API.

This also improves the coverage for kernel/init.c

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
Ramakrishna Pallala 2018-07-19 10:22:02 +05:30 committed by Anas Nashif
parent 5f92b3b740
commit 913507a21f
2 changed files with 10 additions and 0 deletions

View file

@ -1,5 +1,7 @@
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)
zephyr_include_directories(app PRIVATE $ENV{ZEPHYR_BASE}/kernel/include/)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -8,15 +8,18 @@
/*
* This tests the following random number routines:
* u32_t z_early_boot_rand32_get(void);
* u32_t sys_rand32_get(void);
*/
#include <ztest.h>
#include <logging/sys_log.h>
#include <kernel_internal.h>
#define N_VALUES 10
/**
*
* @brief Regression test's entry point
@ -31,6 +34,11 @@ void test_rand32(void)
int rnd_cnt;
int equal_count = 0;
/* Test early boot random number generation function */
last_gen = z_early_boot_rand32_get();
zassert_true(last_gen != z_early_boot_rand32_get(),
"z_early_boot_rand32_get failed");
/*
* Test subsequently calls sys_rand32_get(), checking
* that two values are not equal.