tests: board: esp32: move the cache_coex test to new ztest API
Migrate the testsuite tests/boards/espressif_esp32/cache_coex/ to the new ztest API. Signed-off-by: Enjia Mai <enjia.mai@intel.com>
This commit is contained in:
parent
4c20403629
commit
8ae7fd7bd9
|
@ -6,3 +6,4 @@ CONFIG_ESP_HEAP_SEARCH_ALL_REGIONS=n
|
||||||
CONFIG_FLASH=y
|
CONFIG_FLASH=y
|
||||||
CONFIG_ENTROPY_GENERATOR=y
|
CONFIG_ENTROPY_GENERATOR=y
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
CONFIG_ZTEST_NEW_API=y
|
||||||
|
|
|
@ -179,7 +179,7 @@ static bool check_psram(int value)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void psram_test(void)
|
static void psram_test(void)
|
||||||
{
|
{
|
||||||
uint32_t sleep_ms = 10;
|
uint32_t sleep_ms = 10;
|
||||||
int rand_val;
|
int rand_val;
|
||||||
|
@ -199,7 +199,7 @@ void psram_test(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void psram_init(void)
|
static void psram_init(void)
|
||||||
{
|
{
|
||||||
mem = k_malloc(SPIRAM_ALLOC_SIZE);
|
mem = k_malloc(SPIRAM_ALLOC_SIZE);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
|
@ -216,7 +216,7 @@ void psram_init(void)
|
||||||
psram_test();
|
psram_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_test(void)
|
static void flash_test(void)
|
||||||
{
|
{
|
||||||
uint32_t sleep_ms = 15;
|
uint32_t sleep_ms = 15;
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ void flash_test(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_init(void)
|
static void flash_init(void)
|
||||||
{
|
{
|
||||||
if (!device_is_ready(flash_dev)) {
|
if (!device_is_ready(flash_dev)) {
|
||||||
TC_ERROR("flash controller not ready\n");
|
TC_ERROR("flash controller not ready\n");
|
||||||
|
@ -247,36 +247,32 @@ void flash_init(void)
|
||||||
flash_test();
|
flash_test();
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_using_spiram(void)
|
ZTEST(cache_coex, test_using_spiram)
|
||||||
{
|
{
|
||||||
zassert_equal(true, coex_result.using_ext_ram, "external RAM is not being used");
|
zassert_equal(true, coex_result.using_ext_ram, "external RAM is not being used");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_flash_integrity(void)
|
ZTEST(cache_coex, test_flash_integrity)
|
||||||
{
|
{
|
||||||
zassert_equal(FLASH_READBACK_LEN, coex_result.flash_cnt, "flash integrity test failed");
|
zassert_equal(FLASH_READBACK_LEN, coex_result.flash_cnt, "flash integrity test failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_ram_integrity(void)
|
ZTEST(cache_coex, test_ram_integrity)
|
||||||
{
|
{
|
||||||
zassert_equal(true, coex_result.psram_ok, "SPIRAM integrity test failed");
|
zassert_equal(true, coex_result.psram_ok, "SPIRAM integrity test failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_main(void)
|
void *cache_coex_setup(void)
|
||||||
{
|
{
|
||||||
while (unfinished_tasks) {
|
while (unfinished_tasks) {
|
||||||
k_usleep(1);
|
k_usleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ztest_test_suite(cache_coex_test,
|
return NULL;
|
||||||
ztest_unit_test(test_using_spiram),
|
|
||||||
ztest_unit_test(test_flash_integrity),
|
|
||||||
ztest_unit_test(test_ram_integrity)
|
|
||||||
);
|
|
||||||
|
|
||||||
ztest_run_test_suite(cache_coex_test);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
K_THREAD_DEFINE(psram_id, STACKSIZE, psram_init, NULL, NULL, NULL, PRIORITY, 0, 0);
|
K_THREAD_DEFINE(psram_id, STACKSIZE, psram_init, NULL, NULL, NULL, PRIORITY, 0, 0);
|
||||||
K_THREAD_DEFINE(flash_id, STACKSIZE, flash_init, NULL, NULL, NULL, PRIORITY, 0, 0);
|
K_THREAD_DEFINE(flash_id, STACKSIZE, flash_init, NULL, NULL, NULL, PRIORITY, 0, 0);
|
||||||
K_THREAD_DEFINE(buffer_id, STACKSIZE, buffer_fill, NULL, NULL, NULL, PRIORITY, 0, 0);
|
K_THREAD_DEFINE(buffer_id, STACKSIZE, buffer_fill, NULL, NULL, NULL, PRIORITY, 0, 0);
|
||||||
|
|
||||||
|
ZTEST_SUITE(cache_coex, NULL, cache_coex_setup, NULL, NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue