| James E. King III | 3ae3042 | 2018-03-12 07:33:22 -0400 | [diff] [blame] | 1 | # |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 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 | |
| James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 20 | # Unit tests still require boost |
| 21 | include(BoostMacros) |
| 22 | REQUIRE_BOOST_HEADERS() |
| Mario Emmenlauer | b013681 | 2021-08-02 21:55:34 +0200 | [diff] [blame] | 23 | set(BOOST_COMPONENTS filesystem thread unit_test_framework chrono) |
| James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 24 | REQUIRE_BOOST_LIBRARIES(BOOST_COMPONENTS) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 25 | |
| James E. King III | c9ac8d2 | 2019-01-07 16:46:45 -0500 | [diff] [blame] | 26 | include(ThriftMacros) |
| James E. King, III | 7edc8fa | 2017-01-20 10:11:41 -0500 | [diff] [blame] | 27 | |
| 28 | # Make sure gen-cpp files can be included |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 29 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 30 | |
| 31 | # Create the thrift C++ test library |
| 32 | set(testgencpp_SOURCES |
| James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 33 | gen-cpp/AnnotationTest_types.cpp |
| 34 | gen-cpp/AnnotationTest_types.h |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 35 | gen-cpp/DebugProtoTest_types.cpp |
| 36 | gen-cpp/DebugProtoTest_types.h |
| 37 | gen-cpp/EnumTest_types.cpp |
| 38 | gen-cpp/EnumTest_types.h |
| 39 | gen-cpp/OptionalRequiredTest_types.cpp |
| 40 | gen-cpp/OptionalRequiredTest_types.h |
| 41 | gen-cpp/Recursive_types.cpp |
| 42 | gen-cpp/Recursive_types.h |
| 43 | gen-cpp/ThriftTest_types.cpp |
| 44 | gen-cpp/ThriftTest_types.h |
| Chet Murthy | ad08a8b | 2017-12-19 15:55:56 -0800 | [diff] [blame] | 45 | gen-cpp/OneWayTest_types.h |
| 46 | gen-cpp/OneWayService.cpp |
| 47 | gen-cpp/OneWayService.h |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 48 | gen-cpp/TypedefTest_types.cpp |
| 49 | gen-cpp/TypedefTest_types.h |
| Sven Roederer | 4f5bfd8 | 2024-07-17 15:27:24 +0200 | [diff] [blame] | 50 | gen-cpp/Thrift5272_types.cpp |
| 51 | gen-cpp/Thrift5272_types.h |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 52 | ThriftTest_extras.cpp |
| 53 | DebugProtoTest_extras.cpp |
| 54 | ) |
| 55 | |
| 56 | add_library(testgencpp STATIC ${testgencpp_SOURCES}) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 57 | |
| Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 58 | set(testgencpp_cob_SOURCES |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 59 | gen-cpp/ChildService.cpp |
| 60 | gen-cpp/ChildService.h |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 61 | gen-cpp/EmptyService.cpp |
| 62 | gen-cpp/EmptyService.h |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 63 | gen-cpp/ParentService.cpp |
| 64 | gen-cpp/ParentService.h |
| 65 | gen-cpp/proc_types.cpp |
| 66 | gen-cpp/proc_types.h |
| 67 | ) |
| Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 68 | add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES}) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 69 | |
| Shaoyu Zhang | 5c2183d | 2025-11-13 13:21:07 -0800 | [diff] [blame^] | 70 | if (WIN32 AND MSVC) |
| 71 | add_library(testgencppCLI STATIC ${testgencpp_SOURCES}) |
| 72 | set_target_properties(testgencppCLI PROPERTIES COMMON_LANGUAGE_RUNTIME "") |
| 73 | endif() |
| 74 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 75 | add_executable(Benchmark Benchmark.cpp) |
| 76 | target_link_libraries(Benchmark testgencpp) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 77 | target_link_libraries(Benchmark thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 78 | add_test(NAME Benchmark COMMAND Benchmark) |
| Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 79 | target_link_libraries(Benchmark testgencpp) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 80 | |
| 81 | set(UnitTest_SOURCES |
| 82 | UnitTestMain.cpp |
| Chet Murthy | ad08a8b | 2017-12-19 15:55:56 -0800 | [diff] [blame] | 83 | OneWayHTTPTest.cpp |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 84 | TMemoryBufferTest.cpp |
| 85 | TBufferBaseTest.cpp |
| 86 | Base64Test.cpp |
| 87 | ToStringTest.cpp |
| 88 | TypedefTest.cpp |
| Roger Meier | 3815e0b | 2015-04-04 16:26:30 +0200 | [diff] [blame] | 89 | TServerSocketTest.cpp |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 90 | TServerTransportTest.cpp |
| zeshuai007 | 86352b4 | 2020-06-15 17:00:33 +0800 | [diff] [blame] | 91 | ThrifttReadCheckTests.cpp |
| CJCombrink | 4b90909 | 2024-04-27 19:51:39 +0200 | [diff] [blame] | 92 | TUuidTest.cpp |
| Sven Roederer | 4f5bfd8 | 2024-07-17 15:27:24 +0200 | [diff] [blame] | 93 | Thrift5272.cpp |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 94 | ) |
| 95 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 96 | add_executable(UnitTests ${UnitTest_SOURCES}) |
| Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 97 | target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 98 | target_link_libraries(UnitTests thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 99 | add_test(NAME UnitTests COMMAND UnitTests) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 100 | if(MSVC) |
| ben-craig | fae08e7 | 2015-07-15 11:34:47 -0500 | [diff] [blame] | 101 | # Disable C4503: decorated name length exceeded, name was truncated |
| 102 | # 'insanity' results in very long decorated names |
| 103 | set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 ) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 104 | endif() |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 105 | |
| CJCombrink | 4b90909 | 2024-04-27 19:51:39 +0200 | [diff] [blame] | 106 | # Test the THRIFT_TUUID_SUPPORT_BOOST_UUID compiler directive globally set on the target |
| 107 | add_executable(UnitTestsUuid |
| 108 | UnitTestMain.cpp |
| 109 | TUuidTestBoost.cpp |
| 110 | ) |
| 111 | target_link_libraries(UnitTestsUuid testgencpp ${Boost_LIBRARIES}) |
| 112 | target_link_libraries(UnitTestsUuid thrift) |
| 113 | target_compile_definitions(UnitTestsUuid PUBLIC THRIFT_TUUID_SUPPORT_BOOST_UUID) |
| 114 | add_test(NAME UnitTestsUuid COMMAND UnitTestsUuid) |
| 115 | |
| 116 | # Test not setting the THRIFT_TUUID_SUPPORT_BOOST_UUID compiler directive as with the test above. |
| 117 | # The test does set the directive before including the thrift header to test the behaviour |
| 118 | add_executable(UnitTestsUuidNoDirective |
| 119 | UnitTestMain.cpp |
| 120 | TUuidTestBoostNoDirective.cpp |
| 121 | ) |
| 122 | target_link_libraries(UnitTestsUuidNoDirective testgencpp ${Boost_LIBRARIES}) |
| 123 | target_link_libraries(UnitTestsUuidNoDirective thrift) |
| 124 | add_test(NAME UnitTestsUuidNoDirective COMMAND UnitTestsUuidNoDirective) |
| ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 125 | |
| Martin Haimberger | 0ad6ee9 | 2015-11-13 03:18:50 -0800 | [diff] [blame] | 126 | set( TInterruptTest_SOURCES |
| 127 | TSocketInterruptTest.cpp |
| 128 | TSSLSocketInterruptTest.cpp |
| 129 | ) |
| ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 130 | if (WIN32) |
| 131 | list(APPEND TInterruptTest_SOURCES |
| 132 | TPipeInterruptTest.cpp |
| 133 | ) |
| 134 | endif() |
| 135 | add_executable(TInterruptTest ${TInterruptTest_SOURCES}) |
| 136 | target_link_libraries(TInterruptTest |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 137 | testgencpp |
| 138 | ${Boost_LIBRARIES} |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 139 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 140 | target_link_libraries(TInterruptTest thrift) |
| Brad Smith | 7734c39 | 2024-12-09 17:07:56 -0500 | [diff] [blame] | 141 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" AND NOT MINGW) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 142 | target_link_libraries(TInterruptTest -lrt) |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 143 | endif () |
| James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 144 | add_test(NAME TInterruptTest COMMAND TInterruptTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 145 | |
| 146 | add_executable(TServerIntegrationTest TServerIntegrationTest.cpp) |
| 147 | target_link_libraries(TServerIntegrationTest |
| 148 | testgencpp_cob |
| 149 | ${Boost_LIBRARIES} |
| 150 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 151 | target_link_libraries(TServerIntegrationTest thrift) |
| Brad Smith | 7734c39 | 2024-12-09 17:07:56 -0500 | [diff] [blame] | 152 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" AND NOT MINGW) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 153 | target_link_libraries(TServerIntegrationTest -lrt) |
| Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 154 | endif () |
| 155 | add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 156 | |
| 157 | if(WITH_ZLIB) |
| Nobuaki Sukegawa | 3e5b9c2 | 2016-02-22 21:47:23 +0900 | [diff] [blame] | 158 | include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 159 | add_executable(TransportTest TransportTest.cpp) |
| 160 | target_link_libraries(TransportTest |
| 161 | testgencpp |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 162 | ${Boost_LIBRARIES} |
| 163 | ${ZLIB_LIBRARIES} |
| 164 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 165 | target_link_libraries(TransportTest thrift) |
| 166 | target_link_libraries(TransportTest thriftz) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 167 | add_test(NAME TransportTest COMMAND TransportTest) |
| 168 | |
| 169 | add_executable(ZlibTest ZlibTest.cpp) |
| 170 | target_link_libraries(ZlibTest |
| 171 | testgencpp |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 172 | ${Boost_LIBRARIES} |
| 173 | ${ZLIB_LIBRARIES} |
| 174 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 175 | target_link_libraries(ZlibTest thrift) |
| 176 | target_link_libraries(ZlibTest thriftz) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 177 | add_test(NAME ZlibTest COMMAND ZlibTest) |
| 178 | endif(WITH_ZLIB) |
| 179 | |
| James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 180 | add_executable(AnnotationTest AnnotationTest.cpp) |
| 181 | target_link_libraries(AnnotationTest |
| 182 | testgencpp |
| 183 | ${Boost_LIBRARIES} |
| 184 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 185 | target_link_libraries(AnnotationTest thrift) |
| James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 186 | add_test(NAME AnnotationTest COMMAND AnnotationTest) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 187 | |
| 188 | add_executable(EnumTest EnumTest.cpp) |
| 189 | target_link_libraries(EnumTest |
| 190 | testgencpp |
| 191 | ${Boost_LIBRARIES} |
| 192 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 193 | target_link_libraries(EnumTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 194 | add_test(NAME EnumTest COMMAND EnumTest) |
| 195 | |
| Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 196 | if(HAVE_GETOPT_H) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 197 | add_executable(TFileTransportTest TFileTransportTest.cpp) |
| 198 | target_link_libraries(TFileTransportTest |
| 199 | testgencpp |
| 200 | ${Boost_LIBRARIES} |
| 201 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 202 | target_link_libraries(TFileTransportTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 203 | add_test(NAME TFileTransportTest COMMAND TFileTransportTest) |
| Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 204 | endif() |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 205 | |
| 206 | add_executable(TFDTransportTest TFDTransportTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 207 | target_link_libraries(TFDTransportTest |
| 208 | ${Boost_LIBRARIES} |
| 209 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 210 | target_link_libraries(TFDTransportTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 211 | add_test(NAME TFDTransportTest COMMAND TFDTransportTest) |
| 212 | |
| 213 | add_executable(TPipedTransportTest TPipedTransportTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 214 | target_link_libraries(TPipedTransportTest |
| 215 | ${Boost_LIBRARIES} |
| 216 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 217 | target_link_libraries(TPipedTransportTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 218 | add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest) |
| 219 | |
| 220 | set(AllProtocolsTest_SOURCES |
| 221 | AllProtocolTests.cpp |
| 222 | AllProtocolTests.tcc |
| Mario Emmenlauer | f97176b | 2022-01-21 22:55:28 +0100 | [diff] [blame] | 223 | GenericHelpers.h |
| 224 | ) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 225 | |
| 226 | add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES}) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 227 | target_link_libraries(AllProtocolsTest |
| 228 | testgencpp |
| 229 | ${Boost_LIBRARIES} |
| 230 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 231 | target_link_libraries(AllProtocolsTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 232 | add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest) |
| 233 | |
| Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 234 | # The debug run-time in Windows asserts on isprint() with negative inputs |
| 235 | if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG")) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 236 | add_executable(DebugProtoTest DebugProtoTest.cpp) |
| 237 | target_link_libraries(DebugProtoTest |
| 238 | testgencpp |
| 239 | ${Boost_LIBRARIES} |
| 240 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 241 | target_link_libraries(DebugProtoTest thrift) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 242 | add_test(NAME DebugProtoTest COMMAND DebugProtoTest) |
| Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 243 | endif() |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 244 | |
| 245 | add_executable(JSONProtoTest JSONProtoTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 246 | target_link_libraries(JSONProtoTest |
| 247 | testgencpp |
| 248 | ${Boost_LIBRARIES} |
| 249 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 250 | target_link_libraries(JSONProtoTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 251 | add_test(NAME JSONProtoTest COMMAND JSONProtoTest) |
| 252 | |
| 253 | add_executable(OptionalRequiredTest OptionalRequiredTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 254 | target_link_libraries(OptionalRequiredTest |
| 255 | testgencpp |
| 256 | ${Boost_LIBRARIES} |
| 257 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 258 | target_link_libraries(OptionalRequiredTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 259 | add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest) |
| 260 | |
| 261 | add_executable(RecursiveTest RecursiveTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 262 | target_link_libraries(RecursiveTest |
| 263 | testgencpp |
| 264 | ${Boost_LIBRARIES} |
| 265 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 266 | target_link_libraries(RecursiveTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 267 | add_test(NAME RecursiveTest COMMAND RecursiveTest) |
| 268 | |
| 269 | add_executable(SpecializationTest SpecializationTest.cpp) |
| Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 270 | target_link_libraries(SpecializationTest |
| 271 | testgencpp |
| 272 | ${Boost_LIBRARIES} |
| 273 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 274 | target_link_libraries(SpecializationTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 275 | add_test(NAME SpecializationTest COMMAND SpecializationTest) |
| 276 | |
| 277 | set(concurrency_test_SOURCES |
| 278 | concurrency/Tests.cpp |
| 279 | concurrency/ThreadFactoryTests.h |
| 280 | concurrency/ThreadManagerTests.h |
| 281 | concurrency/TimerManagerTests.h |
| 282 | ) |
| 283 | add_executable(concurrency_test ${concurrency_test_SOURCES}) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 284 | target_link_libraries(concurrency_test thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 285 | add_test(NAME concurrency_test COMMAND concurrency_test) |
| 286 | |
| 287 | set(link_test_SOURCES |
| 288 | link/LinkTest.cpp |
| Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 289 | gen-cpp/ParentService.h |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 290 | link/TemplatedService1.cpp |
| 291 | link/TemplatedService2.cpp |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 292 | ) |
| Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 293 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 294 | add_executable(link_test ${link_test_SOURCES}) |
| Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 295 | target_link_libraries(link_test testgencpp_cob) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 296 | target_link_libraries(link_test thrift) |
| Nobuaki Sukegawa | e8c71d8 | 2015-11-23 19:51:37 +0900 | [diff] [blame] | 297 | target_link_libraries(link_test testgencpp) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 298 | add_test(NAME link_test COMMAND link_test) |
| 299 | |
| 300 | if(WITH_LIBEVENT) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 301 | set(processor_test_SOURCES |
| 302 | processor/ProcessorTest.cpp |
| 303 | processor/EventLog.cpp |
| 304 | processor/ServerThread.cpp |
| 305 | processor/EventLog.h |
| 306 | processor/Handlers.h |
| 307 | processor/ServerThread.h |
| 308 | ) |
| 309 | add_executable(processor_test ${processor_test_SOURCES}) |
| 310 | target_link_libraries(processor_test |
| 311 | testgencpp_cob |
| 312 | ${Boost_LIBRARIES} |
| 313 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 314 | target_link_libraries(processor_test thriftnb) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 315 | add_test(NAME processor_test COMMAND processor_test) |
| Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 316 | |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 317 | set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp) |
| 318 | add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES}) |
| 319 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 320 | target_link_libraries(TNonblockingServerTest |
| 321 | testgencpp_cob |
| 322 | ${Boost_LIBRARIES} |
| 323 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 324 | target_link_libraries(TNonblockingServerTest thriftnb) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 325 | add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest) |
| James E. King, III | 82ae957 | 2017-08-05 12:23:54 -0400 | [diff] [blame] | 326 | |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 327 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 328 | set(TNonblockingSSLServerTest_SOURCES TNonblockingSSLServerTest.cpp) |
| 329 | add_executable(TNonblockingSSLServerTest ${TNonblockingSSLServerTest_SOURCES}) |
| 330 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 331 | target_link_libraries(TNonblockingSSLServerTest |
| 332 | testgencpp_cob |
| 333 | ${Boost_LIBRARIES} |
| 334 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 335 | target_link_libraries(TNonblockingSSLServerTest thriftnb) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 336 | add_test(NAME TNonblockingSSLServerTest COMMAND TNonblockingSSLServerTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| 337 | endif(OPENSSL_FOUND AND WITH_OPENSSL) |
| 338 | endif() |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 339 | |
| 340 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 341 | add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp) |
| 342 | target_link_libraries(OpenSSLManualInitTest |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 343 | ${OPENSSL_LIBRARIES} |
| 344 | ${Boost_LIBRARIES} |
| 345 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 346 | target_link_libraries(OpenSSLManualInitTest thrift) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 347 | add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest) |
| Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 348 | |
| 349 | add_executable(SecurityTest SecurityTest.cpp) |
| 350 | target_link_libraries(SecurityTest |
| 351 | testgencpp |
| 352 | ${Boost_LIBRARIES} |
| 353 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 354 | target_link_libraries(SecurityTest thrift) |
| Brad Smith | 7734c39 | 2024-12-09 17:07:56 -0500 | [diff] [blame] | 355 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" AND NOT MINGW) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 356 | target_link_libraries(SecurityTest -lrt) |
| Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 357 | endif () |
| James E. King, III | 07f5997 | 2017-03-10 06:18:33 -0500 | [diff] [blame] | 358 | add_test(NAME SecurityTest COMMAND SecurityTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 359 | |
| Mario Emmenlauer | 0f14e2f | 2019-10-15 11:25:10 +0200 | [diff] [blame] | 360 | add_executable(SecurityFromBufferTest SecurityFromBufferTest.cpp) |
| 361 | target_link_libraries(SecurityFromBufferTest |
| 362 | testgencpp |
| 363 | ${Boost_LIBRARIES} |
| 364 | ) |
| Mario Emmenlauer | bdb54bc | 2021-08-31 14:00:16 +0200 | [diff] [blame] | 365 | target_link_libraries(SecurityFromBufferTest thrift) |
| Brad Smith | 7734c39 | 2024-12-09 17:07:56 -0500 | [diff] [blame] | 366 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" AND NOT MINGW) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 367 | target_link_libraries(SecurityFromBufferTest -lrt) |
| Mario Emmenlauer | 0f14e2f | 2019-10-15 11:25:10 +0200 | [diff] [blame] | 368 | endif () |
| 369 | add_test(NAME SecurityFromBufferTest COMMAND SecurityFromBufferTest -- "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| 370 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 371 | endif() |
| 372 | |
| Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 373 | if(WITH_QT5) |
| Mario Emmenlauer | 9fab238 | 2021-02-04 21:10:43 +0100 | [diff] [blame] | 374 | add_subdirectory(qt) |
| Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 375 | endif() |
| 376 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 377 | # |
| 378 | # Common thrift code generation rules |
| 379 | # |
| Sven Roederer | 4f5bfd8 | 2024-07-17 15:27:24 +0200 | [diff] [blame] | 380 | # files from /test |
| 381 | # |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 382 | |
| James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 383 | add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp |
| 384 | gen-cpp/AnnotationTest_constants.h |
| 385 | gen-cpp/AnnotationTest_types.cpp |
| 386 | gen-cpp/AnnotationTest_types.h |
| 387 | gen-cpp/foo_service.cpp |
| 388 | gen-cpp/foo_service.h |
| 389 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/AnnotationTest.thrift |
| 390 | ) |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 391 | |
| James E. King, III | b4c190b | 2017-02-13 16:39:59 -0500 | [diff] [blame] | 392 | add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h |
| CJCombrink | 1d886ca | 2024-03-23 21:32:28 +0100 | [diff] [blame] | 393 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 394 | ) |
| 395 | |
| 396 | add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 397 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 398 | ) |
| 399 | |
| 400 | add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 401 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 402 | ) |
| 403 | |
| 404 | add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 405 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 406 | ) |
| 407 | |
| 408 | add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 409 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 410 | ) |
| 411 | |
| 412 | add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 413 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 414 | ) |
| 415 | |
| 416 | add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h |
| CJCombrink | 1d886ca | 2024-03-23 21:32:28 +0100 | [diff] [blame] | 417 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 418 | ) |
| 419 | |
| Sven Roederer | 4f5bfd8 | 2024-07-17 15:27:24 +0200 | [diff] [blame] | 420 | # files from /lib/cpp/test |
| 421 | |
| zeshuai007 | 57c2507 | 2020-04-09 11:17:05 +0800 | [diff] [blame] | 422 | add_custom_command(OUTPUT gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h |
| Chet Murthy | ad08a8b | 2017-12-19 15:55:56 -0800 | [diff] [blame] | 423 | COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/OneWayTest.thrift |
| 424 | ) |
| 425 | |
| Sven Roederer | 4f5bfd8 | 2024-07-17 15:27:24 +0200 | [diff] [blame] | 426 | add_custom_command(OUTPUT gen-cpp/Thrift5272_types.cpp gen-cpp/Thrift5272_types.h |
| 427 | COMMAND ${THRIFT_COMPILER} --gen cpp ${CMAKE_CURRENT_SOURCE_DIR}/Thrift5272.thrift |
| 428 | ) |
| 429 | |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 430 | add_custom_command(OUTPUT gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h |
| Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 431 | COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift |
| Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 432 | ) |