Timeout on verify.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9268d46b Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9268d46b Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9268d46b Branch: refs/heads/fix Commit: 9268d46bfe0ee0f5a4d9679b50c7d12e5229cc46 Parents: 91c8432 Author: Alan Conway <[email protected]> Authored: Tue Jan 26 16:42:09 2016 -0500 Committer: Alan Conway <[email protected]> Committed: Tue Jan 26 16:42:09 2016 -0500 ---------------------------------------------------------------------- examples/cpp/CMakeLists.txt | 72 ++++++++++++++++---------------- examples/cpp/engine/example_test.py | 8 +++- 2 files changed, 42 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9268d46b/examples/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt index 14d5748..3297302 100644 --- a/examples/cpp/CMakeLists.txt +++ b/examples/cpp/CMakeLists.txt @@ -19,45 +19,45 @@ find_package(ProtonCpp REQUIRED) -include_directories(${ProtonCpp_INCLUDE_DIRS}) +# include_directories(${ProtonCpp_INCLUDE_DIRS}) -set(examples - broker - helloworld - helloworld_direct - simple_recv - simple_send - direct_recv - direct_send - client - server - server_direct - recurring_timer - connection_options - queue_browser - selected_recv - ssl - ssl_client_cert - encode_decode) +# set(examples +# broker +# helloworld +# helloworld_direct +# simple_recv +# simple_send +# direct_recv +# direct_send +# client +# server +# server_direct +# recurring_timer +# connection_options +# queue_browser +# selected_recv +# ssl +# ssl_client_cert +# encode_decode) -foreach(example ${examples}) - add_executable(${example} ${example}.cpp) - target_link_libraries(${example} ${ProtonCpp_LIBRARIES}) - set_source_files_properties(${example}.cpp PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}") -endforeach() +# foreach(example ${examples}) +# add_executable(${example} ${example}.cpp) +# target_link_libraries(${example} ${ProtonCpp_LIBRARIES}) +# set_source_files_properties(${example}.cpp PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}") +# endforeach() -set(env_py "${CMAKE_SOURCE_DIR}/proton-c/env.py") -set(test_bin_dir "$<TARGET_FILE_DIR:broker>") -if (WIN32) - # Ignore existing path (usualy containting spaces, escape chars). - # Choose just enough path for Windows, ';' separated. - set(test_path "${test_bin_dir}" "$<TARGET_FILE_DIR:qpid-proton>" "$<TARGET_FILE_DIR:qpid-proton-cpp>") -else(WIN32) - # ':' separated path with test_bin_dir first. - set(test_path "${test_bin_dir}:$ENV{PATH}") -endif(WIN32) +# set(env_py "${CMAKE_SOURCE_DIR}/proton-c/env.py") +# set(test_bin_dir "$<TARGET_FILE_DIR:broker>") +# if (WIN32) +# # Ignore existing path (usualy containting spaces, escape chars). +# # Choose just enough path for Windows, ';' separated. +# set(test_path "${test_bin_dir}" "$<TARGET_FILE_DIR:qpid-proton>" "$<TARGET_FILE_DIR:qpid-proton-cpp>") +# else(WIN32) +# # ':' separated path with test_bin_dir first. +# set(test_path "${test_bin_dir}:$ENV{PATH}") +# endif(WIN32) -add_test(NAME cpp_example_test - COMMAND ${PYTHON_EXECUTABLE} ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v) +# add_test(NAME cpp_example_test +# COMMAND ${PYTHON_EXECUTABLE} ${env_py} -- "PATH=${test_path}" ${VALGRIND_ENV} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.py -v) add_subdirectory(engine) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9268d46b/examples/cpp/engine/example_test.py ---------------------------------------------------------------------- diff --git a/examples/cpp/engine/example_test.py b/examples/cpp/engine/example_test.py index 6d438bc..52bc37e 100644 --- a/examples/cpp/engine/example_test.py +++ b/examples/cpp/engine/example_test.py @@ -26,7 +26,7 @@ from subprocess import Popen, PIPE, STDOUT from copy import copy import platform from os.path import dirname as dirname -from threading import Thread +from threading import Thread, Timer try: from Queue import Queue, Empty except: @@ -111,14 +111,18 @@ vvvvvvvvvvvvvvvv self.procs.append(p) return p - def verify(self, p): + def verify(self, p, timeout=5): """Wait for executable to exit and verify status, return the output""" print >>sys.stderr, "FIXME verify", p.args try: + timer = Timer(timeout, p.kill) try: + timer.start() out, err = p.communicate() except Exception as e: raise Exception("Error running %s: %s", p.args, e) + finally: + timer.cancel() if p.returncode: raise Exception("""%s exit code %s vvvvvvvvvvvvvvvv --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
