zephyr/tests/kernel/common/src/boot_delay.c
Anas Nashif d35f1150f3 tests: common: move boot_delay test to common
This is a small test that can be easily integrated into the common set
of tests we have already.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-02-05 20:40:07 -05:00

35 lines
688 B
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ztest.h>
#define NSEC_PER_MSEC (u64_t)(NSEC_PER_USEC * USEC_PER_MSEC)
/**
* @brief Test delay during boot
* @defgroup kernel_bootdelay_tests Init
* @ingroup all_tests
* @{
*/
/**
* @brief This module verifies the delay specified during boot.
* @see k_cycle_get_32, #SYS_CLOCK_HW_CYCLES_TO_NS64(X)
*/
void test_verify_bootdelay(void)
{
u32_t current_cycles = k_cycle_get_32();
/* compare this with the boot delay specified */
zassert_true(SYS_CLOCK_HW_CYCLES_TO_NS64(current_cycles) >=
(NSEC_PER_MSEC * CONFIG_BOOT_DELAY),
"boot delay not executed");
}
/**
* @}
*/