cmake targets `loop()` in fake, rather than sourcefile under test

19 views
Skip to first unread message

Allan Gray

unread,
Mar 29, 2024, 11:30:56 AM3/29/24
to cpputest

Good evening,

As per this previous thread,  I have been trying to adapt this wiring-blink example to Cpputest.

I made a bit more progress in my attempt to incorporate ArduinoFake into an example project using CppUTest:
https://github.com/graial/ArduinoFake-cpputest

But currently my cmakelist.txt is failing to target the main `loop()` function in the source file under test.  Instead, from what I can tell, it is searching for it within ArduinoFake.

This results in the call to `loop()` is triggering fakeit::UnexpectedMethodCallException in (presumably from ArduinoFake), rather than the loop() in blink.cpp, which I am trying to test.

Alternatively, if I try to just link the blink.o object, I get a redefinition error.

and if I remove ArduinoFake from `target_link_libraries()` then I get undefined reference to errors on the Arduino system calls.

Is there a way to get cmake to look for loop() in the source file? rather than in ArduinoFake?

I'd appreciate any insights anyone here might have and I've asked a similar question to the ArduinoFake Maintainer..

Cheers

Reply all
Reply to author
Forward
0 new messages