Add Makefile recipe for Valgrind builds

pull/416/head
Jeffrey Walton 2017-05-06 22:54:49 -04:00
parent 9cf9f4235d
commit c62e1ade6e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 17 additions and 1 deletions

View File

@ -444,6 +444,17 @@ CXXFLAGS += -coverage
endif # -coverage endif # -coverage
endif # GCC code coverage endif # GCC code coverage
# Valgrind testing. Issue 'make valgrind'.
ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
# Tune flags; see http://valgrind.org/docs/manual/quick-start.html
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),)
CXXFLAGS += -DCRYPTOPP_VALGRIND
endif # -DCRYPTOPP_VALGRIND
endif # Valgrind
# Debug testing on GNU systems. Triggered by -DDEBUG. # Debug testing on GNU systems. Triggered by -DDEBUG.
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268 # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),) ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
@ -580,6 +591,11 @@ coverage: libcryptopp.a cryptest.exe
lcov --remove cryptest.info "adhoc.cpp" "wait.*" "network.*" "socketft.*" "fips140.*" "*test.*" "bench*.cpp" "validat*.*" "/usr/*" -o cryptest.info lcov --remove cryptest.info "adhoc.cpp" "wait.*" "network.*" "socketft.*" "fips140.*" "*test.*" "bench*.cpp" "validat*.*" "/usr/*" -o cryptest.info
genhtml -o ./TestCoverage/ -t "cryptest.exe test coverage" --num-spaces 4 cryptest.info genhtml -o ./TestCoverage/ -t "cryptest.exe test coverage" --num-spaces 4 cryptest.info
# SHould use CXXFLAGS="-g3 -O1"
.PHONY: valgrind
valgrind: libcryptopp.a cryptest.exe
valgrind ./cryptest.exe v
.PHONY: test check .PHONY: test check
test check: cryptest.exe test check: cryptest.exe
./cryptest.exe v ./cryptest.exe v

View File

@ -108,7 +108,7 @@ bool ValidateHashDRBG();
bool ValidateHmacDRBG(); bool ValidateHmacDRBG();
// If CRYPTOPP_DEBUG or CRYPTOPP_COVERAGE is in effect, then perform additional tests // If CRYPTOPP_DEBUG or CRYPTOPP_COVERAGE is in effect, then perform additional tests
#if (defined(CRYPTOPP_DEBUG) || defined(CRYPTOPP_COVERAGE)) && !defined(CRYPTOPP_IMPORTS) #if (defined(CRYPTOPP_DEBUG) || defined(CRYPTOPP_COVERAGE) || defined(CRYPTOPP_VALGRIND)) && !defined(CRYPTOPP_IMPORTS)
# define CRYPTOPP_EXTENDED_VALIDATION 1 # define CRYPTOPP_EXTENDED_VALIDATION 1
#endif #endif