diff --git a/GNUmakefile b/GNUmakefile index cc1d466c..f4c10715 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -444,6 +444,17 @@ CXXFLAGS += -coverage endif # -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. # Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268 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 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 test check: cryptest.exe ./cryptest.exe v diff --git a/validate.h b/validate.h index 1e2f33cd..ed9d98f7 100644 --- a/validate.h +++ b/validate.h @@ -108,7 +108,7 @@ bool ValidateHashDRBG(); bool ValidateHmacDRBG(); // 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 #endif