mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
cmock: added cmock as component
* changing dependencies from unity->cmock * added component.mk and Makefile.projbuild * ignore test dir in gen_esp_err_to_name.py * added some brief introduction of CMock in IDF
This commit is contained in:
parent
5c5c7c4449
commit
20c068ef3b
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -86,3 +86,7 @@
|
|||||||
[submodule "examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib"]
|
[submodule "examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib"]
|
||||||
path = examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib
|
path = examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib
|
||||||
url = ../../espressif/esp-cryptoauthlib.git
|
url = ../../espressif/esp-cryptoauthlib.git
|
||||||
|
|
||||||
|
[submodule "components/cmock/CMock"]
|
||||||
|
path = components/cmock/CMock
|
||||||
|
url = ../../ThrowTheSwitch/CMock.git
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity)
|
PRIV_REQUIRES cmock)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils app_update bootloader_support nvs_flash
|
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity bootloader_support app_update)
|
PRIV_REQUIRES cmock bootloader_support app_update)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
if(CONFIG_BT_ENABLED OR CMAKE_BUILD_EARLY_EXPANSION)
|
if(CONFIG_BT_ENABLED OR CMAKE_BUILD_EARLY_EXPANSION)
|
||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity nvs_flash bt)
|
PRIV_REQUIRES cmock nvs_flash bt)
|
||||||
endif()
|
endif()
|
||||||
|
5
components/cmock/CMakeLists.txt
Normal file
5
components/cmock/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Although unity is a submodule of cmock, we still depend on the unity component in IDF.
|
||||||
|
# This is because CI currently doesn't checkout submodules recursively.
|
||||||
|
idf_component_register(SRCS "CMock/src/cmock.c"
|
||||||
|
REQUIRES unity
|
||||||
|
INCLUDE_DIRS "CMock/src")
|
1
components/cmock/CMock
Submodule
1
components/cmock/CMock
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit eeecc49ce8af123cf8ad40efdb9673e37b56230f
|
1
components/cmock/Makefile.projbuild
Normal file
1
components/cmock/Makefile.projbuild
Normal file
@ -0,0 +1 @@
|
|||||||
|
CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
|
4
components/cmock/component.mk
Normal file
4
components/cmock/component.mk
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#
|
||||||
|
# Component Makefile
|
||||||
|
#
|
||||||
|
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils console)
|
PRIV_REQUIRES cmock test_utils console)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity)
|
PRIV_REQUIRES cmock)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS . param_test touch_sensor_test adc_dma_test dac_dma_test
|
idf_component_register(SRC_DIRS . param_test touch_sensor_test adc_dma_test dac_dma_test
|
||||||
PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include
|
PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include
|
||||||
PRIV_REQUIRES unity test_utils driver nvs_flash esp_serial_slave_link infrared_tools esp_adc_cal)
|
PRIV_REQUIRES cmock test_utils driver nvs_flash esp_serial_slave_link infrared_tools esp_adc_cal)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "." "include"
|
PRIV_INCLUDE_DIRS "." "include"
|
||||||
PRIV_INCLUDE_DIRS "../private_include"
|
PRIV_INCLUDE_DIRS "../private_include"
|
||||||
PRIV_REQUIRES unity test_utils efuse bootloader_support
|
PRIV_REQUIRES cmock test_utils efuse bootloader_support
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
if(IDF_TARGET STREQUAL "esp32")
|
if(IDF_TARGET STREQUAL "esp32")
|
||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils nvs_flash ulp esp_common
|
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common
|
||||||
)
|
)
|
||||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5")
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
if(IDF_TARGET STREQUAL "esp32s2")
|
if(IDF_TARGET STREQUAL "esp32s2")
|
||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils nvs_flash ulp esp_common
|
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils spi_flash)
|
PRIV_REQUIRES cmock test_utils spi_flash
|
||||||
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils esp_eth esp_http_client
|
PRIV_REQUIRES cmock test_utils esp_eth esp_http_client
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS . ../private_include
|
PRIV_INCLUDE_DIRS . ../private_include
|
||||||
PRIV_REQUIRES unity test_utils esp_event driver)
|
PRIV_REQUIRES cmock test_utils esp_event driver)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES unity test_utils esp_hid)
|
REQUIRES cmock test_utils esp_hid)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils esp_http_client)
|
PRIV_REQUIRES cmock test_utils esp_http_client)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils esp_http_server)
|
PRIV_REQUIRES cmock test_utils esp_http_server)
|
@ -1,6 +1,6 @@
|
|||||||
if(IDF_TARGET STREQUAL "esp32")
|
if(IDF_TARGET STREQUAL "esp32")
|
||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "../private_include" "."
|
PRIV_INCLUDE_DIRS "../private_include" "."
|
||||||
PRIV_REQUIRES unity test_utils esp_netif nvs_flash)
|
PRIV_REQUIRES cmock test_utils esp_netif nvs_flash)
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
|
|
||||||
if(IDF_TARGET STREQUAL "esp32")
|
if(IDF_TARGET STREQUAL "esp32")
|
||||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "../private_include"
|
PRIV_INCLUDE_DIRS "../private_include"
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
|
|
||||||
if(CONFIG_ESP_TIMER_IMPL_FRC2)
|
if(CONFIG_ESP_TIMER_IMPL_FRC2)
|
||||||
idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND)
|
idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
PRIV_REQUIRES unity test_utils nvs_flash ulp esp_common
|
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common
|
||||||
)
|
)
|
||||||
|
@ -3,5 +3,5 @@ if(TESTS_ALL EQUAL 1)
|
|||||||
else()
|
else()
|
||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity nvs_flash)
|
PRIV_REQUIRES cmock nvs_flash)
|
||||||
endif()
|
endif()
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity expat)
|
PRIV_REQUIRES cmock expat)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils vfs fatfs
|
PRIV_REQUIRES cmock test_utils vfs fatfs
|
||||||
EMBED_TXTFILES fatfs.img
|
EMBED_TXTFILES fatfs.img
|
||||||
)
|
)
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils esp_ipc
|
PRIV_REQUIRES cmock test_utils esp_ipc
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils heap)
|
PRIV_REQUIRES cmock test_utils heap)
|
||||||
|
@ -2,7 +2,7 @@ if(TESTS_ALL EQUAL 1)
|
|||||||
message("not linking libsodium tests, use '-T libsodium' to test it")
|
message("not linking libsodium tests, use '-T libsodium' to test it")
|
||||||
else()
|
else()
|
||||||
get_filename_component(LS_TESTDIR "${CMAKE_CURRENT_LIST_DIR}/../libsodium/test/default" ABSOLUTE)
|
get_filename_component(LS_TESTDIR "${CMAKE_CURRENT_LIST_DIR}/../libsodium/test/default" ABSOLUTE)
|
||||||
|
|
||||||
set(TEST_CASES "chacha20;aead_chacha20poly1305;box;box2;ed25519_convert;sign;hash")
|
set(TEST_CASES "chacha20;aead_chacha20poly1305;box;box2;ed25519_convert;sign;hash")
|
||||||
|
|
||||||
foreach(test_case ${TEST_CASES})
|
foreach(test_case ${TEST_CASES})
|
||||||
@ -12,7 +12,7 @@ else()
|
|||||||
|
|
||||||
idf_component_register(SRCS "${TEST_CASES_FILES}" "test_sodium.c"
|
idf_component_register(SRCS "${TEST_CASES_FILES}" "test_sodium.c"
|
||||||
PRIV_INCLUDE_DIRS "." "${LS_TESTDIR}/../quirks"
|
PRIV_INCLUDE_DIRS "." "${LS_TESTDIR}/../quirks"
|
||||||
PRIV_REQUIRES unity libsodium)
|
PRIV_REQUIRES cmock libsodium)
|
||||||
|
|
||||||
# The libsodium test suite is designed to be run each test case as an executable on a desktop computer and uses
|
# The libsodium test suite is designed to be run each test case as an executable on a desktop computer and uses
|
||||||
# filesytem to write & then compare contents of each file.
|
# filesytem to write & then compare contents of each file.
|
||||||
@ -33,4 +33,4 @@ else()
|
|||||||
# this seems odd, but it prevents the libsodium test harness from
|
# this seems odd, but it prevents the libsodium test harness from
|
||||||
# trying to write to a file!
|
# trying to write to a file!
|
||||||
add_definitions(-DBROWSER_TESTS)
|
add_definitions(-DBROWSER_TESTS)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils mbedtls libsodium
|
PRIV_REQUIRES cmock test_utils mbedtls libsodium
|
||||||
EMBED_TXTFILES server_cert_chain.pem prvtkey.pem server_cert_bundle)
|
EMBED_TXTFILES server_cert_chain.pem prvtkey.pem server_cert_bundle)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils mdns)
|
PRIV_REQUIRES cmock test_utils mdns)
|
@ -1,2 +1,2 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils mqtt nvs_flash app_update)
|
PRIV_REQUIRES cmock test_utils mqtt nvs_flash app_update)
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils nvs_flash bootloader_support)
|
PRIV_REQUIRES cmock test_utils nvs_flash bootloader_support)
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils openssl)
|
PRIV_REQUIRES cmock test_utils openssl)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity xtensa perfmon)
|
PRIV_REQUIRES cmock xtensa perfmon)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "../proto-c/"
|
PRIV_INCLUDE_DIRS "../proto-c/"
|
||||||
PRIV_REQUIRES unity mbedtls protocomm protobuf-c)
|
PRIV_REQUIRES cmock mbedtls protocomm protobuf-c)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils pthread)
|
PRIV_REQUIRES cmock test_utils pthread)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity sdmmc
|
PRIV_REQUIRES cmock sdmmc
|
||||||
)
|
)
|
@ -2,4 +2,4 @@ idf_build_get_property(soc_name IDF_TARGET)
|
|||||||
|
|
||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "${include_dirs}"
|
PRIV_INCLUDE_DIRS "${include_dirs}"
|
||||||
PRIV_REQUIRES unity test_utils)
|
PRIV_REQUIRES cmock test_utils)
|
||||||
|
@ -5,5 +5,5 @@ endif()
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
EXCLUDE_SRCS "${exclude_srcs}"
|
EXCLUDE_SRCS "${exclude_srcs}"
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils spi_flash bootloader_support app_update)
|
PRIV_REQUIRES cmock test_utils spi_flash bootloader_support app_update)
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils spiffs)
|
PRIV_REQUIRES cmock test_utils spiffs)
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "../private_include" "."
|
PRIV_INCLUDE_DIRS "../private_include" "."
|
||||||
PRIV_REQUIRES unity test_utils tcp_transport)
|
PRIV_REQUIRES cmock test_utils tcp_transport)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
idf_component_register(SRC_DIRS ${IDF_TARGET}
|
idf_component_register(SRC_DIRS ${IDF_TARGET}
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity ulp soc esp_common)
|
PRIV_REQUIRES cmock ulp soc esp_common)
|
||||||
|
|
||||||
if(IDF_TARGET STREQUAL "esp32")
|
if(IDF_TARGET STREQUAL "esp32")
|
||||||
set(ulp_sources "ulp/test_jumps_esp32.S")
|
set(ulp_sources "ulp/test_jumps_esp32.S")
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils vfs fatfs spiffs)
|
PRIV_REQUIRES cmock test_utils vfs fatfs spiffs)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRC_DIRS .
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils wear_levelling
|
PRIV_REQUIRES cmock test_utils wear_levelling
|
||||||
EMBED_FILES test_partition_v1.bin
|
EMBED_FILES test_partition_v1.bin
|
||||||
)
|
)
|
@ -1,7 +1,7 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
|
PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
PRIV_INCLUDE_DIRS "../src"
|
PRIV_INCLUDE_DIRS "../src"
|
||||||
PRIV_REQUIRES unity esp_common test_utils wpa_supplicant mbedtls)
|
PRIV_REQUIRES cmock esp_common test_utils wpa_supplicant mbedtls)
|
||||||
|
|
||||||
idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR)
|
idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR)
|
||||||
|
|
||||||
|
@ -304,5 +304,26 @@ of time spent on waiting for code/data in case of a cache miss, then subtract th
|
|||||||
|
|
||||||
|
|
||||||
One limitation of the cache compensated timer is that the task that benchmarked functions should be pinned to a core. This is due to each core having its own event counters that are independent of each other. For example, if ``ccomp_timer_start`` gets called on one core, put to sleep by the scheduler, wakes up, and gets rescheduled on the other core, then the corresponding ``ccomp_timer_stop`` will be invalid.
|
One limitation of the cache compensated timer is that the task that benchmarked functions should be pinned to a core. This is due to each core having its own event counters that are independent of each other. For example, if ``ccomp_timer_start`` gets called on one core, put to sleep by the scheduler, wakes up, and gets rescheduled on the other core, then the corresponding ``ccomp_timer_stop`` will be invalid.
|
||||||
invalid.
|
|
||||||
|
|
||||||
|
Mocks
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
ESP-IDF has a component which integrates the CMock mocking framework.
|
||||||
|
CMock usually uses Unity as a submodule, but due to some Espressif-internal limitations with CI, we still have Unity as an ordinary module in ESP-IDF.
|
||||||
|
To use the IDF-supplied Unity component which isn't a submodule, the build system needs to pass an environment variable ``UNITY_IDR`` to CMock.
|
||||||
|
This variable simply contains the path to the Unity directory in IDF, e.g. ``export "UNITY_DIR=${IDF_PATH}/components/unity/unity"``.
|
||||||
|
Refer to :component_file:`cmock/CMock/lib/cmock_generator.rb` to see how the Unity directory is determined in CMock.
|
||||||
|
|
||||||
|
An example cmake build command to create mocks of a component inside that component's CMakeLists.txt may look like this:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${MOCK_OUTPUT}
|
||||||
|
COMMAND ruby ${CMOCK_DIR}/lib/cmock.rb -o${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_config.yaml ${MOCK_HEADERS}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env "UNITY_DIR=${IDF_PATH}/components/unity/unity" ruby ${CMOCK_DIR}/lib/cmock.rb -o${CMAKE_CURRENT_SOURCE_DIR}/mock/mock_config.yaml ${MOCK_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
${MOCK_OUTPUT} contains all CMock generated output files, ${MOCK_HEADERS} contains all headers to be mocked and ${CMOCK_DIR} needs to be set to CMock directory inside IDF. ${CMAKE_COMMAND} is automatically set.
|
||||||
|
|
||||||
|
Refer to :component_file:`cmock/CMock/docs/CMock_Summary.md` for more details on how CMock works and how to create and use mocks.
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS .
|
PRIV_INCLUDE_DIRS .
|
||||||
PRIV_REQUIRES unity test_utils experimental_cpp_component)
|
PRIV_REQUIRES cmock test_utils experimental_cpp_component)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
REQUIRES unity testable)
|
REQUIRES cmock testable)
|
||||||
|
@ -85,6 +85,9 @@ components/unity/unity/src/unity_internals.h
|
|||||||
components/unity/include/unity_config.h
|
components/unity/include/unity_config.h
|
||||||
components/unity/include/unity_test_runner.h
|
components/unity/include/unity_test_runner.h
|
||||||
|
|
||||||
|
components/cmock/CMock/src/cmock.h
|
||||||
|
components/cmock/CMock/src/cmock_internals.h
|
||||||
|
|
||||||
### Here are the files that do not compile for some reason
|
### Here are the files that do not compile for some reason
|
||||||
#
|
#
|
||||||
components/app_trace/include/esp_sysview_trace.h
|
components/app_trace/include/esp_sysview_trace.h
|
||||||
|
@ -45,7 +45,7 @@ ignore_files = ['components/mdns/test_afl_fuzz_host/esp32_compat.h', # us
|
|||||||
]
|
]
|
||||||
|
|
||||||
# add directories here which should not be parsed
|
# add directories here which should not be parsed
|
||||||
ignore_dirs = ('examples')
|
ignore_dirs = ('examples', 'components/cmock/CMock/test')
|
||||||
|
|
||||||
# macros from here have higher priorities in case of collisions
|
# macros from here have higher priorities in case of collisions
|
||||||
priority_headers = ['components/esp_common/include/esp_err.h']
|
priority_headers = ['components/esp_common/include/esp_err.h']
|
||||||
|
@ -5,7 +5,7 @@ idf_component_register(SRCS "ccomp_timer.c"
|
|||||||
"ccomp_timer_impl.c"
|
"ccomp_timer_impl.c"
|
||||||
INCLUDE_DIRS include
|
INCLUDE_DIRS include
|
||||||
PRIV_INCLUDE_DIRS private_include
|
PRIV_INCLUDE_DIRS private_include
|
||||||
REQUIRES spi_flash idf_test unity
|
REQUIRES spi_flash idf_test cmock
|
||||||
PRIV_REQUIRES perfmon esp_ipc)
|
PRIV_REQUIRES perfmon esp_ipc)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRC_DIRS "."
|
idf_component_register(SRC_DIRS "."
|
||||||
PRIV_INCLUDE_DIRS "."
|
PRIV_INCLUDE_DIRS "."
|
||||||
PRIV_REQUIRES unity test_utils perfmon esp_ipc)
|
PRIV_REQUIRES cmock test_utils perfmon esp_ipc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user