Add make lcov-html to generate code coverage report
In addition, update build rules to compile object files in the same directory as the source code file if CONFIG_CODE_COVERAGE=y is set to make lcov find the source code files. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
0eff1ab3cb
commit
a4cfb48694
2 changed files with 28 additions and 4 deletions
|
@ -6,8 +6,8 @@ ifndef CFLAGS
|
||||||
CFLAGS = -MMD -O2 -Wall -g
|
CFLAGS = -MMD -O2 -Wall -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -I../src
|
CFLAGS += -I$(abspath ../src)
|
||||||
CFLAGS += -I../src/utils
|
CFLAGS += -I$(abspath ../src/utils)
|
||||||
|
|
||||||
# Uncomment following line and set the path to your kernel tree include
|
# Uncomment following line and set the path to your kernel tree include
|
||||||
# directory if your C library does not include all header files.
|
# directory if your C library does not include all header files.
|
||||||
|
@ -873,9 +873,15 @@ Q=
|
||||||
E=true
|
E=true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_CODE_COVERAGE
|
||||||
|
%.o: %.c
|
||||||
|
@$(E) " CC " $<
|
||||||
|
$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
|
||||||
|
else
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||||
@$(E) " CC " $<
|
@$(E) " CC " $<
|
||||||
|
endif
|
||||||
|
|
||||||
verify_config:
|
verify_config:
|
||||||
@if [ ! -r .config ]; then \
|
@if [ ! -r .config ]; then \
|
||||||
|
@ -944,9 +950,15 @@ hlr_auc_gw: $(HOBJS)
|
||||||
$(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
|
$(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
|
||||||
@$(E) " LD " $@
|
@$(E) " LD " $@
|
||||||
|
|
||||||
|
lcov-html:
|
||||||
|
lcov -c -d .. > lcov.info
|
||||||
|
genhtml lcov.info --output-directory lcov-html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C ../src clean
|
$(MAKE) -C ../src clean
|
||||||
rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
|
rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
|
||||||
rm -f *.d *.gcno *.gcda *.gcov
|
rm -f *.d *.gcno *.gcda *.gcov
|
||||||
|
rm -f lcov.info
|
||||||
|
rm -rf lcov-html
|
||||||
|
|
||||||
-include $(OBJS:%.o=%.d)
|
-include $(OBJS:%.o=%.d)
|
||||||
|
|
|
@ -10,8 +10,8 @@ export LIBDIR ?= /usr/local/lib/
|
||||||
export BINDIR ?= /usr/local/sbin/
|
export BINDIR ?= /usr/local/sbin/
|
||||||
PKG_CONFIG ?= pkg-config
|
PKG_CONFIG ?= pkg-config
|
||||||
|
|
||||||
CFLAGS += -I../src
|
CFLAGS += -I$(abspath ../src)
|
||||||
CFLAGS += -I../src/utils
|
CFLAGS += -I$(abspath ../src/utils)
|
||||||
|
|
||||||
-include .config
|
-include .config
|
||||||
|
|
||||||
|
@ -1622,9 +1622,15 @@ eap_eke.so: ../src/eap_peer/eap_eke.c ../src/eap_common/eap_eke_common.c
|
||||||
$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< \
|
$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< \
|
||||||
-D$(*F:eap_%=eap_peer_%)_register=eap_peer_method_dynamic_init
|
-D$(*F:eap_%=eap_peer_%)_register=eap_peer_method_dynamic_init
|
||||||
|
|
||||||
|
ifdef CONFIG_CODE_COVERAGE
|
||||||
|
%.o: %.c
|
||||||
|
@$(E) " CC " $<
|
||||||
|
$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
|
||||||
|
else
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
$(Q)$(CC) -c -o $@ $(CFLAGS) $<
|
||||||
@$(E) " CC " $<
|
@$(E) " CC " $<
|
||||||
|
endif
|
||||||
|
|
||||||
%.service: %.service.in
|
%.service: %.service.in
|
||||||
sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
|
sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
|
||||||
|
@ -1676,6 +1682,10 @@ FIPSLD=$(FIPSDIR)/bin/fipsld
|
||||||
fips:
|
fips:
|
||||||
$(MAKE) CC=$(FIPSLD) FIPSLD_CC="$(CC)"
|
$(MAKE) CC=$(FIPSLD) FIPSLD_CC="$(CC)"
|
||||||
|
|
||||||
|
lcov-html: wpa_supplicant.gcda
|
||||||
|
lcov -c -d .. > lcov.info
|
||||||
|
genhtml lcov.info --output-directory lcov-html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C ../src clean
|
$(MAKE) -C ../src clean
|
||||||
$(MAKE) -C dbus clean
|
$(MAKE) -C dbus clean
|
||||||
|
@ -1683,5 +1693,7 @@ clean:
|
||||||
rm -f eap_*.so $(ALL) $(WINALL) eapol_test preauth_test
|
rm -f eap_*.so $(ALL) $(WINALL) eapol_test preauth_test
|
||||||
rm -f wpa_priv
|
rm -f wpa_priv
|
||||||
rm -f nfc_pw_token
|
rm -f nfc_pw_token
|
||||||
|
rm -f lcov.info
|
||||||
|
rm -rf lcov-html
|
||||||
|
|
||||||
-include $(OBJS:%.o=%.d)
|
-include $(OBJS:%.o=%.d)
|
||||||
|
|
Loading…
Reference in a new issue