From 7b862474289480ed3dbecdd0c76c4e6ec7b7f3d7 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 13 Nov 2018 20:14:17 +0800 Subject: [PATCH] unit-test: use TEST_GROUPS to filter tests for psram_vspi and psram_hspi --- components/esp32/test/CMakeLists.txt | 52 ++++++++----------- components/esp32/test/component.mk | 6 +-- .../esp32/test/{psram_4m => }/test_4mpsram.c | 2 +- tools/unit-test-app/components/unity/Kconfig | 11 ---- tools/unit-test-app/configs/psram_hspi | 2 +- tools/unit-test-app/configs/psram_vspi | 2 +- 6 files changed, 26 insertions(+), 49 deletions(-) rename components/esp32/test/{psram_4m => }/test_4mpsram.c (96%) diff --git a/components/esp32/test/CMakeLists.txt b/components/esp32/test/CMakeLists.txt index baaa34309b..6479bbcf78 100644 --- a/components/esp32/test/CMakeLists.txt +++ b/components/esp32/test/CMakeLists.txt @@ -1,38 +1,30 @@ -if (CONFIG_TEST_ESP32_SUBTEST_ONLY) - set(COMPONENT_SRCDIRS "psram_4m") - set(COMPONENT_ADD_INCLUDEDIRS ".") +set(COMPONENT_SRCDIRS ".") +set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}") - register_component() +set(COMPONENT_REQUIRES unity nvs_flash ulp) -else() - set(COMPONENT_SRCDIRS ". psram_4m") - set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}") +register_component() - set(COMPONENT_REQUIRES unity nvs_flash ulp) +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + WORKING_DIRECTORY ${COMPONENT_PATH} + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") - register_component() +# Calculate MD5 value of header file esp_wifi_os_adapter.h +execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h + COMMAND cut -c 1-7 + OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5 + OUTPUT_STRIP_TRAILING_WHITESPACE) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" - COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" - WORKING_DIRECTORY ${COMPONENT_PATH} - DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") +# Calculate MD5 value of header file esp_wifi_crypto_types.h +execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h + COMMAND cut -c 1-7 + OUTPUT_VARIABLE WIFI_CRYPTO_MD5 + OUTPUT_STRIP_TRAILING_WHITESPACE) - # Calculate MD5 value of header file esp_wifi_os_adapter.h - execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h - COMMAND cut -c 1-7 - OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5 - OUTPUT_STRIP_TRAILING_WHITESPACE) +add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\") +add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\") - # Calculate MD5 value of header file esp_wifi_crypto_types.h - execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h - COMMAND cut -c 1-7 - OUTPUT_VARIABLE WIFI_CRYPTO_MD5 - OUTPUT_STRIP_TRAILING_WHITESPACE) +add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") - add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\") - add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\") - - add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") - - add_dependencies(${COMPONENT_NAME} esp32_test_logo) -endif() \ No newline at end of file +add_dependencies(${COMPONENT_NAME} esp32_test_logo) diff --git a/components/esp32/test/component.mk b/components/esp32/test/component.mk index 41947b1b7c..11e0f7ed7c 100644 --- a/components/esp32/test/component.mk +++ b/components/esp32/test/component.mk @@ -6,11 +6,7 @@ COMPONENT_EXTRA_CLEAN := test_tjpgd_logo.h COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive -ifdef CONFIG_TEST_ESP32_SUBTEST_ONLY -COMPONENT_SRCDIRS := psram_4m -else -COMPONENT_SRCDIRS := . test_vectors psram_4m -endif +COMPONENT_SRCDIRS := . # Calculate MD5 value of header file esp_wifi_os_adapter.h WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_os_adapter.h | cut -c 1-7)\" diff --git a/components/esp32/test/psram_4m/test_4mpsram.c b/components/esp32/test/test_4mpsram.c similarity index 96% rename from components/esp32/test/psram_4m/test_4mpsram.c rename to components/esp32/test/test_4mpsram.c index 29aef654e7..26e2c8d5e4 100644 --- a/components/esp32/test/psram_4m/test_4mpsram.c +++ b/components/esp32/test/test_4mpsram.c @@ -34,7 +34,7 @@ static void test_psram_content() } // NOTE: this unit test rely on the config that PSRAM of 8MB is used only when CONFIG_SPIRAM_BNKSWITCH_ENABLE is set -TEST_CASE("can use spi when not being used by psram", "[esp32]") +TEST_CASE("can use spi when not being used by psram", "[psram_4m]") { spi_host_device_t host; #if !CONFIG_SPIRAM_SUPPORT || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE diff --git a/tools/unit-test-app/components/unity/Kconfig b/tools/unit-test-app/components/unity/Kconfig index 02ffde126b..642d76f9d5 100644 --- a/tools/unit-test-app/components/unity/Kconfig +++ b/tools/unit-test-app/components/unity/Kconfig @@ -13,14 +13,3 @@ config UNITY_FREERTOS_STACK_SIZE default 8192 endmenu - -menu "Test options" - -config TEST_ESP32_SUBTEST_ONLY - bool "Test only 4M PSRAM cases for esp32 component" - depends on SPIRAM_SUPPORT - default n - help - If this option is enabled, only 4M PSRAM cases are compiled. Otherwise all cases are included. - -endmenu diff --git a/tools/unit-test-app/configs/psram_hspi b/tools/unit-test-app/configs/psram_hspi index 1e4583c1f2..d8568109d4 100644 --- a/tools/unit-test-app/configs/psram_hspi +++ b/tools/unit-test-app/configs/psram_hspi @@ -1,5 +1,5 @@ TEST_COMPONENTS=esp32 -CONFIG_TEST_ESP32_SUBTEST_ONLY=y +TEST_GROUPS=psram_4m CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y diff --git a/tools/unit-test-app/configs/psram_vspi b/tools/unit-test-app/configs/psram_vspi index 73bbd4868c..afa0c28f18 100644 --- a/tools/unit-test-app/configs/psram_vspi +++ b/tools/unit-test-app/configs/psram_vspi @@ -1,5 +1,5 @@ TEST_COMPONENTS=esp32 -CONFIG_TEST_ESP32_SUBTEST_ONLY=y +TEST_GROUPS=psram_4m CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y -- 2.40.0