From 62efef0444e90d95a82d1a0c2e104466dc52fb8b Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Mon, 19 Nov 2018 22:20:52 +0530 Subject: [PATCH] test: spiram: fix and enable test cases for default configuration --- .../esp32/test/test_spiram_cache_flush.c | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/components/esp32/test/test_spiram_cache_flush.c b/components/esp32/test/test_spiram_cache_flush.c index a99f7226db..964ccde33d 100644 --- a/components/esp32/test/test_spiram_cache_flush.c +++ b/components/esp32/test/test_spiram_cache_flush.c @@ -24,11 +24,15 @@ This code tests the interaction between PSRAM and SPI flash routines. #include "esp_partition.h" #include "test_utils.h" +#if CONFIG_SPIRAM_SUPPORT -#if CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MEMMAP +#if CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC +#define USE_CAPS_ALLOC 1 +#endif // CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC #define TSTSZ (16*1024) +#if !CONFIG_FREERTOS_UNICORE volatile static int res[2], err[2]; @@ -51,11 +55,11 @@ void tstMem(void *arg) { } -TEST_CASE("Spiram cache flush on mmap", "[spiram][ignore]") +TEST_CASE("Spiram cache flush on mmap", "[spiram]") { void *mem[2]; res[0]=0; res[1]=0; -#if CONFIG_SPIRAM_USE_CAPS_ALLOC +#if USE_CAPS_ALLOC printf("Allocating SPI RAM chunk...\n"); mem[0]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); mem[1]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); @@ -71,7 +75,6 @@ TEST_CASE("Spiram cache flush on mmap", "[spiram][ignore]") xTaskCreatePinnedToCore(tstMem , "tskone" , 2048, mem[0], 3, &th[0], 0); xTaskCreatePinnedToCore(tstMem , "tsktwo" , 2048, mem[1], 3, &th[1], 1); - const esp_partition_t* part = get_test_data_partition(); for (int l=0; l<10; l++) { for (int p=0; p<4096*1024; p+=65536) { const void *out; @@ -79,14 +82,13 @@ TEST_CASE("Spiram cache flush on mmap", "[spiram][ignore]") spi_flash_mmap(p, 65536, SPI_FLASH_MMAP_DATA, &out, &h); spi_flash_munmap(h); } - printf("%d/10\n", l); } printf("Checked memory %d and %d times. Errors: %d and %d\n", res[0], res[1], err[0], err[1]); vTaskDelete(th[0]); vTaskDelete(th[1]); -#if CONFIG_SPIRAM_USE_CAPS_ALLOC +#if USE_CAPS_ALLOC free(mem[0]); free(mem[1]); #endif @@ -97,11 +99,11 @@ TEST_CASE("Spiram cache flush on mmap", "[spiram][ignore]") #define CYCLES 1024 -TEST_CASE("Spiram cache flush on write/read", "[spiram][ignore]") +TEST_CASE("Spiram cache flush on write/read", "[spiram]") { void *mem[2]; res[0]=0; res[1]=0; -#if CONFIG_SPIRAM_USE_CAPS_ALLOC +#if USE_CAPS_ALLOC printf("Allocating SPI RAM chunk...\n"); mem[0]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); mem[1]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); @@ -127,7 +129,6 @@ TEST_CASE("Spiram cache flush on write/read", "[spiram][ignore]") spi_flash_mmap_handle_t handle; esp_partition_mmap(part, 0, 512, SPI_FLASH_MMAP_DATA, &out, &handle); for (int i=0; i