Flo
Flo
Using Google Test for C-Code and mocking C-Modules
I currently face a situation where I have to use Google Test for C-Code. So I am not really able to use gmock to mock C-modules. What I want to do instead is use the CMake build system to choose mocked modules when needed. I want to accomplish that if possible by telling the build system to first search for includes/header files in lets say "path/to/mock/include" and if the regarding header file cant be found there I want it to choose the header file from the "normal" production code path like "path/to/production/include". That I want to do for every target I define. A target will be the test suite for a specific C-module. Normally that should be possible like this: Why do I want to mock? Some of the modules my module under test includes are hardware dependent.
target_include_directories(TARGET "path/to/mock/include")
target_include_directories(TARGET "path/to/production/include")
target_include_directories(TARGET "path/to/mock/include")
target_include_directories(TARGET "path/to/production/include")
You first show cmake the path to the header files of the mocked modules and then to production includes. And that order should also be the order in which the header files are searched for. But somehow I cant get this to work. It seems like the build system ignores the mocked modules and only wants to use the "real" ones. Do you all have some hints about what could be going wrong? Am I missing something? Is there an other/better way to achieve this? Thank you all in advance! Flo
15 replies
STM32 firmware extraction for read out protected devices
Found an interesting article while searching for methods for STM32 firmware extraction. I think its worth to glance through it! https://www.aisec.fraunhofer.de/en/FirmwareProtection.html
4 replies