Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 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 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 20 | # Find required packages |
| 21 | set(Boost_USE_STATIC_LIBS ON) # Force the use of static boost test framework |
Jim King | b0b710a | 2015-07-28 13:31:27 -0400 | [diff] [blame] | 22 | find_package(Boost 1.53.0 REQUIRED COMPONENTS chrono filesystem system thread unit_test_framework) |
Nobuaki Sukegawa | c444fb5 | 2015-01-02 23:16:55 +0900 | [diff] [blame] | 23 | include_directories(SYSTEM "${Boost_INCLUDE_DIRS}") |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 24 | include_directories(SYSTEM "${ZLIB_INCLUDE_DIRS}") |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 25 | |
| 26 | #Make sure gen-cpp files can be included |
| 27 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
| 28 | |
| 29 | # Create the thrift C++ test library |
| 30 | set(testgencpp_SOURCES |
| 31 | gen-cpp/DebugProtoTest_types.cpp |
| 32 | gen-cpp/DebugProtoTest_types.h |
| 33 | gen-cpp/EnumTest_types.cpp |
| 34 | gen-cpp/EnumTest_types.h |
| 35 | gen-cpp/OptionalRequiredTest_types.cpp |
| 36 | gen-cpp/OptionalRequiredTest_types.h |
| 37 | gen-cpp/Recursive_types.cpp |
| 38 | gen-cpp/Recursive_types.h |
| 39 | gen-cpp/ThriftTest_types.cpp |
| 40 | gen-cpp/ThriftTest_types.h |
| 41 | gen-cpp/TypedefTest_types.cpp |
| 42 | gen-cpp/TypedefTest_types.h |
| 43 | ThriftTest_extras.cpp |
| 44 | DebugProtoTest_extras.cpp |
| 45 | ) |
| 46 | |
| 47 | add_library(testgencpp STATIC ${testgencpp_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 48 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 49 | set(testgencpp_cob_SOURCES |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 50 | gen-cpp/ChildService.cpp |
| 51 | gen-cpp/ChildService.h |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 52 | gen-cpp/EmptyService.cpp |
| 53 | gen-cpp/EmptyService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 54 | gen-cpp/ParentService.cpp |
| 55 | gen-cpp/ParentService.h |
| 56 | gen-cpp/proc_types.cpp |
| 57 | gen-cpp/proc_types.h |
| 58 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 59 | add_library(testgencpp_cob STATIC ${testgencpp_cob_SOURCES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 60 | |
| 61 | |
| 62 | add_executable(Benchmark Benchmark.cpp) |
| 63 | target_link_libraries(Benchmark testgencpp) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 64 | LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 65 | add_test(NAME Benchmark COMMAND Benchmark) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 66 | target_link_libraries(Benchmark testgencpp ${ZLIB_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 67 | |
| 68 | set(UnitTest_SOURCES |
| 69 | UnitTestMain.cpp |
| 70 | TMemoryBufferTest.cpp |
| 71 | TBufferBaseTest.cpp |
| 72 | Base64Test.cpp |
| 73 | ToStringTest.cpp |
| 74 | TypedefTest.cpp |
Roger Meier | 3815e0b | 2015-04-04 16:26:30 +0200 | [diff] [blame] | 75 | TServerSocketTest.cpp |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 76 | TServerTransportTest.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 77 | ) |
| 78 | |
Roger Meier | a6b6633 | 2015-05-15 15:21:50 +0200 | [diff] [blame] | 79 | if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 80 | list(APPEND UnitTest_SOURCES RWMutexStarveTest.cpp) |
| 81 | endif() |
| 82 | |
| 83 | add_executable(UnitTests ${UnitTest_SOURCES}) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 84 | target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES} |
| 85 | ${ZLIB_LIBRARIES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 86 | LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 87 | add_test(NAME UnitTests COMMAND UnitTests) |
ben-craig | fae08e7 | 2015-07-15 11:34:47 -0500 | [diff] [blame] | 88 | if ( MSVC ) |
| 89 | # Disable C4503: decorated name length exceeded, name was truncated |
| 90 | # 'insanity' results in very long decorated names |
| 91 | set_property( TARGET UnitTests APPEND_STRING PROPERTY COMPILE_FLAGS /wd4503 ) |
| 92 | endif ( MSVC ) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 93 | |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 94 | |
Martin Haimberger | 0ad6ee9 | 2015-11-13 03:18:50 -0800 | [diff] [blame] | 95 | set( TInterruptTest_SOURCES |
| 96 | TSocketInterruptTest.cpp |
| 97 | TSSLSocketInterruptTest.cpp |
| 98 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 99 | if (WIN32) |
| 100 | list(APPEND TInterruptTest_SOURCES |
| 101 | TPipeInterruptTest.cpp |
| 102 | ) |
| 103 | endif() |
| 104 | add_executable(TInterruptTest ${TInterruptTest_SOURCES}) |
| 105 | target_link_libraries(TInterruptTest |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 106 | testgencpp |
| 107 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 108 | ${ZLIB_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 109 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 110 | LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift) |
Thomas Bartelmess | 9e78ed8 | 2015-05-01 13:57:44 -0400 | [diff] [blame] | 111 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 112 | target_link_libraries(TInterruptTest -lrt) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 113 | endif () |
Martin Haimberger | 0ad6ee9 | 2015-11-13 03:18:50 -0800 | [diff] [blame] | 114 | add_test(NAME TInterruptTest COMMAND TInterruptTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 115 | |
| 116 | add_executable(TServerIntegrationTest TServerIntegrationTest.cpp) |
| 117 | target_link_libraries(TServerIntegrationTest |
| 118 | testgencpp_cob |
| 119 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 120 | ${ZLIB_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 121 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 122 | LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift) |
Thomas Bartelmess | 9e78ed8 | 2015-05-01 13:57:44 -0400 | [diff] [blame] | 123 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 124 | target_link_libraries(TServerIntegrationTest -lrt) |
| 125 | endif () |
| 126 | add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 127 | |
| 128 | if(WITH_ZLIB) |
| 129 | add_executable(TransportTest TransportTest.cpp) |
| 130 | target_link_libraries(TransportTest |
| 131 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 132 | ${Boost_LIBRARIES} |
| 133 | ${ZLIB_LIBRARIES} |
| 134 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 135 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift) |
| 136 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 137 | add_test(NAME TransportTest COMMAND TransportTest) |
| 138 | |
| 139 | add_executable(ZlibTest ZlibTest.cpp) |
| 140 | target_link_libraries(ZlibTest |
| 141 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 142 | ${Boost_LIBRARIES} |
| 143 | ${ZLIB_LIBRARIES} |
| 144 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 145 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift) |
| 146 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 147 | add_test(NAME ZlibTest COMMAND ZlibTest) |
| 148 | endif(WITH_ZLIB) |
| 149 | |
| 150 | |
| 151 | add_executable(EnumTest EnumTest.cpp) |
| 152 | target_link_libraries(EnumTest |
| 153 | testgencpp |
| 154 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 155 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 156 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 157 | LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 158 | add_test(NAME EnumTest COMMAND EnumTest) |
| 159 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 160 | if(HAVE_GETOPT_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 161 | add_executable(TFileTransportTest TFileTransportTest.cpp) |
| 162 | target_link_libraries(TFileTransportTest |
| 163 | testgencpp |
| 164 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 165 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 166 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 167 | LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 168 | add_test(NAME TFileTransportTest COMMAND TFileTransportTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 169 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 170 | |
| 171 | add_executable(TFDTransportTest TFDTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 172 | target_link_libraries(TFDTransportTest |
| 173 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 174 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 175 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 176 | LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 177 | add_test(NAME TFDTransportTest COMMAND TFDTransportTest) |
| 178 | |
| 179 | add_executable(TPipedTransportTest TPipedTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 180 | target_link_libraries(TPipedTransportTest |
| 181 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 182 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 183 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 184 | LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 185 | add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest) |
| 186 | |
| 187 | set(AllProtocolsTest_SOURCES |
| 188 | AllProtocolTests.cpp |
| 189 | AllProtocolTests.tcc |
| 190 | GenericHelpers |
| 191 | ) |
| 192 | |
| 193 | add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES}) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 194 | target_link_libraries(AllProtocolsTest |
| 195 | testgencpp |
| 196 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 197 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 198 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 199 | LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 200 | add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest) |
| 201 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 202 | # The debug run-time in Windows asserts on isprint() with negative inputs |
| 203 | if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG")) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 204 | add_executable(DebugProtoTest DebugProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 205 | target_link_libraries(DebugProtoTest |
| 206 | testgencpp |
| 207 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 208 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 209 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 210 | LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 211 | add_test(NAME DebugProtoTest COMMAND DebugProtoTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 212 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 213 | |
| 214 | add_executable(JSONProtoTest JSONProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 215 | target_link_libraries(JSONProtoTest |
| 216 | testgencpp |
| 217 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 218 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 219 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 220 | LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 221 | add_test(NAME JSONProtoTest COMMAND JSONProtoTest) |
| 222 | |
| 223 | add_executable(OptionalRequiredTest OptionalRequiredTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 224 | target_link_libraries(OptionalRequiredTest |
| 225 | testgencpp |
| 226 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 227 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 228 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 229 | LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 230 | add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest) |
| 231 | |
| 232 | add_executable(RecursiveTest RecursiveTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 233 | target_link_libraries(RecursiveTest |
| 234 | testgencpp |
| 235 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 236 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 237 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 238 | LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 239 | add_test(NAME RecursiveTest COMMAND RecursiveTest) |
| 240 | |
| 241 | add_executable(SpecializationTest SpecializationTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 242 | target_link_libraries(SpecializationTest |
| 243 | testgencpp |
| 244 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 245 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 246 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 247 | LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 248 | add_test(NAME SpecializationTest COMMAND SpecializationTest) |
| 249 | |
| 250 | set(concurrency_test_SOURCES |
| 251 | concurrency/Tests.cpp |
| 252 | concurrency/ThreadFactoryTests.h |
| 253 | concurrency/ThreadManagerTests.h |
| 254 | concurrency/TimerManagerTests.h |
| 255 | ) |
| 256 | add_executable(concurrency_test ${concurrency_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 257 | LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 258 | add_test(NAME concurrency_test COMMAND concurrency_test) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 259 | target_link_libraries(concurrency_test ${ZLIB_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 260 | |
| 261 | set(link_test_SOURCES |
| 262 | link/LinkTest.cpp |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 263 | gen-cpp/ParentService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 264 | link/TemplatedService1.cpp |
| 265 | link/TemplatedService2.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 266 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 267 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 268 | add_executable(link_test ${link_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 269 | target_link_libraries(link_test testgencpp_cob) |
| 270 | LINK_AGAINST_THRIFT_LIBRARY(link_test thrift) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 271 | target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 272 | add_test(NAME link_test COMMAND link_test) |
| 273 | |
| 274 | if(WITH_LIBEVENT) |
| 275 | set(processor_test_SOURCES |
| 276 | processor/ProcessorTest.cpp |
| 277 | processor/EventLog.cpp |
| 278 | processor/ServerThread.cpp |
| 279 | processor/EventLog.h |
| 280 | processor/Handlers.h |
| 281 | processor/ServerThread.h |
| 282 | ) |
| 283 | add_executable(processor_test ${processor_test_SOURCES}) |
| 284 | target_link_libraries(processor_test |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 285 | testgencpp_cob |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 286 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 287 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 288 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 289 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift) |
| 290 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 291 | add_test(NAME processor_test COMMAND processor_test) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 292 | |
| 293 | set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp) |
| 294 | add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES}) |
| 295 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 296 | target_link_libraries(TNonblockingServerTest |
| 297 | testgencpp_cob |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 298 | ${LIBEVENT_LIBRARIES} |
| 299 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 300 | ${ZLIB_LIBRARIES} |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 301 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 302 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift) |
| 303 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 304 | add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 305 | endif() |
| 306 | |
| 307 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 308 | add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp) |
| 309 | target_link_libraries(OpenSSLManualInitTest |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 310 | ${OPENSSL_LIBRARIES} |
| 311 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 312 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 313 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 314 | LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 315 | add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 316 | |
| 317 | add_executable(SecurityTest SecurityTest.cpp) |
| 318 | target_link_libraries(SecurityTest |
| 319 | testgencpp |
| 320 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 321 | ${ZLIB_LIBRARIES} |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 322 | ) |
| 323 | LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift) |
| 324 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 325 | target_link_libraries(SecurityTest -lrt) |
| 326 | endif () |
| 327 | add_test(NAME SecurityTest COMMAND SecurityTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| 328 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 329 | endif() |
| 330 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 331 | if(WITH_QT4) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 332 | set(CMAKE_AUTOMOC ON) |
| 333 | find_package(Qt4 REQUIRED COMPONENTS QtTest) |
| 334 | set(TQTcpServerTest_SOURCES |
| 335 | qt/TQTcpServerTest.cpp |
| 336 | ) |
| 337 | add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 338 | target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest) |
| 339 | LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 340 | add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest) |
| 341 | endif() |
| 342 | |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 343 | if(WITH_QT5) |
| 344 | add_subdirectory(qt) |
| 345 | endif() |
| 346 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 347 | # |
| 348 | # Common thrift code generation rules |
| 349 | # |
| 350 | |
| 351 | |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 352 | add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 353 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 354 | ) |
| 355 | |
| 356 | 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] | 357 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 358 | ) |
| 359 | |
| 360 | 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] | 361 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 362 | ) |
| 363 | |
| 364 | 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] | 365 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 366 | ) |
| 367 | |
| 368 | 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] | 369 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 370 | ) |
| 371 | |
| 372 | 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] | 373 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 374 | ) |
| 375 | |
| 376 | 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 |
Nobuaki Sukegawa | ca93936 | 2015-11-14 00:23:40 +0900 | [diff] [blame] | 377 | COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 378 | ) |
| 379 | |
| 380 | 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] | 381 | 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] | 382 | ) |