Replies: 1 comment
-
Have you considered stubbing out the driver instead? We have several in-tree simulators (see e.g. https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/flash/flash_simulator.c) for this exact purpose. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on some unit testing for my project and have run into some issues when trying to mock syscalls, I was wondering if anyone has any advice on a good approach for such a scenario. I am able to successfully mock calls to external libs, and mock out other parts of my application, but am having problems mocking zephyr calls.
In my situation I have the main app project which include the source files I would like to unit test (libapp.a). Within that, I have a file which makes use of the syscall
device_get_binding
. I target this file in my unit test and try to declare a mock fordevice_get_binding
(Have tried different methods, but currently using fff.h). The issue is that I just get linker errors due to duplicate definitions ofdevice_get_binding
.I guess the root of my issue is that I don't see how I can avoid linking in the actual zephyr syscall impls instead of the mocked version in my test project. Any advice would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions