qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: PROTON-865: Add valgrind to c++ example tests. Note presently fails.
Date Wed, 12 Aug 2015 18:21:19 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/cjansen-cpp-client f7c6efc0d -> bc1491c5f


PROTON-865: Add valgrind to c++ example tests. Note presently fails.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/bc1491c5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/bc1491c5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/bc1491c5

Branch: refs/heads/cjansen-cpp-client
Commit: bc1491c5fc7f24778d1ab6afae68de680117285d
Parents: f7c6efc
Author: Alan Conway <aconway@redhat.com>
Authored: Wed Aug 12 13:05:00 2015 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Wed Aug 12 13:05:35 2015 -0400

----------------------------------------------------------------------
 CMakeLists.txt               | 14 ++++++++++++++
 examples/cpp/CMakeLists.txt  |  2 +-
 examples/cpp/example_test.py | 19 ++++++++++++-------
 proton-c/CMakeLists.txt      | 14 --------------
 4 files changed, 27 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bc1491c5/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 261fdc0..209f18d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,6 +139,20 @@ if (BUILD_JAVA)
   add_subdirectory(proton-j)
 endif()
 
+# 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")
+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")
+  else ()
+    set (VALGRIND_ENV "VALGRIND=${VALGRIND_EXE}")
+  endif ()
+endif (ENABLE_VALGRIND)
+
+mark_as_advanced (VALGRIND_EXE)
+message("FIXME VG ${VALGRIND_ENV}")
+
 add_subdirectory(proton-c)
 add_subdirectory(examples)
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bc1491c5/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 1822c6a..77ab816 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -49,4 +49,4 @@ else(WIN32)
 endif(WIN32)
 
 add_test(cpp_example_test
-    ${PYTHON_EXECUTABLE} ${env_py} -- "PATH=${test_path}" ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py
-v)
+  ${PYTHON_EXECUTABLE} ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bc1491c5/examples/cpp/example_test.py
----------------------------------------------------------------------
diff --git a/examples/cpp/example_test.py b/examples/cpp/example_test.py
index 51e732d..f244516 100644
--- a/examples/cpp/example_test.py
+++ b/examples/cpp/example_test.py
@@ -25,15 +25,20 @@ from  random import randrange
 from subprocess import Popen, PIPE, STDOUT
 import platform
 
-def exe_name(name):
+def cmdline(*args):
+    """Adjust executable name args[0] for windows and/or valgrind"""
+    args = list(args)
     if platform.system() == "Windows":
-        return name + ".exe"
-    return "./" + name
+        args[0] += ".exe"
+    else:
+        args[0] = "./" + args[0]
+    if "VALGRIND" in os.environ:
+        args = [os.environ["VALGRIND"], "-q"] + args
+    return args
 
 def background(*args):
     """Run executable in the backround, return the popen"""
-    args = [exe_name(args[0])]+list(args[1:])
-    p = Popen(args, stdout=PIPE, stderr=STDOUT)
+    p = Popen(cmdline(*args), stdout=PIPE, stderr=sys.stderr)
     p.args = args               # Save arguments for debugging output
     return p
 
@@ -94,9 +99,9 @@ class Broker(object):
 
     def __init__(self):
         self.addr = pick_addr()
-        cmd = [exe_name("broker"), "-a", self.addr]
+        cmd = cmdline("broker", "-a", self.addr)
         try:
-            self.process = Popen(cmd, stdout=NULL, stderr=NULL)
+            self.process = Popen(cmd, stdout=NULL, stderr=sys.stderr)
             wait_addr(self.addr)
             self.addr += "/examples"
         except Exception as e:

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/bc1491c5/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 06189d4..ac057f6 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -442,20 +442,6 @@ install (FILES
   ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake
   DESTINATION ${LIB_INSTALL_DIR}/cmake/Proton)
 
-# CTest
-
-find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
-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")
-  else ()
-    set (VALGRIND_ENV "VALGRIND=${VALGRIND_EXE}")
-  endif ()
-endif (ENABLE_VALGRIND)
-
-mark_as_advanced (VALGRIND_EXE)
-
 # c tests:
 
 add_subdirectory(src/tests)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message