Issue with multiple stages test cases

rappscallion
Posts: 2
Joined: Tue Oct 30, 2018 11:28 am

Issue with multiple stages test cases

Postby rappscallion » Fri Oct 25, 2019 11:14 am

Hello,
first: thanks so much for the advances in unit testing, last time I tried it, it seemed pretty complicated, that works better now :-)
Next I would like to add "multiple stages test cases" i.e. communication between boards to my projects and I ran into a couple of issues there.
I follow this documentation
Unfortunately there are no examples available for the multi stage and multi device test cases. As soon as I get it working I suggest and like to help with providing examples for that. The normal test case works fine and is easy to follow as there exists an example (although not linked to in the documentation. This is probably not intended?)

====================================================
Multiple devices:
If I copy the example code into a working testing application, the "unity_send_signal" function cannot be found.
As I see it, it is located under tools/unit-test-app/compontents/test_utils.h and is used by other test cases within the esp-idf - for example "components/driver/test/test_i2c.c" which include "test_utils.h" in the c file and have test_utils in the CMakeLists.txt.
Adding test_utils into my CMakeLists does however not work, probably it looks only in the components folder? If I copy the test_utils to the components the building works, however as soon as I use one of the functions "unity_wait_for_signal" or "unity_send_signal" something seems to stop working and unrelated tests which previously passed, now fail with "Expected Non-NULL"

What am I doing wrong here? Is it the wrong linking or an issue in using the library?
====================================================
Making the multi stage code run:
ok, this one is not too hard, but I headed in the wrong direction first in changing the reset lookup to the more familiar esp_reset_reason() from esp_system.h. (which of course then also works).
Would it distract too much to include the required headers to the code snippet or provide a standalone example?
While these fixes sound trivial, it took me quite some while to find out what's missing.
====================================================
There are a few other issues on the documentation page:
- "this requirement is relaxed and the use of COMPONENT_SRCDIRS is advised."
-> probably SRC_DIRS is the right cmake variable to be used here?

- the gpio pin config gets shifted in that way: "1 << gpio_no". This produces a compiler warning and I have seen this done as "1ULL << gpio_no" in other places. Should this be changed?

I will happily update the documentation, set up an example or something else, but don't dare that without some opinions :-)
Hope to hear from somebody to get the unit tests up and running :-)
Thanks!

Who is online

Users browsing this forum: Baidu [Spider], Matthias199 and 124 guests