ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects

Home Page:http://throwtheswitch.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include code file instead of header for file under test

dwijtsma opened this issue · comments

When I include the header file of the file I want to unit test, everything is fine.
When I include the code file of the file I want to unit test, the .gcda and .gcno and .o file are missing from build/gcov/out.

In the command line I get instead of the coverage:

---------------------------
GCOV: CODE COVERAGE SUMMARY
---------------------------
build/gcov/out/main.gcno:cannot open notes file
build/gcov/out/main.gcda:cannot open data file, assuming not executed

I also attached two ceedling projects, so it is easy to reproduce:
ceedling tests.zip

I run WSL on Windows 10:
Python 3.8.10
ruby 2.7.0p0

Ceedling:: 0.31.1
Unity:: 2.5.4
CMock:: 2.5.4
CException:: 1.3.3

I hope this can be resolved or if someone can help me to make it work.

Why are you including the source file in the test?

Including the code file instead gives the possibility to test the internals, which is something I sometimes like to do.

Next to that we have already a lot of unit tests written in the past. We use CMock, Unity and GCOV. A good amount of those tests include the c file. I would like to get rid of the scripts we use to automate that all.

I love the work that has been put into Ceedling. 😃

I agree with the argument to include the .c file. However this was posted as an "issue" that ceedling could not find the source file to be tested. The solution is TEST_FILE which is not really documented.