Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to override managed component with mock (PACMAN-594) #23

Open
1 task done
ljden opened this issue Feb 7, 2023 · 1 comment
Open
1 task done

Unable to override managed component with mock (PACMAN-594) #23

ljden opened this issue Feb 7, 2023 · 1 comment
Assignees
Labels
Status: Test needed Issue needs to be tested Type: Bug 🐛 Something isn't working
Milestone

Comments

@ljden
Copy link

ljden commented Feb 7, 2023

The Component Manager version

v1.1.4

ESP-IDF Version

v5.0

python Version

3.10.6

Operating System

Linux

Browser (for https://components.espressif.com Issues)

No response

Description

Having issues building a host test for a component that uses the component manager to manage a dependency, that then also needs to mock said dependency for the host test.

-- building ESP EVENT MOCKS
-- building FREERTOS MOCKS (only task, event-groups and queue)
-- building esp-idf-cxx MOCKS (I2C only)
CMake Error at /home/vbox/esp/esp-idf/tools/cmake/component.cmake:249 (message):
  ERROR: Cannot process component requirements.  Multiple candidates to
  satisfy project requirements:

    requirement: "esp-idf-cxx" candidates: "esp-idf-cxx, espressif__esp-idf-cxx"

Call Stack (most recent call first):
  /home/vbox/esp/esp-idf/tools/cmake/build.cmake:553 (__component_get_requirements)
  /home/vbox/esp/esp-idf/tools/cmake/project.cmake:440 (idf_build_process)
  CMakeLists.txt:15 (project)

See espressif/esp-idf#10599 (comment) for more details

To Reproduce

vbox@vbox:~/comp/host_test$ cat comp/host_test/CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(COMPONENTS main)

idf_build_set_property(COMPILE_DEFINITIONS "-DconfigTICK_RATE_HZ=1000" APPEND)

list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/esp_event/")
...
list(APPEND EXTRA_COMPONENT_DIRS "./mock_comps/mocks/esp-idf-cxx")

project(sensor_manager_host_test)
vbox@vbox:~/comp/host_test$ cat main/CMakeLists.txt
idf_component_register(SRCS "test_comp.cpp"
    WHOLE_ARCHIVE
    PRIV_REQUIRES comp cmock
    )

find_package(Catch2 3 REQUIRED)
find_package(trompeloeil REQUIRED)

target_link_libraries(${COMPONENT_LIB}
  PRIVATE
  Catch2::Catch2WithMain
  trompeloeil::trompeloeil
  )
vbox@vbox:~/comp/host_test$ cat main/idf_component.yml
dependencies:
  idf: "5.0.*"
  comp:
    path: "../../"
vbox@vbox:~/comp/host_test$ cat ../idf_component.yml
version: "0.0.1"
description: component
dependencies:
  idf: "5.0.*"
  espressif/esp-idf-cxx: "~1.0.0-beta"
...
vbox@vbox:~/sensor_manager/host_test$ tree mock_comps/
mock_comps/
└── mocks
    ├── esp-idf-cxx
    │   ├── CMakeLists.txt
    │   └── include
    │       └── i2c_cxx.hpp
    └── README.md
vbox@vbox:~/comp/host_test$ rm -rf dependencies.lock managed_components/ sdkconfig build/ && idf.py build
...
-- building ESP EVENT MOCKS
-- building FREERTOS MOCKS (only task, event-groups and queue)
-- building esp-idf-cxx MOCKS (I2C only)
CMake Error at /home/vbox/esp/esp-idf/tools/cmake/component.cmake:249 (message):
  ERROR: Cannot process component requirements.  Multiple candidates to
  satisfy project requirements:

    requirement: "esp-idf-cxx" candidates: "espressif__esp-idf-cxx, esp-idf-cxx"

Call Stack (most recent call first):
  /home/vbox/esp/esp-idf/tools/cmake/build.cmake:553 (__component_get_requirements)
  /home/vbox/esp/esp-idf/tools/cmake/project.cmake:440 (idf_build_process)
  CMakeLists.txt:15 (project)

Expected behaviour

Able to mock a component that is managed by idf_component.yml

Additional info

No response

I have checked existing issues and online Documentation

  • I confirm I have checked existing issues and online Documentation.
@ljden ljden added the Status: Awaiting triage Issue is waiting for triage label Feb 7, 2023
@github-actions github-actions bot changed the title Unable to override managed component with mock Unable to override managed component with mock (PACMAN-594) Feb 7, 2023
@kumekay kumekay added Type: Bug 🐛 Something isn't working and removed Status: Awaiting triage Issue is waiting for triage labels Feb 8, 2023
@kumekay
Copy link
Collaborator

kumekay commented Feb 8, 2023

@ljden, thank you for reporting the issue.

The mocking support and component manager were developed independently, and we will investigate the issue to find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Test needed Issue needs to be tested Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants