From 88eb4fa6a6d042817c9a5d8946da6a69014f2add Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Tue, 10 Aug 2021 11:50:15 +0800 Subject: [PATCH] [mocks]: moved mocks dir to tools/ --- .gitlab/CODEOWNERS | 2 ++ components/esp_event/CMakeLists.txt | 2 +- .../esp_event/host_test/esp_event_unit_test/CMakeLists.txt | 2 +- .../experimental_cpp_component/host_test/gpio/CMakeLists.txt | 4 ++-- {mocks => tools/mocks}/README.md | 2 +- {mocks => tools/mocks}/driver/CMakeLists.txt | 0 {mocks => tools/mocks}/driver/mock/mock_config.yaml | 0 .../mocks}/esp_hw_support/include/esp_intr_alloc.h | 0 {mocks => tools/mocks}/esp_system/include/esp_task.h | 0 {mocks => tools/mocks}/freertos/CMakeLists.txt | 0 {mocks => tools/mocks}/freertos/Kconfig | 0 {mocks => tools/mocks}/freertos/mock/mock_config.yaml | 0 {mocks => tools/mocks}/hal/include/hal/gpio_types.h | 0 {mocks => tools/mocks}/hal/include/hal/spi_types.h | 0 14 files changed, 7 insertions(+), 5 deletions(-) rename {mocks => tools/mocks}/README.md (60%) rename {mocks => tools/mocks}/driver/CMakeLists.txt (100%) rename {mocks => tools/mocks}/driver/mock/mock_config.yaml (100%) rename {mocks => tools/mocks}/esp_hw_support/include/esp_intr_alloc.h (100%) rename {mocks => tools/mocks}/esp_system/include/esp_task.h (100%) rename {mocks => tools/mocks}/freertos/CMakeLists.txt (100%) rename {mocks => tools/mocks}/freertos/Kconfig (100%) rename {mocks => tools/mocks}/freertos/mock/mock_config.yaml (100%) rename {mocks => tools/mocks}/hal/include/hal/gpio_types.h (100%) rename {mocks => tools/mocks}/hal/include/hal/spi_types.h (100%) diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index f0fd4d6a81..123538a09b 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -66,6 +66,7 @@ /components/bootloader*/ @esp-idf-codeowners/system @esp-idf-codeowners/security /components/bt/ @esp-idf-codeowners/bluetooth /components/cbor/ @esp-idf-codeowners/app-utilities +/components/cmock/ @esp-idf-codeowners/system /components/coap/ @esp-idf-codeowners/app-utilities /components/console/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities /components/cxx/ @esp-idf-codeowners/system @@ -183,6 +184,7 @@ /tools/kconfig*/ @esp-idf-codeowners/build-config /tools/ldgen/ @esp-idf-codeowners/build-config /tools/mass_mfg/ @esp-idf-codeowners/app-utilities +/tools/mocks/ @esp-idf-codeowners/system ## Note: owners here should be the same as the owners for the same example subdir, above /tools/test_apps/build_system/ @esp-idf-codeowners/build-config diff --git a/components/esp_event/CMakeLists.txt b/components/esp_event/CMakeLists.txt index c93a52a74a..c8cb9f92a6 100644 --- a/components/esp_event/CMakeLists.txt +++ b/components/esp_event/CMakeLists.txt @@ -9,7 +9,7 @@ set(srcs "default_event_loop.c" if(${target} STREQUAL "linux") list(APPEND requires "linux") # Temporary fix until esp_system is available for linux, too - list(APPEND priv_include_dirs "$ENV{IDF_PATH}/mocks/esp_system/include") + list(APPEND priv_include_dirs "$ENV{IDF_PATH}/tools/mocks/esp_system/include") else() list(APPEND requires "esp_netif") list(APPEND srcs "event_loop_legacy.c" "event_send.c") diff --git a/components/esp_event/host_test/esp_event_unit_test/CMakeLists.txt b/components/esp_event/host_test/esp_event_unit_test/CMakeLists.txt index 1cc112f31f..415e0d64ca 100644 --- a/components/esp_event/host_test/esp_event_unit_test/CMakeLists.txt +++ b/components/esp_event/host_test/esp_event_unit_test/CMakeLists.txt @@ -4,5 +4,5 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(COMPONENTS main) idf_build_set_property(COMPILE_DEFINITIONS "-DNO_DEBUG_STORAGE" APPEND) -list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/mocks/freertos/") +list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/") project(test_esp_event_host) diff --git a/examples/cxx/experimental/experimental_cpp_component/host_test/gpio/CMakeLists.txt b/examples/cxx/experimental/experimental_cpp_component/host_test/gpio/CMakeLists.txt index beee51b886..b84d7eadbb 100644 --- a/examples/cxx/experimental/experimental_cpp_component/host_test/gpio/CMakeLists.txt +++ b/examples/cxx/experimental/experimental_cpp_component/host_test/gpio/CMakeLists.txt @@ -6,8 +6,8 @@ set(COMPONENTS main) idf_build_set_property(COMPILE_DEFINITIONS "-DNO_DEBUG_STORAGE" APPEND) # Overriding components which should be mocked -list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/mocks/driver/") -list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/mocks/freertos/") +list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/driver/") +list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/") # Including experimental component here because it's outside IDF's main component directory list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/") diff --git a/mocks/README.md b/tools/mocks/README.md similarity index 60% rename from mocks/README.md rename to tools/mocks/README.md index 4e03dc08a3..1a466bf851 100644 --- a/mocks/README.md +++ b/tools/mocks/README.md @@ -1,5 +1,5 @@ # Mocked Components -All components in this directory mock their respective originals in the [component directory](../components). The components in this directory are for **testing only**. Currently, the main goal is to implement Linux-based host tests with these mocking components. Target-based tests using the mocking components are not possible now but may be possible in the future. +All components in this directory mock their respective originals in the [component directory](../../components). The components in this directory are for **testing only**. Currently, the main goal is to implement Linux-based host tests with these mocking components. Target-based tests using the mocking components are not possible now but may be possible in the future. Some components only consist of header files without any CMakeLists.txt file. The headers in these are currently needed by other mocking components to satisfy a minimal set of definitions from dependencies. *They are not a full mock implementation.* These components with header files only may be replaced by an actual mock implementation of the corresponding component in the future. diff --git a/mocks/driver/CMakeLists.txt b/tools/mocks/driver/CMakeLists.txt similarity index 100% rename from mocks/driver/CMakeLists.txt rename to tools/mocks/driver/CMakeLists.txt diff --git a/mocks/driver/mock/mock_config.yaml b/tools/mocks/driver/mock/mock_config.yaml similarity index 100% rename from mocks/driver/mock/mock_config.yaml rename to tools/mocks/driver/mock/mock_config.yaml diff --git a/mocks/esp_hw_support/include/esp_intr_alloc.h b/tools/mocks/esp_hw_support/include/esp_intr_alloc.h similarity index 100% rename from mocks/esp_hw_support/include/esp_intr_alloc.h rename to tools/mocks/esp_hw_support/include/esp_intr_alloc.h diff --git a/mocks/esp_system/include/esp_task.h b/tools/mocks/esp_system/include/esp_task.h similarity index 100% rename from mocks/esp_system/include/esp_task.h rename to tools/mocks/esp_system/include/esp_task.h diff --git a/mocks/freertos/CMakeLists.txt b/tools/mocks/freertos/CMakeLists.txt similarity index 100% rename from mocks/freertos/CMakeLists.txt rename to tools/mocks/freertos/CMakeLists.txt diff --git a/mocks/freertos/Kconfig b/tools/mocks/freertos/Kconfig similarity index 100% rename from mocks/freertos/Kconfig rename to tools/mocks/freertos/Kconfig diff --git a/mocks/freertos/mock/mock_config.yaml b/tools/mocks/freertos/mock/mock_config.yaml similarity index 100% rename from mocks/freertos/mock/mock_config.yaml rename to tools/mocks/freertos/mock/mock_config.yaml diff --git a/mocks/hal/include/hal/gpio_types.h b/tools/mocks/hal/include/hal/gpio_types.h similarity index 100% rename from mocks/hal/include/hal/gpio_types.h rename to tools/mocks/hal/include/hal/gpio_types.h diff --git a/mocks/hal/include/hal/spi_types.h b/tools/mocks/hal/include/hal/spi_types.h similarity index 100% rename from mocks/hal/include/hal/spi_types.h rename to tools/mocks/hal/include/hal/spi_types.h