diff --git a/.travis.yml b/.travis.yml index a74310d39..37b9ff640 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,12 @@ before_script: - chmod 755 ./travis/Linux/runtests.sh - chmod 755 ./travis/OSX/runtests.sh - if [ "$TRAVIS_OS_NAME" == "linux" ]; then mysql -u root -e 'create database pocotestdb;'; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then mysql --version; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then postgres --version; fi matrix: + fast_finish: true + include: - env: TEST_NAME="OSX clang (make) bundled" os: osx @@ -57,8 +61,7 @@ matrix: - export CC="clang" - export CXX="clang++" - clang++ -x c++ /dev/null -dM -E - - ./configure --everything --omit=Data/ODBC,Data/MySQL,Data/PostgreSQL && make -s -j2 - - sudo make install + - ./configure --everything --omit=Data/ODBC,Data/MySQL,Data/SQLite,Data/PostgreSQL && make -s -j2 && sudo make install - ./travis/OSX/runtests.sh - env: TEST_NAME="Linux gcc 4.6 (make) bundled" @@ -66,7 +69,7 @@ matrix: script: - export CC="gcc" - export CXX="g++" - - ./configure --everything && make -s -j2 + - ./configure --everything && make -s -j2 - ./travis/Linux/runtests.sh - env: TEST_NAME="Linux gcc 4.8 (make) bundled" @@ -101,10 +104,10 @@ matrix: - ./configure --everything --config=Linux-clang && make -s -j2 - ./travis/Linux/runtests.sh - #FIXME the -m64 option bring by the Linux config is not supported by arm-linux-gnueabi-g++ which makes this test failing - #FIXME - env: TEST_NAME="arm-linux-gnueabi- (make)" - #FIXME script: - #FIXME - ./configure --omit=Data/ODBC,Data/MySQL,Crypto,NetSSL,PageCompiler && make -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l + - env: TEST_NAME="Linux arm-linux-gnueabi- (make)" + compiler: gcc + script: + - ./configure --omit=Data/ODBC,Data/MySQL,Data/PostgreSQL,Crypto,NetSSL,PageCompiler && make -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l - env: TEST_NAME="Linux gcc 4.6 (CMake)" compiler: gcc @@ -124,7 +127,7 @@ matrix: - export POCO_BASE=`pwd` - mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd .. - - env: TEST_NAME="clang 3.4 (CMake)" + - env: TEST_NAME="Linux clang 3.4 (CMake)" compiler: clang script: - source ./travis/ignored.sh @@ -132,32 +135,25 @@ matrix: - mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd .. - env: TEST_NAME="Linux arm-linux-gnueabi-g++ (CMake)" + compiler: gcc script: - export CC="arm-linux-gnueabi-gcc" - export CXX="arm-linux-gnueabi-g++" - source ./travis/ignored.sh - export POCO_BASE=`pwd` - - mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. - - make -s -j2 && cd .. + - mkdir cmake-build + - cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make -s -j2 && cd .. - env: TEST_NAME="Linux arm-linux-gnueabihf-g++ (CMake)" + compiler: gcc script: - export CC="arm-linux-gnueabihf-gcc" - export CXX="arm-linux-gnueabihf-g++" - source ./travis/ignored.sh - export POCO_BASE=`pwd` - - mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. - - make -s -j2 && cd .. + - mkdir cmake-build + - cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON .. && make -s -j2 && cd .. - # TODO osx build - # TODO run test suite - # script: - # - ./configure && make -s -i -j2 - # - sudo ifconfig -a - # - sudo ifconfig venet0 multicast - # - sudo ifconfig -a - # - export POCO_BASE=`pwd` - # - sudo -E build/script/runtests.sh # QA jobs for code analytics and metrics # build documentation and release diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b5588901..a95ec5db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,10 @@ include(DefinePlatformSpecifc) # Collect the built libraries and include dirs, the will be used to create the PocoConfig.cmake file set(Poco_COMPONENTS "") -if (ENABLE_CPPUNIT) +# Pthreads/threads support +find_package(Threads REQUIRED) + +if (ENABLE_TESTS) add_subdirectory(CppUnit) list(APPEND Poco_COMPONENTS "CppUnit") endif () @@ -171,9 +174,6 @@ add_subdirectory(Net) list(APPEND Poco_COMPONENTS "Net") endif() -# Pthreads/threads support -find_package(Threads REQUIRED) - #NetSSL diff --git a/Data/MySQL/src/StatementExecutor.cpp b/Data/MySQL/src/StatementExecutor.cpp index ad8290797..3f3857d84 100644 --- a/Data/MySQL/src/StatementExecutor.cpp +++ b/Data/MySQL/src/StatementExecutor.cpp @@ -55,8 +55,17 @@ void StatementExecutor::prepare(const std::string& query) return; } - if (mysql_stmt_prepare(_pHandle, query.c_str(), static_cast(query.length())) != 0) - throw StatementException("mysql_stmt_prepare error", _pHandle, query); + int rc = mysql_stmt_prepare(_pHandle, query.c_str(), static_cast(query.length())); + if (rc != 0) + { + // retry if connection lost + int err = mysql_errno(_pSessionHandle); + if (err == 2006 /* CR_SERVER_GONE_ERROR */ || err == 2013 /* CR_SERVER_LOST */) + { + rc = mysql_stmt_prepare(_pHandle, query.c_str(), static_cast(query.length())); + } + } + if (rc != 0) throw StatementException("mysql_stmt_prepare error", _pHandle, query); _query = query; _state = STMT_COMPILED; diff --git a/Data/SQLite/testsuite/CMakeLists.txt b/Data/SQLite/testsuite/CMakeLists.txt index 0e1699d3d..8fb0ffb68 100644 --- a/Data/SQLite/testsuite/CMakeLists.txt +++ b/Data/SQLite/testsuite/CMakeLists.txt @@ -18,4 +18,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoDataSQLite PocoData PocoFoundation PocoCppUnit ) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoDataSQLite PocoData PocoFoundation PocoCppUnit ) + diff --git a/Data/testsuite/CMakeLists.txt b/Data/testsuite/CMakeLists.txt index c372c2b8f..34b225d74 100644 --- a/Data/testsuite/CMakeLists.txt +++ b/Data/testsuite/CMakeLists.txt @@ -23,4 +23,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoData PocoUtil PocoXML PocoFoundation PocoCppUnit) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoData PocoUtil PocoXML PocoFoundation PocoCppUnit) + diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index a583c8985..7d572f319 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -111,14 +111,14 @@ endif(ANDROID) # TODO: Why is this here? add_definitions( -DPCRE_STATIC) -# For SetAffinity +# For POSIX threads on Unix if(UNIX AND NOT APPLE) + # We still need pthreads on Unix + set(SYSLIBS ${SYSLIBS} ${CMAKE_THREAD_LIBS_INIT}) INCLUDE (CheckFunctionExists) INCLUDE (CheckCXXSourceCompiles) INCLUDE (CheckLibraryExists) CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np "pthread.h" HAVE_PTHREAD_SETAFFINITY_NP) - #set(CMAKE_EXTRA_INCLUDE_FILES pthread.h) - #CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP) if(NOT HAVE_PTHREAD_SETAFFINITY_NP) message(STATUS "Platform has not PTHREAD_SETAFFINITY_NP") else(HAVE_PTHREAD_SETAFFINITY_NP) diff --git a/Foundation/include/Poco/Dynamic/Pair.h b/Foundation/include/Poco/Dynamic/Pair.h index b16f833b2..aab63f993 100644 --- a/Foundation/include/Poco/Dynamic/Pair.h +++ b/Foundation/include/Poco/Dynamic/Pair.h @@ -98,7 +98,7 @@ public: std::string toString() { std::string str; - Var(*this).convert(str); + Var(*this).template convert(str); return str; } diff --git a/Foundation/testsuite/src/UnicodeConverterTest.cpp b/Foundation/testsuite/src/UnicodeConverterTest.cpp index 83da547fb..d07d11a9a 100644 --- a/Foundation/testsuite/src/UnicodeConverterTest.cpp +++ b/Foundation/testsuite/src/UnicodeConverterTest.cpp @@ -20,13 +20,6 @@ #include "Poco/UTFString.h" -using Poco::UnicodeConverter; -using Poco::UTF16Char; -using Poco::UTF16String; -using Poco::UTF32Char; -using Poco::UTF32String; - - UnicodeConverterTest::UnicodeConverterTest(const std::string& rName): CppUnit::TestCase(rName) { } @@ -39,14 +32,13 @@ UnicodeConverterTest::~UnicodeConverterTest() void UnicodeConverterTest::testUTF16() { - - runTests(); + runTests(); } void UnicodeConverterTest::testUTF32() { - runTests(); + runTests(); } diff --git a/JSON/testsuite/CMakeLists.txt b/JSON/testsuite/CMakeLists.txt index ef4a852ed..8ef4e683e 100644 --- a/JSON/testsuite/CMakeLists.txt +++ b/JSON/testsuite/CMakeLists.txt @@ -18,7 +18,8 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoJSON PocoFoundation PocoCppUnit ) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoJSON PocoFoundation PocoCppUnit ) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD diff --git a/MongoDB/testsuite/CMakeLists.txt b/MongoDB/testsuite/CMakeLists.txt index 1f8f3da1a..9b25177dd 100644 --- a/MongoDB/testsuite/CMakeLists.txt +++ b/MongoDB/testsuite/CMakeLists.txt @@ -20,4 +20,6 @@ set(TESTUNIT "${LIBNAME}-testrunner") add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoMongoDB PocoFoundation PocoCppUnit ) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoMongoDB PocoFoundation PocoCppUnit ) + diff --git a/Net/testsuite/CMakeLists.txt b/Net/testsuite/CMakeLists.txt index fdab1eb8a..a6ab047b1 100644 --- a/Net/testsuite/CMakeLists.txt +++ b/Net/testsuite/CMakeLists.txt @@ -18,4 +18,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit) + diff --git a/NetSSL_OpenSSL/testsuite/CMakeLists.txt b/NetSSL_OpenSSL/testsuite/CMakeLists.txt index e3ca71508..ac9e270c5 100644 --- a/NetSSL_OpenSSL/testsuite/CMakeLists.txt +++ b/NetSSL_OpenSSL/testsuite/CMakeLists.txt @@ -18,7 +18,8 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD diff --git a/Redis/testsuite/CMakeLists.txt b/Redis/testsuite/CMakeLists.txt index 4e5665c5a..eb3784d36 100644 --- a/Redis/testsuite/CMakeLists.txt +++ b/Redis/testsuite/CMakeLists.txt @@ -20,4 +20,6 @@ set(TESTUNIT "${LIBNAME}-testrunner") add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoRedis PocoFoundation PocoCppUnit ) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoRedis PocoFoundation PocoCppUnit ) + diff --git a/Util/testsuite/CMakeLists.txt b/Util/testsuite/CMakeLists.txt index 4ef22c101..934e80fbf 100644 --- a/Util/testsuite/CMakeLists.txt +++ b/Util/testsuite/CMakeLists.txt @@ -24,4 +24,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoUtil PocoJSON PocoXML PocoFoundation PocoCppUnit) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoUtil PocoJSON PocoXML PocoFoundation PocoCppUnit) + diff --git a/XML/testsuite/CMakeLists.txt b/XML/testsuite/CMakeLists.txt index c69a89961..9b3a9a734 100644 --- a/XML/testsuite/CMakeLists.txt +++ b/XML/testsuite/CMakeLists.txt @@ -18,4 +18,6 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -target_link_libraries( ${TESTUNIT} PocoXML PocoFoundation PocoCppUnit) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoXML PocoFoundation PocoCppUnit) + diff --git a/Zip/testsuite/CMakeLists.txt b/Zip/testsuite/CMakeLists.txt index 3f9bc4eae..3b1a8c2de 100644 --- a/Zip/testsuite/CMakeLists.txt +++ b/Zip/testsuite/CMakeLists.txt @@ -18,8 +18,8 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) -target_link_libraries( ${TESTUNIT} PocoZip PocoNet PocoFoundation PocoCppUnit ) + +target_link_libraries( ${TESTUNIT} ${CMAKE_THREAD_LIBS_INIT} PocoZip PocoNet PocoFoundation PocoCppUnit ) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD