tests: Enable valgrind only if USE_VALGRIND=YES

The tests did enable valgrind when the environmental variable
USE_VALGIND was nonempty. This commit adds a requirement that
this variable is nonempty and equal to YES (or yes, Yes, etc.).
This would make it easier to add a combo box in Jenkins with
two possible USE_VALGRIND values: YES and NO.