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 2020/10/08 01:40:34 UTC

[qpid-proton] 02/02: PROTON-2233: Remove example CMake bits that won't work in installed example directories - Move running the example tests into tests/examples

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit d67c180777e5ddb7305e39aa32ec90669bfe0572
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Tue Oct 6 23:09:55 2020 -0400

    PROTON-2233: Remove example CMake bits that won't work in installed example directories
    - Move running the example tests into tests/examples
---
 CMakeLists.txt                |  2 ++
 c/CMakeLists.txt              |  3 +-
 c/examples/CMakeLists.txt     | 22 --------------
 cpp/CMakeLists.txt            |  3 +-
 cpp/examples/CMakeLists.txt   | 31 -------------------
 tests/examples/CMakeLists.txt | 71 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 77 insertions(+), 55 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2dcdca..5fe49f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -428,3 +428,5 @@ configure_file(${CMAKE_SOURCE_DIR}/misc/config.sh.in
                ${CMAKE_BINARY_DIR}/config.sh @ONLY)
 configure_file(${CMAKE_SOURCE_DIR}/misc/config.bat.in
                ${CMAKE_BINARY_DIR}/config.bat @ONLY)
+
+add_subdirectory(tests/examples)
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index 66de789..89028fb 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -589,4 +589,5 @@ add_subdirectory(tools)
 install (DIRECTORY examples/
          DESTINATION "${PROTON_SHARE}/examples/c"
          USE_SOURCE_PERMISSIONS
-         PATTERN ProtonConfig.cmake EXCLUDE)
+         PATTERN "ProtonConfig.cmake" EXCLUDE
+         PATTERN "testme" EXCLUDE)
diff --git a/c/examples/CMakeLists.txt b/c/examples/CMakeLists.txt
index d19c868..87f85c4 100644
--- a/c/examples/CMakeLists.txt
+++ b/c/examples/CMakeLists.txt
@@ -30,25 +30,3 @@ foreach (name broker send receive direct send-abort send-ssl raw_echo raw_connec
   set_target_properties(c-${name} PROPERTIES
     OUTPUT_NAME ${name})
 endforeach()
-
-
-find_package (PythonInterp)     # For test-driver script
-if (PYTHON_EXECUTABLE)
-  if(WIN32)
-    # NOTE: need to escape semicolons as cmake uses them as list separators.
-    set(test_path "$<TARGET_FILE_DIR:c-broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-proactor>")
-  else()
-    set(test_path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
-  endif()
-
-  set(test_env
-    "PATH=${test_path}"
-    "PYTHONPATH=../../tests/py")
-
-  pn_add_test(
-    UNWRAPPED
-    NAME c-example-tests
-    PREPEND_ENVIRONMENT "${test_env}"
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    COMMAND ${PYTHON_EXECUTABLE} testme -v)
-endif()
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 9c92139..7d4ed98 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -196,7 +196,8 @@ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/config_presets.hpp" DESTINATION "${I
 install (DIRECTORY "examples/"
   DESTINATION "${PROTON_SHARE}/examples/cpp"
   USE_SOURCE_PERMISSIONS
-  PATTERN "ProtonCppConfig.cmake" EXCLUDE)
+  PATTERN "ProtonCppConfig.cmake" EXCLUDE
+  PATTERN "testme" EXCLUDE)
 
 if (DEFINED CMAKE_IMPORT_LIBRARY_PREFIX)
 set(PROTONCPPLIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_IMPORT_LIBRARY_SUFFIX})
diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt
index f6f739b..a5b9c91 100644
--- a/cpp/examples/CMakeLists.txt
+++ b/cpp/examples/CMakeLists.txt
@@ -98,34 +98,3 @@ if(HAS_ENOUGH_CPP11)
     endforeach()
   endif()
 endif()
-
-find_package (PythonInterp)     # For test-driver script
-if (PYTHON_EXECUTABLE)
-  if(WIN32)
-    # NOTE: need to escape semicolons as cmake uses them as list separators.
-    set(test_path "$<TARGET_FILE_DIR:broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-cpp>")
-  else()
-    set(test_path "$<TARGET_FILE_DIR:broker>:$ENV{PATH}")
-  endif()
-
-  set(test_env
-    "PATH=${test_path}"
-    "PYTHONPATH=../../tests/py"
-    "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>")
-
-  pn_add_test(
-    UNWRAPPED
-    NAME cpp-example-container
-    PREPEND_ENVIRONMENT "${test_env}"
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    COMMAND ${PYTHON_EXECUTABLE} testme -v ContainerExampleTest)
-
-  if (NOT SSL_IMPL STREQUAL none)
-    pn_add_test(
-      UNWRAPPED
-      NAME cpp-example-container-ssl
-      PREPEND_ENVIRONMENT "${test_env}"
-      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-      COMMAND ${PYTHON_EXECUTABLE} testme -v ContainerExampleSSLTest)
-  endif()
-endif()
diff --git a/tests/examples/CMakeLists.txt b/tests/examples/CMakeLists.txt
new file mode 100644
index 0000000..4c78dd2
--- /dev/null
+++ b/tests/examples/CMakeLists.txt
@@ -0,0 +1,71 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+if (NOT PYTHON_EXECUTABLE)
+  return()
+endif()
+
+if(WIN32)
+  # NOTE: need to escape semicolons as cmake uses them as list separators.
+  set(c_test_path "$<TARGET_FILE_DIR:c-broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-proactor>")
+else()
+  set(c_test_path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
+endif()
+
+set(c_test_env
+  "PATH=${c_test_path}"
+  "PYTHONPATH=${Proton_SOURCE_DIR}/tests/py")
+
+pn_add_test(
+  UNWRAPPED
+  NAME c-example-tests
+  PREPEND_ENVIRONMENT "${c_test_env}"
+  WORKING_DIRECTORY ${ProtonCExamples_SOURCE_DIR}
+  COMMAND ${PYTHON_EXECUTABLE} testme -v)
+
+if (BUILD_CPP)
+  if(WIN32)
+    # NOTE: need to escape semicolons as cmake uses them as list separators.
+    set(cpp_test_path "$<TARGET_FILE_DIR:broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-cpp>")
+  else()
+    set(cpp_test_path "$<TARGET_FILE_DIR:broker>:$ENV{PATH}")
+  endif()
+
+  set(cpp_test_env
+    "PATH=${cpp_test_path}"
+    "PYTHONPATH=${Proton_SOURCE_DIR}/tests/py"
+    "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>")
+
+  pn_add_test(
+    UNWRAPPED
+    NAME cpp-example-container
+    PREPEND_ENVIRONMENT "${cpp_test_env}"
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} ${ProtonCppExamples_SOURCE_DIR}/testme -v ContainerExampleTest)
+
+  if (NOT SSL_IMPL STREQUAL none)
+    pn_add_test(
+      UNWRAPPED
+      NAME cpp-example-container-ssl
+      PREPEND_ENVIRONMENT "${cpp_test_env}"
+      WORKING_DIRECTORY ${ProtonCppExamples_SOURCE_DIR}
+      COMMAND ${PYTHON_EXECUTABLE} testme -v ContainerExampleSSLTest)
+  endif()
+endif()


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