Autocall lcov autostart after "make check"

I have successfully created an autotools project where tests are compiled using a toolkit, so I can get a test report.

I can get the report by running lcov in the source directory after a successful "make check".

Now I am facing the problem that I want to automate this step. I would like to add this to the "make check" or make it a separate goal of "check-cover". Ideally, I would like to analyze the result and fail if coverage falls below a certain percentage. The problem is that I cannot figure out how to add a custom target at all.

The closest I found is to find this autotools configuration example, but I donโ€™t see where in this project the goal of โ€œmake lcovโ€ has been added. I can only see some configure flags in m4 / auxdevel.m4.

Any tips?

+4
source share
1 answer

Apparently, you can just add extra steps to the goals in your Makefile.am, this is what I got (inspired by #http: //www.enlightenment.org/svn/e/trunk/ewl/Makefile.am):

#http://www.enlightenment.org/svn/e/trunk/ewl/Makefile.am if ENABLE_COV cov-reset: @rm -fr coverage @find . -name "*.gcda" -exec rm {} \; @lcov --directory . --zerocounters cov-report: @mkdir -p coverage @lcov --compat-libtool --directory . --capture --output-file coverage/app.info @genhtml -o coverage/ coverage/app.info cov: @make cov-report clean-local: @make cov-reset check: @make cov endif 

"@make cov" under control will add the "cov" target to the default "make check" target.

+6
source

Source: https://habr.com/ru/post/1310339/


All Articles