mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
parser: add build option for coverage (v3)
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. Patch History: v1: initial version v2: refreshed/no change v3: address feedback from sarnold: - mark coverage target as phony - correct missing '.' typo in clean target - make coverage extensions consistent in clean targets Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
parent
dfb4d9a48b
commit
7a42de3eae
@ -51,6 +51,9 @@ CFLAGS = -g -O2 -pipe
|
|||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -pg -D DEBUG
|
CFLAGS += -pg -D DEBUG
|
||||||
endif
|
endif
|
||||||
|
ifdef COVERAGE
|
||||||
|
CFLAGS = -g -pg -fprofile-arcs -ftest-coverage
|
||||||
|
endif
|
||||||
endif #CFLAGS
|
endif #CFLAGS
|
||||||
|
|
||||||
LIBAPPARMOR_PATH=../libraries/libapparmor/src/
|
LIBAPPARMOR_PATH=../libraries/libapparmor/src/
|
||||||
@ -149,6 +152,9 @@ indep: docs
|
|||||||
|
|
||||||
all: arch indep
|
all: arch indep
|
||||||
|
|
||||||
|
.PHONY: coverage
|
||||||
|
coverage:
|
||||||
|
$(MAKE) clean apparmor_parser COVERAGE=1
|
||||||
|
|
||||||
apparmor_parser: $(OBJECTS) $(AAREOBJECTS)
|
apparmor_parser: $(OBJECTS) $(AAREOBJECTS)
|
||||||
$(CXX) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $(OBJECTS) $(LIBS) \
|
$(CXX) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $(OBJECTS) $(LIBS) \
|
||||||
@ -302,7 +308,8 @@ install-indep:
|
|||||||
.SILENT: clean
|
.SILENT: clean
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: _clean
|
clean: _clean
|
||||||
rm -f core core.* *.o *.s *.a *~
|
rm -f core core.* *.o *.s *.a *~ *.gcda *.gcno
|
||||||
|
rm -f gmon.out
|
||||||
rm -f $(TOOLS) $(TESTS)
|
rm -f $(TOOLS) $(TESTS)
|
||||||
rm -f $(LEX_C_FILES)
|
rm -f $(LEX_C_FILES)
|
||||||
rm -f $(YACC_C_FILES)
|
rm -f $(YACC_C_FILES)
|
||||||
|
@ -29,4 +29,4 @@ parse.cc : parse.y parse.h flex-tables.h ../immunix.h
|
|||||||
${BISON} -o $@ $<
|
${BISON} -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o parse.cc ${TARGET}
|
rm -f *.o parse.cc ${TARGET} *.gcda *.gcno
|
||||||
|
@ -59,3 +59,4 @@ $(PARSER):
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
find $(GEN_TRANS_DIRS) -type f | xargs rm -f
|
find $(GEN_TRANS_DIRS) -type f | xargs rm -f
|
||||||
|
rm -f gmon.out
|
||||||
|
Loading…
x
Reference in New Issue
Block a user