From 4e6f7e16c31f398828fcd417b45ea6c722f74198 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 20 Jan 2015 17:39:27 -0800 Subject: Document how to run gcov on ninja. --- HACKING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/HACKING.md b/HACKING.md index 059a424..e3940ff 100644 --- a/HACKING.md +++ b/HACKING.md @@ -161,3 +161,19 @@ The trick is to install just the compilers, and not all of Visual Studio, by following [these instructions][win7sdk]. [win7sdk]: http://www.kegel.com/wine/cl-howto-win7sdk.html + +### Using gcov + +Do a clean debug build with the right flags: + + CFLAGS=-coverage LDFLAGS=-coverage ./configure.py --debug + ninja -t clean ninja_test && ninja ninja_test + +Run the test binary to generate `.gcda` and `.gcno` files in the build +directory, then run gcov on the .o files to generate `.gcov` files in the +root directory: + + ./ninja_test + gcov build/*.o + +Look at the generated `.gcov` files directly, or use your favorit gcov viewer. -- cgit v0.12