简体   繁体   中英

How to perform code coverage in C++ using meson?

I'm using meson and ninja as build system in my C++ project and I've configured catch2 as testing framework. I was wondering how to perform code coverage with the tests that I've written. I read this page, https://mesonbuild.com/Unit-tests.html but seems pretty unclear to me, can anybody help?

You should use one of coverage related targets: coverage-text , coverage-html , coverage-xml as described here . Or just coverage that tries all of these if possible:

$ ninja coverage -C builddir

Results are written to ./builddir/meson-logs directory.

Note that to produce html coverage reports you need lcov and genhtml binaries which are installed by lcov package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM