Add CONFIG_CODE_COVERAGE=y option for gcov

This can be used to measure code coverage from test scripts.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-11-24 19:16:12 +02:00
parent d9c753b4f5
commit 7feff06567
19 changed files with 37 additions and 19 deletions

3
.gitignore vendored
View File

@ -1,5 +1,8 @@
*.o *.o
*.d *.d
*.gcno
*.gcda
*.gcov
*.pyc *.pyc
*~ *~
.config .config

View File

@ -105,6 +105,14 @@ OBJS += ../src/common/wpa_common.o
OBJS += ../src/eapol_auth/eapol_auth_sm.o OBJS += ../src/eapol_auth/eapol_auth_sm.o
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
LIBS_c += -lgcov
LIBS_h += -lgcov
LIBS_n += -lgcov
endif
ifndef CONFIG_NO_DUMP_STATE ifndef CONFIG_NO_DUMP_STATE
# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
# a file (undefine it, if you want to save in binary size) # a file (undefine it, if you want to save in binary size)
@ -939,6 +947,6 @@ hlr_auc_gw: $(HOBJS)
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 rm -f *.d *.gcno *.gcda *.gcov
-include $(OBJS:%.o=%.d) -include $(OBJS:%.o=%.d)

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -1,7 +1,7 @@
all: libcrypto.a all: libcrypto.a
clean: clean:
rm -f *~ *.o *.d libcrypto.a rm -f *~ *.o *.d *.gcno *.gcda *.gcov libcrypto.a
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
rm -f build.wpa_supplicant build.hostapd rm -f build.wpa_supplicant build.hostapd
install: install:

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.so *.d rm -f *~ *.o *.so *.d *.gcno *.gcda *.gcov
install: install:
if ls *.so >/dev/null 2>&1; then \ if ls *.so >/dev/null 2>&1; then \

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,8 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
for d in $(SUBDIRS); do make -C $$d clean; done rm -f *~ *.o *.d *.gcno *.gcda *.gcov
rm -f *~ *.o *.d
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -1,7 +1,7 @@
all: libradius.a all: libradius.a
clean: clean:
rm -f *~ *.o *.d libradius.a rm -f *~ *.o *.d *.gcno *.gcda *.gcov libradius.a
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -1,7 +1,7 @@
all: libutils.a all: libutils.a
clean: clean:
rm -f *~ *.o *.d libutils.a rm -f *~ *.o *.d *.gcno *.gcda *.gcov libutils.a
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -2,7 +2,7 @@ all:
@echo Nothing to be made. @echo Nothing to be made.
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
install: install:
@echo Nothing to be made. @echo Nothing to be made.

View File

@ -129,6 +129,13 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST CFLAGS += -Werror -DEAPOL_TEST
endif endif
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
LIBS_c += -lgcov
LIBS_p += -lgcov
endif
ifdef CONFIG_HT_OVERRIDES ifdef CONFIG_HT_OVERRIDES
CFLAGS += -DCONFIG_HT_OVERRIDES CFLAGS += -DCONFIG_HT_OVERRIDES
endif endif
@ -1672,7 +1679,8 @@ fips:
clean: clean:
$(MAKE) -C ../src clean $(MAKE) -C ../src clean
$(MAKE) -C dbus clean $(MAKE) -C dbus clean
rm -f core *~ *.o *.d eap_*.so $(ALL) $(WINALL) eapol_test preauth_test rm -f core *~ *.o *.d *.gcno *.gcda *.gcov
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

View File

@ -1,7 +1,7 @@
all: libwpadbus.a all: libwpadbus.a
clean: clean:
rm -f *~ *.o *.d rm -f *~ *.o *.d *.gcno *.gcda *.gcov
rm -f libwpadbus.a rm -f libwpadbus.a
install: install: