The core lvgl code seems to have no unit tests.
Does the team have any opinion about adding tests and the preferred way to add and run them?
Would they be open to a PR to add this?
I am just talking about basic unit function tests.
Nothing about UI or automation testing.
I’ve just added an “ASSERT system” to the object’s API functions. You can configure LittlevGL to check a few things about the objects in run time. Config options Example usage
Regarding the unit test, what do you think, which units should be tested?
At some point, we would like to add CI to prevent build breakage. I don’t think there is any objection to unit tests in the meantime. Feel free to open a PR so we can discuss.
At some point, we would like to add CI to prevent build breakage. I don’t think there is any objection to unit tests in the meantime. Feel free to open a PR so we can discuss.
Being new to MCUs, my main concern is not knowing yet if there is already a mechanism to easily run tests in an emulator/simulator/container and get pass/fail results.
Thus the request for a discussion here before anything is coded for a PR.
Perhaps first step would be to document [or find where it is already documented] whatever testing is currently feasible.
Provided that there is a logical definition for pass/fail, the most primitive way do it is probably to modify the PC simulator to print out OK if a test passes, and have a script that runs various builds of the PC simulator and checks that OK is printed for each one.
Of course, I have never worked with any unit testing framework before, so I’m sure there’s a much better way of doing it.
I was an SDET for 10+ years (at Microsoft, Google, and Motorola), so I have a bit of desktop experience, especially w/ xUnit types of test frameworks, but how this can be applied to MCUs is all new to me. I default to ASSuMEing that folks magnitudes smarter than I solved this years ago and have open sourced it!
I use PIO to run tests in CI. It uses built-in Unity testing lib. In latest pio beta they added some simple static analyzers call, but no yet coverage reporter call (i guess, can be added manually via platformio.ini). https://github.com/puzrin/dispenser/blob/dev/.travis.yml
As been noted above, usually you don’t need run most of tests on bare metal. Almost everything can be tested on PC with appropriate mocks.
Yes, I have used Travis and Jenkins a ton, mostly in the area of Android and iOS build and test, and not with micro/embedded code.
My main issue right now is getting a usable simulator working on my main work machine which is a Mac.
I have Windows PCs at home that I can work on, but most of my development is on Mac, so getting that to work would be preferred.
Obviously getting a Travis OS image booted and used is irrelevant to my getting an environment running on my Mac, but psychologically/motivationally I would like to get the latter working first before I start volunteering to get Travis CI tests up and running.
Which one?
I am a bit discouraged to do this on a Mac due to:
https://github.com/littlevgl/pc_simulator_sdl_visual_studio
“This is a pre-configured Visual Studio project to try LittlevGL on a Windows PC. The project uses the SDL library which is copied and linked to the project, so you can compile it without any extra dependencies. The 64 bit libraries are used so it will work out-of-the-box on 64-bit systems.”