Unit testing, on the host (gcc x86_64)

MindReader32
Posts: 25
Joined: Mon May 14, 2018 8:33 am

Unit testing, on the host (gcc x86_64)

Postby MindReader32 » Thu Apr 11, 2019 7:11 pm

Hi,

I want to use the unit testing framework that comes with IDF on code that is not ESP32 specific and for expedience I want to run it on my dev machine, and not any ESP32 Device Under Test (DUT)

Has anyone got any tips or pointers on how todo that using the existing tools and component conventions provided with the IDF?

Thanks in advance!

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: Unit testing, on the host (gcc x86_64)

Postby phatpaul » Thu Jul 18, 2024 7:52 pm

I am also interested in running unit tests on a host machine (via GitLab CI).

Ideally, it would automatically use the same unit tests that I have written for my components in /components/mycmp/test/test_mycmp.c, just
like the Unit Test App does.
And if some tests are not appropriate for running on the host, there should be a way to skip them with this test runner.

Ideally it would compile the tests for the host machine to run natively. But I saw that running in qemu is also an option, which is super cool and was easy to try thanks to the provided dockers. The qemu option is described here, but I don't see how to get the test results parsed by the CI.
A related question on SO.

I found these references for host-based testing, but they seem to require your tests to be separated between host_test and target tests.

release-v5.2/esp32/api-guides/host-apps.html

release-v4.4/esp32/api-guides/linux-host-testing.html

It would be great to see a full working example of a trivial project with unit testing working with CI on a host.

Who is online

Users browsing this forum: No registered users and 87 guests