Debian Codegraph @

tests/examples/CMakeLists.txt

raw
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements. See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership. The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License. You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19
20
21 if (NOT Python_EXECUTABLE)
22 return()
23 endif()
24
25 if(WIN32)
26 # NOTE: need to escape semicolons as cmake uses them as list separators.
27 set(c_test_path "$<TARGET_FILE_DIR:c-broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-proactor>")
28 else()
29 set(c_test_path "$<TARGET_FILE_DIR:c-broker>:$ENV{PATH}")
30 endif()
31
32 set(c_test_env
33 "PATH=${c_test_path}"
34 "PYTHONPATH=${Proton_SOURCE_DIR}/tests/py")
35
36 pn_add_test(
37 UNWRAPPED
38 NAME c-example-tests
39 PREPEND_ENVIRONMENT "${c_test_env}"
40 WORKING_DIRECTORY ${ProtonCExamples_SOURCE_DIR}
41 COMMAND ${Python_EXECUTABLE} testme -v)
42
43 if (BUILD_CPP)
44 if(WIN32)
45 # NOTE: need to escape semicolons as cmake uses them as list separators.
46 set(cpp_test_path "$<TARGET_FILE_DIR:broker>\;$<TARGET_FILE_DIR:qpid-proton-core>\;$<TARGET_FILE_DIR:qpid-proton-cpp>")
47 else()
48 set(cpp_test_path "$<TARGET_FILE_DIR:broker>:$ENV{PATH}")
49 endif()
50
51 set(cpp_test_env
52 "PATH=${cpp_test_path}"
53 "PYTHONPATH=${Proton_SOURCE_DIR}/tests/py"
54 "HAS_CPP11=$<$<BOOL:${HAS_ENOUGH_CPP11}>:1>")
55
56 pn_add_test(
57 UNWRAPPED
58 NAME cpp-example-container
59 PREPEND_ENVIRONMENT "${cpp_test_env}"
60 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
61 COMMAND ${Python_EXECUTABLE} ${ProtonCppExamples_SOURCE_DIR}/testme -v ContainerExampleTest)
62
63 if (NOT SSL_IMPL STREQUAL none)
64 pn_add_test(
65 UNWRAPPED
66 NAME cpp-example-container-ssl
67 PREPEND_ENVIRONMENT "${cpp_test_env}"
68 WORKING_DIRECTORY ${ProtonCppExamples_SOURCE_DIR}
69 COMMAND ${Python_EXECUTABLE} testme -v ContainerExampleSSLTest)
70 endif()
71 endif()