catchorg / catchorg/Catch2

Possible? Run on embedded system using gdb function calls

Open
#977 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

Hi,
I'm coming from an embedded background and have just decided to start using unit tests for my development and found that catch is really nice (easy to use!).

I'm using STM32 mcus and program them in C/C++ using eclipse with gnuarm plugin.
So far, the consensus for embedded unit testing seems to be that there are two options to do it:
1. test only hardware independent code on development pc
2. use QEMU or similar for hardware simulation

I wonder whether it would be possible to do unit testing of the actual code running on the mcu by using gdb to call the functions under test?
I've just done a quick proof of concept experiment and it seems to work:
http://imgur.com/a/0nm7W

I've basically created a simple function and called it using varying parameters during a debug. I think it should be possible to automate it and implement it into an existing framework.
The process could be:
- use no optimization so no unused code gets deleted during compilation
- halt cpu at known point after HW init
- then run all tests from host PC, call all functions and check all returns and variable contents using gdb

Result:
- No code overhead on mcu
- code under test is compiled for and running on target hw

I'd be interested in an opinion about this. Where would I have to look in catch if I wanted to reroute all function calls to gdb? Or is there something I'm missing?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.