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 | |
| 95 | set( TInterruptTest_SOURCES TSocketInterruptTest.cpp ) |
| 96 | if (WIN32) |
| 97 | list(APPEND TInterruptTest_SOURCES |
| 98 | TPipeInterruptTest.cpp |
| 99 | ) |
| 100 | endif() |
| 101 | add_executable(TInterruptTest ${TInterruptTest_SOURCES}) |
| 102 | target_link_libraries(TInterruptTest |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 103 | testgencpp |
| 104 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 105 | ${ZLIB_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 106 | ) |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 107 | LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift) |
Thomas Bartelmess | 9e78ed8 | 2015-05-01 13:57:44 -0400 | [diff] [blame] | 108 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 109 | target_link_libraries(TInterruptTest -lrt) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 110 | endif () |
ben-craig | af2d9c8 | 2015-07-16 08:11:21 -0500 | [diff] [blame] | 111 | add_test(NAME TInterruptTest COMMAND TInterruptTest) |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 112 | |
| 113 | add_executable(TServerIntegrationTest TServerIntegrationTest.cpp) |
| 114 | target_link_libraries(TServerIntegrationTest |
| 115 | testgencpp_cob |
| 116 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 117 | ${ZLIB_LIBRARIES} |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 118 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 119 | LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift) |
Thomas Bartelmess | 9e78ed8 | 2015-05-01 13:57:44 -0400 | [diff] [blame] | 120 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 121 | target_link_libraries(TServerIntegrationTest -lrt) |
| 122 | endif () |
| 123 | add_test(NAME TServerIntegrationTest COMMAND TServerIntegrationTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 124 | |
| 125 | if(WITH_ZLIB) |
| 126 | add_executable(TransportTest TransportTest.cpp) |
| 127 | target_link_libraries(TransportTest |
| 128 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 129 | ${Boost_LIBRARIES} |
| 130 | ${ZLIB_LIBRARIES} |
| 131 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 132 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thrift) |
| 133 | LINK_AGAINST_THRIFT_LIBRARY(TransportTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 134 | add_test(NAME TransportTest COMMAND TransportTest) |
| 135 | |
| 136 | add_executable(ZlibTest ZlibTest.cpp) |
| 137 | target_link_libraries(ZlibTest |
| 138 | testgencpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 139 | ${Boost_LIBRARIES} |
| 140 | ${ZLIB_LIBRARIES} |
| 141 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 142 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thrift) |
| 143 | LINK_AGAINST_THRIFT_LIBRARY(ZlibTest thriftz) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 144 | add_test(NAME ZlibTest COMMAND ZlibTest) |
| 145 | endif(WITH_ZLIB) |
| 146 | |
| 147 | |
| 148 | add_executable(EnumTest EnumTest.cpp) |
| 149 | target_link_libraries(EnumTest |
| 150 | testgencpp |
| 151 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 152 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 153 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 154 | LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 155 | add_test(NAME EnumTest COMMAND EnumTest) |
| 156 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 157 | if(HAVE_GETOPT_H) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 158 | add_executable(TFileTransportTest TFileTransportTest.cpp) |
| 159 | target_link_libraries(TFileTransportTest |
| 160 | testgencpp |
| 161 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 162 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 163 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 164 | LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 165 | add_test(NAME TFileTransportTest COMMAND TFileTransportTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 166 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 167 | |
| 168 | add_executable(TFDTransportTest TFDTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 169 | target_link_libraries(TFDTransportTest |
| 170 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 171 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 172 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 173 | LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 174 | add_test(NAME TFDTransportTest COMMAND TFDTransportTest) |
| 175 | |
| 176 | add_executable(TPipedTransportTest TPipedTransportTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 177 | target_link_libraries(TPipedTransportTest |
| 178 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 179 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 180 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 181 | LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 182 | add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest) |
| 183 | |
| 184 | set(AllProtocolsTest_SOURCES |
| 185 | AllProtocolTests.cpp |
| 186 | AllProtocolTests.tcc |
| 187 | GenericHelpers |
| 188 | ) |
| 189 | |
| 190 | add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES}) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 191 | target_link_libraries(AllProtocolsTest |
| 192 | testgencpp |
| 193 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 194 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 195 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 196 | LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 197 | add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest) |
| 198 | |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 199 | # The debug run-time in Windows asserts on isprint() with negative inputs |
| 200 | if (NOT MSVC OR (MSVC AND CMAKE_BUILD_TYPE EQUAL "DEBUG")) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 201 | add_executable(DebugProtoTest DebugProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 202 | target_link_libraries(DebugProtoTest |
| 203 | testgencpp |
| 204 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 205 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 206 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 207 | LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 208 | add_test(NAME DebugProtoTest COMMAND DebugProtoTest) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 209 | endif() |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 210 | |
| 211 | add_executable(JSONProtoTest JSONProtoTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 212 | target_link_libraries(JSONProtoTest |
| 213 | testgencpp |
| 214 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 215 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 216 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 217 | LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 218 | add_test(NAME JSONProtoTest COMMAND JSONProtoTest) |
| 219 | |
| 220 | add_executable(OptionalRequiredTest OptionalRequiredTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 221 | target_link_libraries(OptionalRequiredTest |
| 222 | testgencpp |
| 223 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 224 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 225 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 226 | LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 227 | add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest) |
| 228 | |
| 229 | add_executable(RecursiveTest RecursiveTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 230 | target_link_libraries(RecursiveTest |
| 231 | testgencpp |
| 232 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 233 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 234 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 235 | LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 236 | add_test(NAME RecursiveTest COMMAND RecursiveTest) |
| 237 | |
| 238 | add_executable(SpecializationTest SpecializationTest.cpp) |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 239 | target_link_libraries(SpecializationTest |
| 240 | testgencpp |
| 241 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 242 | ${ZLIB_LIBRARIES} |
Claudius Heine | 5ef662b | 2015-06-24 10:03:50 +0200 | [diff] [blame] | 243 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 244 | LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 245 | add_test(NAME SpecializationTest COMMAND SpecializationTest) |
| 246 | |
| 247 | set(concurrency_test_SOURCES |
| 248 | concurrency/Tests.cpp |
| 249 | concurrency/ThreadFactoryTests.h |
| 250 | concurrency/ThreadManagerTests.h |
| 251 | concurrency/TimerManagerTests.h |
| 252 | ) |
| 253 | add_executable(concurrency_test ${concurrency_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 254 | LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 255 | add_test(NAME concurrency_test COMMAND concurrency_test) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 256 | target_link_libraries(concurrency_test ${ZLIB_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 257 | |
| 258 | set(link_test_SOURCES |
| 259 | link/LinkTest.cpp |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 260 | gen-cpp/ParentService.h |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 261 | link/TemplatedService1.cpp |
| 262 | link/TemplatedService2.cpp |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 263 | ) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 264 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 265 | add_executable(link_test ${link_test_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 266 | target_link_libraries(link_test testgencpp_cob) |
| 267 | LINK_AGAINST_THRIFT_LIBRARY(link_test thrift) |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 268 | target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES}) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 269 | add_test(NAME link_test COMMAND link_test) |
| 270 | |
| 271 | if(WITH_LIBEVENT) |
| 272 | set(processor_test_SOURCES |
| 273 | processor/ProcessorTest.cpp |
| 274 | processor/EventLog.cpp |
| 275 | processor/ServerThread.cpp |
| 276 | processor/EventLog.h |
| 277 | processor/Handlers.h |
| 278 | processor/ServerThread.h |
| 279 | ) |
| 280 | add_executable(processor_test ${processor_test_SOURCES}) |
| 281 | target_link_libraries(processor_test |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 282 | testgencpp_cob |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 283 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 284 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 285 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 286 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift) |
| 287 | LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 288 | add_test(NAME processor_test COMMAND processor_test) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 289 | |
| 290 | set(TNonblockingServerTest_SOURCES TNonblockingServerTest.cpp) |
| 291 | add_executable(TNonblockingServerTest ${TNonblockingServerTest_SOURCES}) |
| 292 | include_directories(${LIBEVENT_INCLUDE_DIRS}) |
| 293 | target_link_libraries(TNonblockingServerTest |
| 294 | testgencpp_cob |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 295 | ${LIBEVENT_LIBRARIES} |
| 296 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 297 | ${ZLIB_LIBRARIES} |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 298 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 299 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift) |
| 300 | LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb) |
Nobuaki Sukegawa | 8016af8 | 2015-01-02 23:14:22 +0900 | [diff] [blame] | 301 | add_test(NAME TNonblockingServerTest COMMAND TNonblockingServerTest) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 302 | endif() |
| 303 | |
| 304 | if(OPENSSL_FOUND AND WITH_OPENSSL) |
| 305 | add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp) |
| 306 | target_link_libraries(OpenSSLManualInitTest |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 307 | ${OPENSSL_LIBRARIES} |
| 308 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 309 | ${ZLIB_LIBRARIES} |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 310 | ) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 311 | LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift) |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 312 | add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest) |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 313 | |
| 314 | add_executable(SecurityTest SecurityTest.cpp) |
| 315 | target_link_libraries(SecurityTest |
| 316 | testgencpp |
| 317 | ${Boost_LIBRARIES} |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 318 | ${ZLIB_LIBRARIES} |
Sergei Nikulov | 34e0bb6 | 2015-09-02 13:06:22 +0300 | [diff] [blame] | 319 | ) |
| 320 | LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift) |
| 321 | if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 322 | target_link_libraries(SecurityTest -lrt) |
| 323 | endif () |
| 324 | add_test(NAME SecurityTest COMMAND SecurityTest "${CMAKE_CURRENT_SOURCE_DIR}/../../../test/keys") |
| 325 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 326 | endif() |
| 327 | |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 328 | if(WITH_QT4) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 329 | set(CMAKE_AUTOMOC ON) |
| 330 | find_package(Qt4 REQUIRED COMPONENTS QtTest) |
| 331 | set(TQTcpServerTest_SOURCES |
| 332 | qt/TQTcpServerTest.cpp |
| 333 | ) |
| 334 | add_executable(TQTcpServerTest ${TQTcpServerTest_SOURCES}) |
Jim King | 9de9b1f | 2015-04-30 16:03:34 -0400 | [diff] [blame] | 335 | target_link_libraries(TQTcpServerTest testgencpp_cob thriftqt Qt4::QtTest) |
| 336 | LINK_AGAINST_THRIFT_LIBRARY(TQTcpServerTest thrift) |
Nobuaki Sukegawa | 6304a53 | 2014-12-18 01:30:58 +0900 | [diff] [blame] | 337 | add_test(NAME TQTcpServerTest COMMAND TQTcpServerTest) |
| 338 | endif() |
| 339 | |
Nobuaki Sukegawa | 6622877 | 2014-12-07 21:45:33 +0900 | [diff] [blame] | 340 | if(WITH_QT5) |
| 341 | add_subdirectory(qt) |
| 342 | endif() |
| 343 | |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 344 | # |
| 345 | # Common thrift code generation rules |
| 346 | # |
| 347 | |
| 348 | |
Ben Craig | 1684c42 | 2015-04-24 08:52:44 -0500 | [diff] [blame] | 349 | add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h |
Randy Abernethy | 8dbe5f6 | 2015-08-01 22:57:02 -0700 | [diff] [blame] | 350 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 351 | ) |
| 352 | |
| 353 | add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h |
| 354 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/EnumTest.thrift |
| 355 | ) |
| 356 | |
| 357 | add_custom_command(OUTPUT gen-cpp/TypedefTest_types.cpp gen-cpp/TypedefTest_types.h |
| 358 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/TypedefTest.thrift |
| 359 | ) |
| 360 | |
| 361 | add_custom_command(OUTPUT gen-cpp/OptionalRequiredTest_types.cpp gen-cpp/OptionalRequiredTest_types.h |
Randy Abernethy | 8dbe5f6 | 2015-08-01 22:57:02 -0700 | [diff] [blame] | 362 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/OptionalRequiredTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 363 | ) |
| 364 | |
| 365 | add_custom_command(OUTPUT gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h |
| 366 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/Recursive.thrift |
| 367 | ) |
| 368 | |
| 369 | add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp |
Randy Abernethy | 8dbe5f6 | 2015-08-01 22:57:02 -0700 | [diff] [blame] | 370 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/StressTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 371 | ) |
| 372 | |
| 373 | 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 |
Randy Abernethy | 8dbe5f6 | 2015-08-01 22:57:02 -0700 | [diff] [blame] | 374 | COMMAND thrift-compiler --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift |
Pascal Bach | d5f87e1 | 2014-12-12 15:59:17 +0100 | [diff] [blame] | 375 | ) |
| 376 | |
| 377 | 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 |
| 378 | COMMAND thrift-compiler --gen cpp:templates,cob_style ${CMAKE_CURRENT_SOURCE_DIR}/processor/proc.thrift |
| 379 | ) |