Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,62 @@

# build Apache Thrift on AppVeyor - https://ci.appveyor.com

shallow_clone: true
clone_depth: 10

version: '{build}'
os:
- Windows Server 2012 R2
- Visual Studio 2014 CTP4
- Visual Studio 2015 CTP
- Visual Studio 2015 CTP 6
- Visual Studio 2015 Preview
# - Windows Server 2012 R2
- Visual Studio 2015

environment:
BOOST_ROOT: c:\Libraries\boost
BOOST_LIBRARYDIR: c:\Libraries\boost\stage\lib

install:
- cinst cmake
- cinst nsis
- cinst ant
- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64'
# Zlib
- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz
- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar
- cd zlib-1.2.8
- cmake -G "Visual Studio 14 2015 Win64" .
- cmake --build . --config release
- cd ..
# OpenSSL
- appveyor DownloadFile https://slproweb.com/download/Win64OpenSSL-1_0_2d.exe
- ps: Start-Process Win64OpenSSL-1_0_2d.exe -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait
# Libevent
- appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
- 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar
- cd libevent-2.0.22-stable
- nmake -f Makefile.nmake
- mkdir lib
- move *.lib lib\
- move WIN32-Code\event2\* include\event2\
- move *.h include\
- cd ..
- cinst winflexbison
- cinst nsis
# TODO: Enable Java build
# - cinst ant -ignoreDependencies
# TODO: Enable Haskell build
# - cinst HaskellPlatform -version 2014.2.0.0


build_script:
- set PATH=C:\ProgramData\chocolatey\bin;C:\tools\apache-ant-1.9.4\bin;%PATH%
- mv C:\ProgramData\chocolatey\bin\win_bison.exe C:\ProgramData\chocolatey\bin\bison.exe
- mv C:\ProgramData\chocolatey\bin\win_flex.exe C:\ProgramData\chocolatey\bin\flex.exe
- set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
- set PATH=%JAVA_HOME%\bin;%PATH%
# - set PATH=C:\ProgramData\chocolatey\bin;C:\tools\apache-ant-1.9.4\bin;%PATH%
# - set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
# - set PATH=%JAVA_HOME%\bin;%PATH%
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
- set PATH=C:\Python27-x64;%PATH%
- mkdir cmake-build
- cd cmake-build
- cmake -DBUILD_TESTING=OFF ..
- cmake --build .
- cmake -G "Visual Studio 14 2015 Win64" -DWITH_JAVA=OFF -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=%APPVEYOR_BUILD_FOLDER%\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8 -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT% -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR% ..
# - cmake --build .
- cmake --build . --config Release
- cpack
# TODO: Fix cpack
# - cpack
- ctest -C Release -VV -E "(concurrency_test|processor_test|python_test$)"

#TODO enable testing
#TODO make it perfect ;-r
4 changes: 4 additions & 0 deletions build/cmake/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON
# but in future other libraries might reuse them.
# So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
# has no effect.
if(ZLIB_LIBRARY)
# FindZLIB.cmake does not normalize path so we need to do it ourselves.
file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
endif()
find_package(ZLIB QUIET)
CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
"ZLIB_FOUND" OFF)
Expand Down
6 changes: 4 additions & 2 deletions build/cmake/FindLibevent.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
# LIBEVENT_LIBRARIES, LibEvent libraries
# Libevent_FOUND, If false, do not try to use libevent

set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}")
set(LIBEVENT_ROOT CACHE PATH "Root directory of libevent installation")
set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}" ${LIBEVENT_ROOT})
foreach(prefix ${LibEvent_EXTRA_PREFIXES})
list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
list(APPEND LibEvent_LIBRARIES_PATHS "${prefix}/lib")
endforeach()

find_path(LIBEVENT_INCLUDE_DIRS event.h PATHS ${LibEvent_INCLUDE_PATHS})
find_library(LIBEVENT_LIBRARIES NAMES event PATHS ${LibEvent_LIBRARIES_PATHS})
# "lib" prefix is needed on Windows
find_library(LIBEVENT_LIBRARIES NAMES event libevent PATHS ${LibEvent_LIBRARIES_PATHS})

if (LIBEVENT_LIBRARIES AND LIBEVENT_INCLUDE_DIRS)
set(Libevent_FOUND TRUE)
Expand Down
24 changes: 3 additions & 21 deletions lib/cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ add_executable(Benchmark Benchmark.cpp)
target_link_libraries(Benchmark testgencpp)
LINK_AGAINST_THRIFT_LIBRARY(Benchmark thrift)
add_test(NAME Benchmark COMMAND Benchmark)
target_link_libraries(Benchmark testgencpp ${ZLIB_LIBRARIES})
target_link_libraries(Benchmark testgencpp)

set(UnitTest_SOURCES
UnitTestMain.cpp
Expand All @@ -81,8 +81,7 @@ if(NOT WITH_BOOSTTHREADS AND NOT WITH_STDTHREADS AND NOT MSVC)
endif()

add_executable(UnitTests ${UnitTest_SOURCES})
target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES}
${ZLIB_LIBRARIES})
target_link_libraries(UnitTests testgencpp ${Boost_LIBRARIES})
LINK_AGAINST_THRIFT_LIBRARY(UnitTests thrift)
add_test(NAME UnitTests COMMAND UnitTests)
if ( MSVC )
Expand All @@ -105,7 +104,6 @@ add_executable(TInterruptTest ${TInterruptTest_SOURCES})
target_link_libraries(TInterruptTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TInterruptTest thrift)
if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand All @@ -117,7 +115,6 @@ add_executable(TServerIntegrationTest TServerIntegrationTest.cpp)
target_link_libraries(TServerIntegrationTest
testgencpp_cob
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TServerIntegrationTest thrift)
if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down Expand Up @@ -152,7 +149,6 @@ add_executable(EnumTest EnumTest.cpp)
target_link_libraries(EnumTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(EnumTest thrift)
add_test(NAME EnumTest COMMAND EnumTest)
Expand All @@ -162,7 +158,6 @@ add_executable(TFileTransportTest TFileTransportTest.cpp)
target_link_libraries(TFileTransportTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TFileTransportTest thrift)
add_test(NAME TFileTransportTest COMMAND TFileTransportTest)
Expand All @@ -171,15 +166,13 @@ endif()
add_executable(TFDTransportTest TFDTransportTest.cpp)
target_link_libraries(TFDTransportTest
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TFDTransportTest thrift)
add_test(NAME TFDTransportTest COMMAND TFDTransportTest)

add_executable(TPipedTransportTest TPipedTransportTest.cpp)
target_link_libraries(TPipedTransportTest
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TPipedTransportTest thrift)
add_test(NAME TPipedTransportTest COMMAND TPipedTransportTest)
Expand All @@ -194,7 +187,6 @@ add_executable(AllProtocolsTest ${AllProtocolsTest_SOURCES})
target_link_libraries(AllProtocolsTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(AllProtocolsTest thrift)
add_test(NAME AllProtocolsTest COMMAND AllProtocolsTest)
Expand All @@ -205,7 +197,6 @@ add_executable(DebugProtoTest DebugProtoTest.cpp)
target_link_libraries(DebugProtoTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(DebugProtoTest thrift)
add_test(NAME DebugProtoTest COMMAND DebugProtoTest)
Expand All @@ -215,7 +206,6 @@ add_executable(JSONProtoTest JSONProtoTest.cpp)
target_link_libraries(JSONProtoTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(JSONProtoTest thrift)
add_test(NAME JSONProtoTest COMMAND JSONProtoTest)
Expand All @@ -224,7 +214,6 @@ add_executable(OptionalRequiredTest OptionalRequiredTest.cpp)
target_link_libraries(OptionalRequiredTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(OptionalRequiredTest thrift)
add_test(NAME OptionalRequiredTest COMMAND OptionalRequiredTest)
Expand All @@ -233,7 +222,6 @@ add_executable(RecursiveTest RecursiveTest.cpp)
target_link_libraries(RecursiveTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(RecursiveTest thrift)
add_test(NAME RecursiveTest COMMAND RecursiveTest)
Expand All @@ -242,7 +230,6 @@ add_executable(SpecializationTest SpecializationTest.cpp)
target_link_libraries(SpecializationTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(SpecializationTest thrift)
add_test(NAME SpecializationTest COMMAND SpecializationTest)
Expand All @@ -256,7 +243,6 @@ set(concurrency_test_SOURCES
add_executable(concurrency_test ${concurrency_test_SOURCES})
LINK_AGAINST_THRIFT_LIBRARY(concurrency_test thrift)
add_test(NAME concurrency_test COMMAND concurrency_test)
target_link_libraries(concurrency_test ${ZLIB_LIBRARIES})

set(link_test_SOURCES
link/LinkTest.cpp
Expand All @@ -268,7 +254,7 @@ set(link_test_SOURCES
add_executable(link_test ${link_test_SOURCES})
target_link_libraries(link_test testgencpp_cob)
LINK_AGAINST_THRIFT_LIBRARY(link_test thrift)
target_link_libraries(link_test testgencpp ${ZLIB_LIBRARIES})
target_link_libraries(link_test testgencpp)
add_test(NAME link_test COMMAND link_test)

if(WITH_LIBEVENT)
Expand All @@ -284,7 +270,6 @@ add_executable(processor_test ${processor_test_SOURCES})
target_link_libraries(processor_test
testgencpp_cob
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(processor_test thrift)
LINK_AGAINST_THRIFT_LIBRARY(processor_test thriftnb)
Expand All @@ -297,7 +282,6 @@ target_link_libraries(TNonblockingServerTest
testgencpp_cob
${LIBEVENT_LIBRARIES}
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thrift)
LINK_AGAINST_THRIFT_LIBRARY(TNonblockingServerTest thriftnb)
Expand All @@ -309,7 +293,6 @@ add_executable(OpenSSLManualInitTest OpenSSLManualInitTest.cpp)
target_link_libraries(OpenSSLManualInitTest
${OPENSSL_LIBRARIES}
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(OpenSSLManualInitTest thrift)
add_test(NAME OpenSSLManualInitTest COMMAND OpenSSLManualInitTest)
Expand All @@ -318,7 +301,6 @@ add_executable(SecurityTest SecurityTest.cpp)
target_link_libraries(SecurityTest
testgencpp
${Boost_LIBRARIES}
${ZLIB_LIBRARIES}
)
LINK_AGAINST_THRIFT_LIBRARY(SecurityTest thrift)
if (NOT MSVC AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down
9 changes: 8 additions & 1 deletion lib/hs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ foreach(SRC ${haskell_sources})
endif()
endforeach()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(hs_optimize -O0)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(hs_optimize -O1)
endif()

add_custom_command(
OUTPUT ${haskell_artifacts}
COMMAND ${CABAL} update
# Build dependencies first without --builddir, otherwise it fails.
COMMAND ${CABAL} install --dependencies-only
COMMAND ${CABAL} install --only-dependencies
COMMAND ${CABAL} configure ${hs_optimize}
COMMAND ${CABAL} install --builddir=${CMAKE_CURRENT_BINARY_DIR}/dist
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/thrift_cabal.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
11 changes: 9 additions & 2 deletions test/hs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ set(hs_crosstest_args
-odir=${CMAKE_CURRENT_BINARY_DIR}
-hidir=${CMAKE_CURRENT_BINARY_DIR}
)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(hs_optimize -O0)
else()
set(hs_optimize -O1)
endif()

add_custom_command(
OUTPUT ${hs_crosstest_apps}
COMMAND ${GHC} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestServer.hs -o TestServer
COMMAND ${GHC} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestClient.hs -o TestClient
COMMAND ${GHC} ${hs_optimize} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestServer.hs -o TestServer
COMMAND ${GHC} ${hs_optimize} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestClient.hs -o TestClient
DEPENDS ${hs_test_gen} haskell_library TestServer.hs TestClient.hs
)
add_custom_target(haskell_crosstest ALL
Expand Down
1 change: 0 additions & 1 deletion test/hs/TestClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import Network
import Network.URI
import System.Environment
import System.Exit
import System.Posix.Unistd
import qualified Data.ByteString.Lazy as LBS
import qualified Data.HashMap.Strict as Map
import qualified Data.HashSet as Set
Expand Down
4 changes: 2 additions & 2 deletions test/hs/TestServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import Network
import System.Environment
import System.Exit
import System.IO
import System.Posix.Unistd
import Control.Concurrent (threadDelay)
import qualified System.IO as IO
import qualified Data.HashMap.Strict as Map
import qualified Data.HashSet as Set
Expand Down Expand Up @@ -241,7 +241,7 @@ instance ThriftTest_Iface TestHandler where

testOneway _ i = do
System.IO.putStrLn $ "testOneway(" ++ show i ++ "): Sleeping..."
sleep (fromIntegral i)
threadDelay $ (fromIntegral i) * 1000000
System.IO.putStrLn $ "testOneway(" ++ show i ++ "): done sleeping!"

main :: IO ()
Expand Down