I am trying to do things right: user components and tests
I am running however into a few issue and I have questions.
First of all, as there is for 'apps', is there a template repo that could be cloned for components?
I realized a few things that may help other, please comment if I am mistaken:
- you should write your components inside $IDF_PATH/components, other path won´t work
- ensure you have
Code: Select all
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archiveCode: Select all
comp/test/component.mkCode: Select all
$IDF_PATH/tools/unit-test-appCode: Select all
make TESTS_ALL=1 Code: Select all
make TEST_COMPONENTS='myComp' Here are the issues I ran into. For the following, let´s assume my components is called myComp and located in
Code: Select all
$IDF_PATH/components/myCompCode: Select all
$IDF_PATH/tools/unit-test-appCode: Select all
make TESTS_ALL=1Code: Select all
make TEST_COMPONENTS='myComp'Code: Select all
make TEST_COMPONENTS='I surely don't exist'Code: Select all
make clean && make TEST_COMPONENTS='myComp' && make flashAfter that I tried introducing a typo in my components´ code.
Code: Select all
make TEST_COMPONENTS='myComp'Code: Select all
make clean && make TEST_COMPONENTS='myComp' Code: Select all
make TESTS_ALL=1A typo in the tests is caught properly however.
Disclaimer: I admit my C knowledge being rusty (no pun intended)