[apparmor] [patch 7/8] parser - add build option for coverage
Seth Arnold
seth.arnold at canonical.com
Thu Nov 28 02:10:43 UTC 2013
On Wed, Oct 23, 2013 at 06:41:51PM -0700, Steve Beattie wrote:
> This patch adds a parser make variable and a make target for building
> the compiler with coverage compilation flags. With this, coverage
> information can be generated by running tests/test suites against the
> built parser and run through tools like gcovr.
Very cool, several small comments inline:
> Patch History:
> v1: initial version
> v2: refreshed/no change
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
> ---
> parser/Makefile | 8 +++++++-
> parser/libapparmor_re/Makefile | 2 +-
> parser/tst/Makefile | 1 +
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> Index: b/parser/Makefile
> ===================================================================
> --- a/parser/Makefile
> +++ b/parser/Makefile
> @@ -51,6 +51,9 @@ CFLAGS = -g -O2 -pipe
> ifdef DEBUG
> CFLAGS += -pg -D DEBUG
> endif
> +ifdef COVERAGE
> +CFLAGS = -g -pg -fprofile-arcs -ftest-coverage
> +endif
> endif #CFLAGS
We've got CFLAGS += and CFLAGS = in these now -- should we change them all
to CFLAGS = just for being bluntly verbose?
> LIBAPPARMOR_PATH=../libraries/libapparmor/src/
> @@ -148,6 +151,8 @@ indep: docs
>
> all: arch indep
>
> +coverage:
> + $(MAKE) clean apparmor_parser COVERAGE=1
>
> apparmor_parser: $(OBJECTS) $(AAREOBJECTS)
> $(CXX) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $(OBJECTS) $(LIBS) \
> @@ -301,7 +306,8 @@ install-indep:
> .SILENT: clean
> .PHONY: clean
coverage should be added to .PHONY:
> clean: _clean
> - rm -f core core.* *.o *.s *.a *~
> + rm -f core core.* *.o *.s *.a *~ *.gcda *gcno
Missing . in *gcno
> + rm -f gmon.out
> rm -f $(TOOLS) $(TESTS)
> rm -f $(LEX_C_FILES)
> rm -f $(YACC_C_FILES)
> Index: b/parser/libapparmor_re/Makefile
> ===================================================================
> --- a/parser/libapparmor_re/Makefile
> +++ b/parser/libapparmor_re/Makefile
> @@ -29,4 +29,4 @@ parse.cc : parse.y parse.h flex-tables.h
> ${BISON} -o $@ $<
>
> clean:
> - rm -f *.o parse.cc ${TARGET}
> + rm -f *.o parse.cc ${TARGET} *.gcno *.gcda
This is a different order than the one above, it's nit-picking to ask for
them to be in the same order, but that'd satisfy the OCD bit of my brain :)
> Index: b/parser/tst/Makefile
> ===================================================================
> --- a/parser/tst/Makefile
> +++ b/parser/tst/Makefile
> @@ -56,3 +56,4 @@ $(PARSER):
>
> clean:
> find $(GEN_TRANS_DIRS) -type f | xargs rm -f
> + rm -f gmon.out
>
>
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20131127/6fd00654/attachment.pgp>
More information about the AppArmor
mailing list