开发者

Autotools automatic invocation of lcov after 'make check'

I have successfully set up an autotools project where the tests compiles with开发者_开发百科 instrumentation so I can get a test coverage report.

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

I now face the problem that I want to automate this step. I would like to add this to 'make check' or to make it a separate goal 'make check-coverage'. Ideally I would like to parse the result and fail if the coverage falls below a certain percentage. Problem is that I cannot figure out how to add a custom target at all.

The closest I got was finding this example autotools config, but I can't see where in that project the goal 'make lcov' is added. I can only see some configure flags in m4/auxdevel.m4.

Any tips?


You can apparently just add extra steps to targets in your Makefile.am, this is what I ended up with (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    

The '@make cov' under check will add the 'cov' target to the default 'make check' target.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜