Dear Márton,
Am Sonntag, den 22.04.2012, 08:38 +0200 schrieb Németh Márton: > From: Márton Németh <[email protected]> I would change the commit summary to the following. build: add instructions for GCC’s code coverage feature But I am not too sure about the terminology. > Signed-off-by: Márton Németh <[email protected]> > --- > diff --git a/Makefile b/Makefile > index 22096dc..073843c 100644 > --- a/Makefile > +++ b/Makefile > @@ -4,6 +4,7 @@ VERSION := 1.98 > > CXXFLAGS ?= -O2 -g -fno-omit-frame-pointer -fstack-protector > CXXFLAGS += -Wall -Wshadow -Wformat > +#CXXFLAGS += --coverage > CPPFLAGS += -D_FORTIFY_SOURCE=2 > PKG_CONFIG ?= pkg-config > > diff --git a/README b/README > index c44f56c..e03e568 100644 > --- a/README > +++ b/README > @@ -109,3 +109,26 @@ powertop --extech=/dev/ttyUSB0 > (where ttyUSB0 is the devicenode of the serial-to-usb adapter on my system) > > > +Creating code coverage report for powertop > +------------------------------------------ > +Code coverage is a method to find out which part of the code was executed and > +which was not executed. The gcc compiler supports creating such measurements Has that feature always been there or is a certain GCC version needed? > +on the code by instrumenting the code at compile time when the "--coverage" > +option is given. You can enable this for powertop in the top level Makefile > +by uncommenting the line "CXXFLAGS += --coverage". After this a full > recompile > +is needed. At this point different test cases can be executed on powertop > +binary. Once the testing is ready the tools "lcov" and "genhtml" can be > +used to generate nice HTML report on the code coverage. > + > +# (edit Makefile to enable --coverage option) > +# make clean > +# make > +# (execute test cases for powertop. May contain multiple powertop runs. The > results are accumulated.) > +# lcov --base-directory . --directory . -c -o powertop.info > +# genhtml -o powertop_coverage powertop.info > +# (open powertop_coverage/index.html in a browser) > + > +Note that the code coverage figures are mainly speaking about the quality > +of the testing. It has limitations also, even if you achieve 100% code > coverage > +you won't be detect a missing piece of code (e.g. error handling) only by … you won’t be able … > +watching at the code coverage figures. s,watching,looking, Acked-by: Paul Menzel <[email protected]> Thanks, Paul
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Power mailing list [email protected] https://bughost.org/mailman/listinfo/power
