You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2017/11/10 02:27:33 UTC
qpid-proton git commit: PROTON-1677: Valgrind suppression for Ubuntu
14.04 glibc bug - Also consolidate valgrind configuration into only one place
Repository: qpid-proton
Updated Branches:
refs/heads/master 9157a69a6 -> 04563baa5
PROTON-1677: Valgrind suppression for Ubuntu 14.04 glibc bug
- Also consolidate valgrind configuration into only one place
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/04563baa
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/04563baa
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/04563baa
Branch: refs/heads/master
Commit: 04563baa53c8b64a4f89a59e5cd48e15b2f67f06
Parents: 9157a69
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri Nov 3 16:39:57 2017 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Nov 9 21:27:15 2017 -0500
----------------------------------------------------------------------
CMakeLists.txt | 34 +++++---
config.sh.in | 1 +
proton-c/bindings/cpp/CMakeLists.txt | 5 --
proton-c/src/tests/CMakeLists.txt | 6 --
proton-c/src/tests/valgrind.supp | 10 +++
tests/python/proton_tests/common.py | 46 +++--------
tests/python/proton_tests/valgrind.supp | 113 ---------------------------
tools/py/proctest.py | 7 +-
8 files changed, 45 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f81cbb..06bc62b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -162,20 +162,28 @@ endforeach()
set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
# End of variables used during install
-# Check for valgrind here so tests under proton-c/ and examples/ can use it.
-find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
-mark_as_advanced (VALGRIND_EXE)
-
-option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
-if (ENABLE_VALGRIND)
- if (NOT VALGRIND_EXE)
- message(STATUS "Can't locate the valgrind command; no run-time error detection")
- elseif (CMAKE_BUILD_TYPE MATCHES "Coverage")
- message(STATUS "Building for coverage analysis; no run-time error detection")
- else ()
- set (VALGRIND_ENV "VALGRIND=${VALGRIND_EXE}")
+# Can't do valgrind and coverage at athe same time - coverage takes precedence
+if (CMAKE_BUILD_TYPE MATCHES "Coverage")
+ message(STATUS "Building for coverage analysis; no run-time error detection")
+else ()
+ # Check for valgrind here so tests under proton-c/ and examples/ can use it.
+ find_program(VALGRIND_EXECUTABLE valgrind DOC "Location of the valgrind program")
+ mark_as_advanced (VALGRIND_EXECUTABLE)
+
+ option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
+ if (ENABLE_VALGRIND)
+ if (VALGRIND_EXECUTABLE)
+ set (VALGRIND_SUPPRESSIONS ${CMAKE_SOURCE_DIR}/proton-c/src/tests/valgrind.supp CACHE STRING "Default valgrind suppressions")
+ set (VALGRIND_OPTIONS "--error-exitcode=42 --quiet --leak-check=full --trace-children=yes" CACHE STRING "Default valgrind options")
+ mark_as_advanced(VALGRIND_SUPPRESSIONS VALGRIND_OPTIONS)
+ set (VALGRIND_ENV "VALGRIND=${VALGRIND_EXECUTABLE}" "VALGRIND_ARGS=${VALGRIND_OPTIONS} --suppressions=${VALGRIND_SUPPRESSIONS}")
+ separate_arguments(VALGRIND_OPTIONS_LIST UNIX_COMMAND ${VALGRIND_OPTIONS})
+ set (memcheck-cmd ${VALGRIND_EXECUTABLE} ${VALGRIND_OPTIONS_LIST} "--suppressions=${VALGRIND_SUPPRESSIONS}")
+ else ()
+ message(STATUS "Can't locate the valgrind command; no run-time error detection")
+ endif ()
endif ()
-endif (ENABLE_VALGRIND)
+endif ()
# Options to enable sanitizing compile flags. Compile flags are set in proton-c/CMakeLists.txt
option(ENABLE_SANITIZERS "Compile with sanitizers (ASan, UBSan, TSan); incompatible with Valgrind" OFF)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/config.sh.in
----------------------------------------------------------------------
diff --git a/config.sh.in b/config.sh.in
index a29b47a..1873cc3 100755
--- a/config.sh.in
+++ b/config.sh.in
@@ -73,6 +73,7 @@ export PATH="$(merge_paths $PATH $PROTON_BUILD/tests/tools/apps/c $PROTON_HOME/t
# can the test harness use valgrind?
if [[ -x "$(type -p valgrind)" && "@ENABLE_VALGRIND@" == "ON" ]] ; then
export VALGRIND=$(type -p valgrind)
+ export VALGRIND_ARGS=@VALGRIND_OPTIONS@
fi
# can the test harness use saslpasswd2?
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index b7f0d9f..06a7ee1 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -195,11 +195,6 @@ install (FILES
${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
-## Test
-if (ENABLE_VALGRIND AND VALGRIND_EXE)
- set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=42 --quiet --leak-check=full --trace-children=yes)
-endif ()
-
macro(add_cpp_test test)
add_executable (${test} src/${test}.cpp)
target_link_libraries (${test} qpid-proton-cpp)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/proton-c/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt
index 6572f32..b671170 100644
--- a/proton-c/src/tests/CMakeLists.txt
+++ b/proton-c/src/tests/CMakeLists.txt
@@ -22,12 +22,6 @@ add_definitions(${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS})
configure_file(test_config.h.in test_config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-if (ENABLE_VALGRIND AND VALGRIND_EXE)
- set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=42 --quiet
- --leak-check=full --trace-children=yes
- --suppressions=${CMAKE_CURRENT_SOURCE_DIR}/valgrind.supp)
-endif ()
-
macro (pn_add_c_test test)
add_executable (${test} ${ARGN})
target_link_libraries (${test} qpid-proton ${PLATFORM_LIBS})
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/proton-c/src/tests/valgrind.supp
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/valgrind.supp b/proton-c/src/tests/valgrind.supp
index 79fc998..282a18c 100644
--- a/proton-c/src/tests/valgrind.supp
+++ b/proton-c/src/tests/valgrind.supp
@@ -119,3 +119,13 @@
fun:sasl_config_init
fun:sasl_server_init
}
+
+{
+ Known bug in glibc which tries to free ipv6 related static when getaddrinfo used
+ Memcheck:Free
+ fun:free
+ fun:__libc_freeres
+ fun:_vgnU_freeres
+ fun:__run_exit_handlers
+ fun:exit
+}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/common.py b/tests/python/proton_tests/common.py
index aaefccd..019c47d 100644
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@ -486,19 +486,17 @@ class MessengerSenderC(MessengerSender):
MessengerSender.__init__(self)
self._command = ["msgr-send"]
+def setup_valgrind(self):
+ if "VALGRIND" not in os.environ:
+ raise Skipped("Skipping test - $VALGRIND not set.")
+ super(type(self), self).__init__()
+ self._command = [os.environ["VALGRIND"]] + os.environ["VALGRIND_ARGS"].split(' ') + self._command
+
class MessengerSenderValgrind(MessengerSenderC):
""" Run the C sender under Valgrind
"""
def __init__(self, suppressions=None):
- if "VALGRIND" not in os.environ:
- raise Skipped("Skipping test - $VALGRIND not set.")
- MessengerSenderC.__init__(self)
- if not suppressions:
- suppressions = os.path.join(os.path.dirname(__file__),
- "valgrind.supp" )
- self._command = [os.environ["VALGRIND"], "--error-exitcode=42", "--quiet",
- "--trace-children=yes", "--leak-check=full",
- "--suppressions=%s" % suppressions] + self._command
+ setup_valgrind(self)
class MessengerReceiverC(MessengerReceiver):
def __init__(self):
@@ -509,15 +507,7 @@ class MessengerReceiverValgrind(MessengerReceiverC):
""" Run the C receiver under Valgrind
"""
def __init__(self, suppressions=None):
- if "VALGRIND" not in os.environ:
- raise Skipped("Skipping test - $VALGRIND not set.")
- MessengerReceiverC.__init__(self)
- if not suppressions:
- suppressions = os.path.join(os.path.dirname(__file__),
- "valgrind.supp" )
- self._command = [os.environ["VALGRIND"], "--error-exitcode=42", "--quiet",
- "--trace-children=yes", "--leak-check=full",
- "--suppressions=%s" % suppressions] + self._command
+ setup_valgrind(self)
class MessengerSenderPython(MessengerSender):
def __init__(self):
@@ -541,15 +531,7 @@ class ReactorSenderValgrind(ReactorSenderC):
""" Run the C sender under Valgrind
"""
def __init__(self, suppressions=None):
- if "VALGRIND" not in os.environ:
- raise Skipped("Skipping test - $VALGRIND not set.")
- ReactorSenderC.__init__(self)
- if not suppressions:
- suppressions = os.path.join(os.path.dirname(__file__),
- "valgrind.supp" )
- self._command = [os.environ["VALGRIND"], "--error-exitcode=42", "--quiet",
- "--trace-children=yes", "--leak-check=full",
- "--suppressions=%s" % suppressions] + self._command
+ setup_valgrind(self)
class ReactorReceiverC(MessengerReceiver):
def __init__(self):
@@ -560,12 +542,4 @@ class ReactorReceiverValgrind(ReactorReceiverC):
""" Run the C receiver under Valgrind
"""
def __init__(self, suppressions=None):
- if "VALGRIND" not in os.environ:
- raise Skipped("Skipping test - $VALGRIND not set.")
- ReactorReceiverC.__init__(self)
- if not suppressions:
- suppressions = os.path.join(os.path.dirname(__file__),
- "valgrind.supp" )
- self._command = [os.environ["VALGRIND"], "--error-exitcode=42", "--quiet",
- "--trace-children=yes", "--leak-check=full",
- "--suppressions=%s" % suppressions] + self._command
+ setup_valgrind(self)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/tests/python/proton_tests/valgrind.supp
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/valgrind.supp b/tests/python/proton_tests/valgrind.supp
deleted file mode 100644
index 3cb5034..0000000
--- a/tests/python/proton_tests/valgrind.supp
+++ /dev/null
@@ -1,113 +0,0 @@
-{
- SSL does a number of uninitialized accesses (expected) 1
- Memcheck:Cond
- fun:BN_bin2bn
- obj:*
- obj:*
-}
-
-{
- SSL does a number of uninitialized accesses (expected) 2
- Memcheck:Cond
- fun:BN_num_bits_word
- fun:BN_num_bits
-}
-
-{
- SSL does a number of uninitialized accesses (expected) 3
- Memcheck:Value8
- fun:BN_num_bits_word
- fun:BN_num_bits
- fun:BN_mod_exp_mont_consttime
- obj:*
- fun:ssl3_ctx_ctrl
-}
-
-{
- SSL does a number of uninitialized accesses (expected) 4
- Memcheck:Value8
- fun:BN_mod_exp_mont_consttime
- obj:*
- fun:ssl3_ctx_ctrl
-}
-
-{
- SSL does a number of uninitialized accesses (FreeBSD version)
- Memcheck:Value8
- fun:BN_num_bits_word
- fun:BN_num_bits
- fun:BN_mod_exp_mont_consttime
- fun:BN_mod_exp_mont
- obj:*libcrypto.so*
- fun:ssl3_ctx_ctrl
-}
-
-{
- SSL does a number of uninitialized accesses (FreeBSD version)
- Memcheck:Value8
- fun:BN_mod_exp_mont_consttime
- fun:BN_mod_exp_mont
- obj:*libcrypto.so*
- fun:ssl3_ctx_ctrl
-}
-
-{
- SSL does a number of uninitialized accesses (expected) 5
- Memcheck:Value4
- fun:BN_mod_exp_mont_consttime
- fun:BN_mod_exp_mont
- obj:*
- obj:*
-}
-
-{
- SSL does a number of uninitialized accesses (expected) 6
- Memcheck:Value4
- fun:BN_num_bits_word
- fun:BN_mod_exp_mont_consttime
- fun:BN_mod_exp_mont
- obj:*
- obj:*
-}
-
-{
- Since we can never safely uninitialize SSL, allow this
- Memcheck:Leak
- fun:_vgrZU_libcZdsoZa_realloc
- fun:CRYPTO_realloc
- fun:lh_insert
- obj:/lib64/libcrypto.so.0.9.8e
- fun:ERR_load_strings
- fun:ERR_load_X509V3_strings
- fun:ERR_load_crypto_strings
- fun:SSL_load_error_strings
-}
-
-{
- Since we can never safely uninitialize SSL, allow this
- Memcheck:Leak
- fun:_vgrZU_libcZdsoZa_malloc
- fun:CRYPTO_malloc
- fun:lh_new
- fun:OBJ_NAME_init
- fun:OBJ_NAME_add
- fun:EVP_add_cipher
- fun:SSL_library_init
-}
-
-{
- Since we can never safely uninitialize SSL, allow this
- Memcheck:Leak
- fun:malloc
- obj:*
- fun:CRYPTO_malloc
-}
-
-{
- Known memory leak in cyrus-sasl (fixed in 2.1.26)
- Memcheck:Leak
- fun:malloc
- fun:*
- fun:sasl_config_init
- fun:sasl_server_init
-}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04563baa/tools/py/proctest.py
----------------------------------------------------------------------
diff --git a/tools/py/proctest.py b/tools/py/proctest.py
index 8e3c473..60b7384 100644
--- a/tools/py/proctest.py
+++ b/tools/py/proctest.py
@@ -74,7 +74,6 @@ class Proc(Popen):
'ready' pattern' Use self.out to access output (combined stdout and stderr).
You can't set the Popen stdout and stderr arguments, they will be overwritten.
"""
- valgrind_exit = 42 # Special exit code for valgrind errors
@property
def out(self):
@@ -89,11 +88,11 @@ class Proc(Popen):
valgrind_exe = valgrind and os.getenv("VALGRIND")
if valgrind_exe:
# run valgrind for speed, not for detailed information
- vg = [valgrind_exe, "--quiet", "--error-exitcode=%s" % self.valgrind_exit]
+ vg = [valgrind_exe]
if helgrind:
- vg += ["--tool=helgrind"]
+ vg += ["--tool=helgrind", "--quiet", "--error-exitcode=42"]
else:
- vg += ["--tool=memcheck", "--leak-check=full"]
+ vg += ["--tool=memcheck"] + os.getenv("VALGRIND_ARGS").split(' ')
self.args = vg + self.args
if os.getenv("PROCTEST_VERBOSE"):
sys.stderr.write("\n== running == "+" ".join(self.args)+"\n")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org