mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 08:46:41 +01:00
fix(Data):
adjust make and CMake for SQLParser and DataTest lib separate samples from tests in CMake remove unused StatementImpl from Data testsuite
This commit is contained in:
parent
a7a6f869c1
commit
81d7307fa7
2
.vscode/c_cpp_properties.json
vendored
2
.vscode/c_cpp_properties.json
vendored
@ -24,7 +24,7 @@
|
|||||||
"${POCO_BASE}/MongoDB/include",
|
"${POCO_BASE}/MongoDB/include",
|
||||||
"${POCO_BASE}/ApacheConnector/include",
|
"${POCO_BASE}/ApacheConnector/include",
|
||||||
"${POCO_BASE}/Data/src",
|
"${POCO_BASE}/Data/src",
|
||||||
"${POCO_BASE}/Data/testsuite/include"
|
"${POCO_BASE}/Data/testsuite/DataTest/include"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
@ -21,6 +21,6 @@ target_include_directories(mod_poco
|
|||||||
)
|
)
|
||||||
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net Apache::Apr Apache::Aprutil)
|
target_link_libraries(mod_poco PUBLIC Poco::Util Poco::Net Apache::Apr Apache::Aprutil)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
endif()
|
endif()
|
||||||
|
@ -204,7 +204,10 @@ if(ENABLE_ACTIVERECORD AND NOT ENABLE_XML)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(ENABLE_TESTS
|
option(ENABLE_TESTS
|
||||||
"Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF)
|
"Set to OFF|ON (default is OFF) to control build of POCO tests" OFF)
|
||||||
|
|
||||||
|
option(ENABLE_SAMPLES
|
||||||
|
"Set to OFF|ON (default is OFF) to control build of POCO samples" OFF)
|
||||||
|
|
||||||
option(POCO_UNBUNDLED
|
option(POCO_UNBUNDLED
|
||||||
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
|
"Set to OFF|ON (default is OFF) to control linking dependencies as external" OFF)
|
||||||
@ -393,7 +396,13 @@ if(OPENSSL_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif(OPENSSL_FOUND)
|
endif(OPENSSL_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
option(POCO_DATA_NO_SQL_PARSER "Disable SQL parser" OFF)
|
||||||
|
|
||||||
if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA)
|
if(EXISTS ${PROJECT_SOURCE_DIR}/Data AND ENABLE_DATA)
|
||||||
|
if(POCO_DATA_NO_SQL_PARSER)
|
||||||
|
add_definitions(-DPOCO_DATA_NO_SQL_PARSER=1)
|
||||||
|
endif()
|
||||||
add_subdirectory(Data)
|
add_subdirectory(Data)
|
||||||
list(APPEND Poco_COMPONENTS "Data")
|
list(APPEND Poco_COMPONENTS "Data")
|
||||||
endif()
|
endif()
|
||||||
|
@ -38,3 +38,6 @@ elseif(MINGW)
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
_DLL)
|
_DLL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
POCO_INSTALL(CppUnit)
|
||||||
|
POCO_GENERATE_PACKAGE(CppUnit)
|
||||||
|
@ -11,6 +11,6 @@ objects = CppUnitException TestDecorator TestResult TestSuite \
|
|||||||
|
|
||||||
target = CppUnit
|
target = CppUnit
|
||||||
target_version = 1
|
target_version = 1
|
||||||
target_libs =
|
target_libs = PocoFoundation
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/lib
|
include $(POCO_BASE)/build/rules/lib
|
||||||
|
3
CppUnit/cmake/CppUnitConfig.cmake
Normal file
3
CppUnit/cmake/CppUnitConfig.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(PocoFoundation)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataTargets.cmake")
|
1
CppUnit/dependencies
Normal file
1
CppUnit/dependencies
Normal file
@ -0,0 +1 @@
|
|||||||
|
Foundation
|
@ -40,7 +40,10 @@ endif()
|
|||||||
POCO_INSTALL(Crypto)
|
POCO_INSTALL(Crypto)
|
||||||
POCO_GENERATE_PACKAGE(Crypto)
|
POCO_GENERATE_PACKAGE(Crypto)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
# Sources
|
# Sources
|
||||||
file(GLOB SRCS_G "src/*.cpp")
|
file(GLOB SRCS_G "src/*.cpp")
|
||||||
POCO_SOURCES_AUTO(SRCS ${SRCS_G})
|
POCO_SOURCES_AUTO(SRCS ${SRCS_G})
|
||||||
|
if (NOT POCO_DATA_NO_SQL_PARSER)
|
||||||
|
file(GLOB_RECURSE SRCS_PARSER "src/sql-parser/src/*.cpp")
|
||||||
|
LIST(REMOVE_ITEM SRCS_PARSER "${CMAKE_CURRENT_SOURCE_DIR}/src/sql-parser/src/parser/conflict_test.cpp")
|
||||||
|
POCO_SOURCES_AUTO(SRCS ${SRCS_PARSER})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
file(GLOB_RECURSE HDRS_G "include/*.h")
|
file(GLOB_RECURSE HDRS_G "include/*.h")
|
||||||
@ -30,6 +35,7 @@ target_link_libraries(Data PUBLIC Poco::Foundation)
|
|||||||
target_include_directories(Data
|
target_include_directories(Data
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
@ -37,6 +43,10 @@ target_include_directories(Data
|
|||||||
POCO_INSTALL(Data)
|
POCO_INSTALL(Data)
|
||||||
POCO_GENERATE_PACKAGE(Data)
|
POCO_GENERATE_PACKAGE(Data)
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
|
add_subdirectory(testsuite)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DATA_SQLITE)
|
if(ENABLE_DATA_SQLITE)
|
||||||
# SQlite3 is built in any case
|
# SQlite3 is built in any case
|
||||||
message(STATUS "SQLite Support Enabled")
|
message(STATUS "SQLite Support Enabled")
|
||||||
@ -66,7 +76,6 @@ else()
|
|||||||
message(STATUS "ODBC Support Disabled")
|
message(STATUS "ODBC Support Disabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
add_subdirectory(testsuite)
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -25,4 +25,5 @@ else()
|
|||||||
)
|
)
|
||||||
set_tests_properties(DataMySQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
set_tests_properties(DataMySQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL CppUnit)
|
target_link_libraries(DataMySQL-testrunner PUBLIC Poco::DataMySQL Poco::DataTest CppUnit)
|
||||||
|
target_include_directories(DataMySQL-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||||
|
@ -25,4 +25,6 @@ else()
|
|||||||
)
|
)
|
||||||
set_tests_properties(DataODBC PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
set_tests_properties(DataODBC PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataODBC CppUnit)
|
|
||||||
|
target_link_libraries(DataODBC-testrunner PUBLIC Poco::DataTest Poco::DataODBC Poco::Data CppUnit)
|
||||||
|
target_include_directories(DataODBC-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||||
|
@ -35,7 +35,6 @@ ifeq ($(POCO_CONFIG),MinGW)
|
|||||||
objects += ODBCAccessTest
|
objects += ODBCAccessTest
|
||||||
endif
|
endif
|
||||||
|
|
||||||
target_includes = $(POCO_BASE)/Data/testsuite/include
|
|
||||||
ifndef POCO_DATA_NO_SQL_PARSER
|
ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
target_includes += $(POCO_BASE)/Data/src
|
target_includes += $(POCO_BASE)/Data/src
|
||||||
endif
|
endif
|
||||||
@ -43,5 +42,6 @@ endif
|
|||||||
target = testrunner
|
target = testrunner
|
||||||
target_version = 1
|
target_version = 1
|
||||||
target_libs = PocoDataODBC PocoDataTest PocoData PocoFoundation CppUnit
|
target_libs = PocoDataODBC PocoDataTest PocoData PocoFoundation CppUnit
|
||||||
|
target_includes += $(POCO_BASE)/Data/testsuite/DataTest/include
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/exec
|
include $(POCO_BASE)/build/rules/exec
|
||||||
|
@ -17,4 +17,5 @@ add_test(
|
|||||||
COMMAND DataPostgreSQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
COMMAND DataPostgreSQL-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
||||||
)
|
)
|
||||||
set_tests_properties(DataPostgreSQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
set_tests_properties(DataPostgreSQL PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL CppUnit)
|
target_link_libraries(DataPostgreSQL-testrunner PUBLIC Poco::DataPostgreSQL Poco::DataTest CppUnit)
|
||||||
|
target_include_directories(DataPostgreSQL-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||||
|
@ -4,7 +4,8 @@ POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
|||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
file(GLOB_RECURSE HDRS_G "src/*.h")
|
file(GLOB_RECURSE HDRS_G "src/*.h")
|
||||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
file(GLOB HDRS_E ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/*.h)
|
||||||
|
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_E})
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
||||||
src/WinDriver.cpp
|
src/WinDriver.cpp
|
||||||
@ -29,4 +30,6 @@ else()
|
|||||||
)
|
)
|
||||||
set_tests_properties(DataSQLite PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
set_tests_properties(DataSQLite PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite CppUnit)
|
|
||||||
|
target_link_libraries(DataSQLite-testrunner PUBLIC Poco::DataSQLite Poco::DataTest CppUnit)
|
||||||
|
target_include_directories(DataSQLite-testrunner PUBLIC ${CMAKE_SOURCE_DIR}/Data/testsuite/DataTest/include/)
|
||||||
|
@ -544,7 +544,7 @@ private:
|
|||||||
/// Returns true if the statement is of the argument type.
|
/// Returns true if the statement is of the argument type.
|
||||||
|
|
||||||
Poco::SharedPtr<Parser::SQLParserResult> _pParseResult;
|
Poco::SharedPtr<Parser::SQLParserResult> _pParseResult;
|
||||||
|
std::string _parseError;
|
||||||
#endif // POCO_DATA_NO_SQL_PARSER
|
#endif // POCO_DATA_NO_SQL_PARSER
|
||||||
|
|
||||||
StatementImpl::Ptr _pImpl;
|
StatementImpl::Ptr _pImpl;
|
||||||
@ -557,7 +557,6 @@ private:
|
|||||||
std::vector<Any> _arguments;
|
std::vector<Any> _arguments;
|
||||||
RowFormatter::Ptr _pRowFormatter;
|
RowFormatter::Ptr _pRowFormatter;
|
||||||
mutable std::string _stmtString;
|
mutable std::string _stmtString;
|
||||||
std::string _parseError;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -571,7 +570,12 @@ inline std::size_t Statement::subTotalRowCount(int dataSet) const
|
|||||||
|
|
||||||
inline const std::string& Statement::parseError()
|
inline const std::string& Statement::parseError()
|
||||||
{
|
{
|
||||||
|
#ifdef POCO_DATA_NO_SQL_PARSER
|
||||||
|
static std::string empty;
|
||||||
|
return empty;
|
||||||
|
#else
|
||||||
return _parseError;
|
return _parseError;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ Statement::Statement(Session& session):
|
|||||||
Statement::Statement(const Statement& stmt):
|
Statement::Statement(const Statement& stmt):
|
||||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
_pParseResult(stmt._pParseResult),
|
_pParseResult(stmt._pParseResult),
|
||||||
|
_parseError(stmt._parseError),
|
||||||
#endif
|
#endif
|
||||||
_pImpl(stmt._pImpl),
|
_pImpl(stmt._pImpl),
|
||||||
_async(stmt._async),
|
_async(stmt._async),
|
||||||
@ -55,8 +56,7 @@ Statement::Statement(const Statement& stmt):
|
|||||||
_pAsyncExec(stmt._pAsyncExec),
|
_pAsyncExec(stmt._pAsyncExec),
|
||||||
_arguments(stmt._arguments),
|
_arguments(stmt._arguments),
|
||||||
_pRowFormatter(stmt._pRowFormatter),
|
_pRowFormatter(stmt._pRowFormatter),
|
||||||
_stmtString(stmt._stmtString),
|
_stmtString(stmt._stmtString)
|
||||||
_parseError(stmt._parseError)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ Statement::Statement(const Statement& stmt):
|
|||||||
Statement::Statement(Statement&& stmt) noexcept:
|
Statement::Statement(Statement&& stmt) noexcept:
|
||||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
_pParseResult(std::move(stmt._pParseResult)),
|
_pParseResult(std::move(stmt._pParseResult)),
|
||||||
|
_parseError(std::move(stmt._parseError)),
|
||||||
#endif
|
#endif
|
||||||
_pImpl(std::move(stmt._pImpl)),
|
_pImpl(std::move(stmt._pImpl)),
|
||||||
_async(std::move(stmt._async)),
|
_async(std::move(stmt._async)),
|
||||||
@ -71,8 +72,7 @@ Statement::Statement(Statement&& stmt) noexcept:
|
|||||||
_pAsyncExec(std::move(stmt._pAsyncExec)),
|
_pAsyncExec(std::move(stmt._pAsyncExec)),
|
||||||
_arguments(std::move(stmt._arguments)),
|
_arguments(std::move(stmt._arguments)),
|
||||||
_pRowFormatter(std::move(stmt._pRowFormatter)),
|
_pRowFormatter(std::move(stmt._pRowFormatter)),
|
||||||
_stmtString(std::move(stmt._stmtString)),
|
_stmtString(std::move(stmt._stmtString))
|
||||||
_parseError(std::move(stmt._parseError))
|
|
||||||
{
|
{
|
||||||
stmt._pImpl = nullptr;
|
stmt._pImpl = nullptr;
|
||||||
stmt._async = false;
|
stmt._async = false;
|
||||||
@ -81,7 +81,9 @@ Statement::Statement(Statement&& stmt) noexcept:
|
|||||||
stmt._arguments.clear();
|
stmt._arguments.clear();
|
||||||
stmt._pRowFormatter = nullptr;
|
stmt._pRowFormatter = nullptr;
|
||||||
_stmtString.clear();
|
_stmtString.clear();
|
||||||
|
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
_parseError.clear();
|
_parseError.clear();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,6 +104,8 @@ Statement& Statement::operator = (Statement&& stmt) noexcept
|
|||||||
{
|
{
|
||||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
_pParseResult = std::move(stmt._pParseResult);
|
_pParseResult = std::move(stmt._pParseResult);
|
||||||
|
_parseError = std::move(stmt._parseError);
|
||||||
|
_parseError.clear();
|
||||||
#endif
|
#endif
|
||||||
_pImpl = std::move(stmt._pImpl);
|
_pImpl = std::move(stmt._pImpl);
|
||||||
stmt._pImpl = nullptr;
|
stmt._pImpl = nullptr;
|
||||||
@ -117,8 +121,6 @@ Statement& Statement::operator = (Statement&& stmt) noexcept
|
|||||||
stmt._pRowFormatter = nullptr;
|
stmt._pRowFormatter = nullptr;
|
||||||
_stmtString = std::move(stmt._stmtString);
|
_stmtString = std::move(stmt._stmtString);
|
||||||
_stmtString.clear();
|
_stmtString.clear();
|
||||||
_parseError = std::move(stmt._parseError);
|
|
||||||
_parseError.clear();
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -128,6 +130,7 @@ void Statement::swap(Statement& other) noexcept
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
#ifndef POCO_DATA_NO_SQL_PARSER
|
#ifndef POCO_DATA_NO_SQL_PARSER
|
||||||
swap(_pParseResult, other._pParseResult);
|
swap(_pParseResult, other._pParseResult);
|
||||||
|
swap(_parseError, other._parseError);
|
||||||
#endif
|
#endif
|
||||||
swap(_pImpl, other._pImpl);
|
swap(_pImpl, other._pImpl);
|
||||||
swap(_async, other._async);
|
swap(_async, other._async);
|
||||||
@ -136,7 +139,6 @@ void Statement::swap(Statement& other) noexcept
|
|||||||
_arguments.swap(other._arguments);
|
_arguments.swap(other._arguments);
|
||||||
swap(_pRowFormatter, other._pRowFormatter);
|
swap(_pRowFormatter, other._pRowFormatter);
|
||||||
swap(_stmtString, other._stmtString);
|
swap(_stmtString, other._stmtString);
|
||||||
swap(_parseError, other._parseError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# Sources
|
# Sources
|
||||||
file(GLOB SRCS_G "src/*.cpp")
|
file(GLOB SRCS_G "src/*.cpp")
|
||||||
|
LIST(REMOVE_ITEM SRCS_G "${CMAKE_CURRENT_SOURCE_DIR}/src/SQLExecutor.cpp")
|
||||||
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
file(GLOB_RECURSE HDRS_G "src/*.h")
|
file(GLOB HDRS_G "src/*.h")
|
||||||
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
||||||
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
||||||
@ -14,11 +15,6 @@ POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
|||||||
src/WinCEDriver.cpp
|
src/WinCEDriver.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
#TODO: Why is this file there? It doesn't compile if it is include in the sources
|
|
||||||
POCO_SOURCES_AUTO_PLAT(TEST_SRCS OFF
|
|
||||||
src/StatementImpl.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(Data-testrunner ${TEST_SRCS})
|
add_executable(Data-testrunner ${TEST_SRCS})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_test(
|
add_test(
|
||||||
@ -35,3 +31,5 @@ else()
|
|||||||
set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)
|
target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)
|
||||||
|
|
||||||
|
add_subdirectory(DataTest)
|
||||||
|
34
Data/testsuite/DataTest/CMakeLists.txt
Normal file
34
Data/testsuite/DataTest/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Sources
|
||||||
|
file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||||
|
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})
|
||||||
|
|
||||||
|
# Headers
|
||||||
|
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
|
||||||
|
POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G})
|
||||||
|
|
||||||
|
# Version Resource
|
||||||
|
if(MSVC AND BUILD_SHARED_LIBS)
|
||||||
|
source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
||||||
|
list(APPEND DATA_TEST_LIB_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(DataTest ${DATA_TEST_LIB_SRCS})
|
||||||
|
add_library(Poco::DataTest ALIAS DataTest)
|
||||||
|
set_target_properties(DataTest
|
||||||
|
PROPERTIES
|
||||||
|
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||||
|
OUTPUT_NAME PocoDataTest
|
||||||
|
DEFINE_SYMBOL DataTest_EXPORTS
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(DataTest PUBLIC Poco::Data CppUnit)
|
||||||
|
target_include_directories(DataTest
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Data/include>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/Data/src>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
)
|
||||||
|
|
||||||
|
POCO_INSTALL(DataTest)
|
||||||
|
POCO_GENERATE_PACKAGE(DataTest)
|
16
Data/testsuite/DataTest/Makefile
Normal file
16
Data/testsuite/DataTest/Makefile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Makefile
|
||||||
|
#
|
||||||
|
# Makefile for Poco Data testsuite library
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(POCO_BASE)/build/rules/global
|
||||||
|
|
||||||
|
objects = SQLExecutor
|
||||||
|
|
||||||
|
target = PocoDataTest
|
||||||
|
target_version = 1
|
||||||
|
target_libs = PocoData PocoFoundation CppUnit
|
||||||
|
target_includes = $(POCO_BASE)/Data/src $(POCO_BASE)/Data/testsuite/DataTest/include
|
||||||
|
|
||||||
|
include $(POCO_BASE)/build/rules/lib
|
5
Data/testsuite/DataTest/cmake/PocoDataTestConfig.cmake
Normal file
5
Data/testsuite/DataTest/cmake/PocoDataTestConfig.cmake
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
find_dependency(PocoFoundation)
|
||||||
|
find_dependency(PocoData)
|
||||||
|
find_dependency(CppUnit)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataTestTargets.cmake")
|
2
Data/testsuite/DataTest/dependencies
Normal file
2
Data/testsuite/DataTest/dependencies
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Foundation
|
||||||
|
Data
|
62
Data/testsuite/DataTest/include/Poco/Data/Test/DataTest.h
Normal file
62
Data/testsuite/DataTest/include/Poco/Data/Test/DataTest.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
//
|
||||||
|
// DataTest.h
|
||||||
|
//
|
||||||
|
// Library: DataTest
|
||||||
|
// Package: DataTestCore
|
||||||
|
// Module: DataTest
|
||||||
|
//
|
||||||
|
// Basic definitions for the Poco DataTest library.
|
||||||
|
// This file must be the first file included by every other DataTest
|
||||||
|
// header file.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.,
|
||||||
|
// Aleph ONE Software Engineering d.o.o., and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DataTest_DataTest_INCLUDED
|
||||||
|
#define DataTest_DataTest_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
#include "Poco/Foundation.h"
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// The following block is the standard way of creating macros which make exporting
|
||||||
|
// from a DLL simpler. All files within this DLL are compiled with the DataTest_EXPORTS
|
||||||
|
// symbol defined on the command line. this symbol should not be defined on any project
|
||||||
|
// that uses this DLL. This way any other project whose source files include this file see
|
||||||
|
// DataTest_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||||
|
// defined with this macro as being exported.
|
||||||
|
//
|
||||||
|
#if defined(_WIN32) && defined(POCO_DLL)
|
||||||
|
#if defined(DataTest_EXPORTS)
|
||||||
|
#define DataTest_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DataTest_API __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(DataTest_API)
|
||||||
|
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
|
||||||
|
#define DataTest_API __attribute__ ((visibility ("default")))
|
||||||
|
#else
|
||||||
|
#define DataTest_API
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Automatically link DataTest library.
|
||||||
|
//
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(DataTest_EXPORTS)
|
||||||
|
#pragma comment(lib, "PocoDataTest" POCO_LIB_SUFFIX)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DataTest_DataTest_INCLUDED
|
@ -3,18 +3,18 @@
|
|||||||
//
|
//
|
||||||
// Definition of the SQLExecutor class.
|
// Definition of the SQLExecutor class.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.,
|
||||||
// and Contributors.
|
// Aleph ONE Software Engineering d.o.o., and Contributors.
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef Data_SQLExecutor_INCLUDED
|
#ifndef DataTest_SQLExecutor_INCLUDED
|
||||||
#define Data_SQLExecutor_INCLUDED
|
#define DataTest_SQLExecutor_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/Data.h"
|
#include "Poco/Data/Test/DataTest.h"
|
||||||
#include "Poco/Data/Session.h"
|
#include "Poco/Data/Session.h"
|
||||||
#include "Poco/Data/BulkExtraction.h"
|
#include "Poco/Data/BulkExtraction.h"
|
||||||
#include "Poco/Data/BulkBinding.h"
|
#include "Poco/Data/BulkBinding.h"
|
||||||
@ -24,6 +24,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Poco {
|
||||||
|
namespace Data {
|
||||||
|
namespace Test {
|
||||||
|
|
||||||
|
|
||||||
#define poco_data_using_keywords using Poco::Data::Keywords::now; \
|
#define poco_data_using_keywords using Poco::Data::Keywords::now; \
|
||||||
using Poco::Data::Keywords::into; \
|
using Poco::Data::Keywords::into; \
|
||||||
using Poco::Data::Keywords::use; \
|
using Poco::Data::Keywords::use; \
|
||||||
@ -33,12 +38,7 @@
|
|||||||
using Poco::Data::CLOB;
|
using Poco::Data::CLOB;
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
class DataTest_API SQLExecutor: public CppUnit::TestCase
|
||||||
namespace Data {
|
|
||||||
namespace Test {
|
|
||||||
|
|
||||||
|
|
||||||
class SQLExecutor: public CppUnit::TestCase
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum DataBinding
|
enum DataBinding
|
||||||
@ -238,4 +238,4 @@ private:
|
|||||||
} } } // Poco::Data::Test
|
} } } // Poco::Data::Test
|
||||||
|
|
||||||
|
|
||||||
#endif // Data_SQLExecutor_INCLUDED
|
#endif // DataTest_SQLExecutor_INCLUDED
|
@ -8,4 +8,4 @@
|
|||||||
clean distclean all: projects
|
clean distclean all: projects
|
||||||
projects:
|
projects:
|
||||||
$(MAKE) -f Makefile-testrunner $(MAKECMDGOALS)
|
$(MAKE) -f Makefile-testrunner $(MAKECMDGOALS)
|
||||||
$(MAKE) -f Makefile-library $(MAKECMDGOALS)
|
$(MAKE) -C DataTest $(MAKECMDGOALS)
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile
|
|
||||||
#
|
|
||||||
# Makefile for Poco Data testsuite library
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/global
|
|
||||||
|
|
||||||
objects = SQLExecutor
|
|
||||||
|
|
||||||
target_includes = $(POCO_BASE)/Data/testsuite/include
|
|
||||||
ifndef POCO_DATA_NO_SQL_PARSER
|
|
||||||
objects += SQLParserTest
|
|
||||||
target_includes += $(POCO_BASE)/Data/src
|
|
||||||
endif
|
|
||||||
|
|
||||||
target = PocoDataTest
|
|
||||||
target_version = 1
|
|
||||||
target_libs = PocoData PocoFoundation CppUnit
|
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/lib
|
|
@ -1504,6 +1504,8 @@ void DataTest::testSQLParse()
|
|||||||
assertTrue (!stmt.isDelete().isSpecified());
|
assertTrue (!stmt.isDelete().isSpecified());
|
||||||
assertTrue (!stmt.hasDelete().isSpecified());
|
assertTrue (!stmt.hasDelete().isSpecified());
|
||||||
|
|
||||||
|
#else
|
||||||
|
std::cout << "[NOT ENABLED]";
|
||||||
#endif // POCO_DATA_NO_SQL_PARSER
|
#endif // POCO_DATA_NO_SQL_PARSER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
//
|
|
||||||
// StatementImpl.cpp
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include "StatementImpl.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
namespace Data {
|
|
||||||
namespace Test {
|
|
||||||
|
|
||||||
|
|
||||||
StatementImpl::StatementImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
StatementImpl::~StatementImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void StatementImpl::compileImpl()
|
|
||||||
{
|
|
||||||
// prepare binding
|
|
||||||
_ptrBinder = new Binder;
|
|
||||||
_ptrExtractor = new Extractor;
|
|
||||||
_ptrPrepare = new Preparation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool StatementImpl::canBind() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void StatementImpl::bindImpl()
|
|
||||||
{
|
|
||||||
// bind
|
|
||||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
|
||||||
Bindings& binds = bindings();
|
|
||||||
if (binds.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Bindings::iterator it = binds.begin();
|
|
||||||
Bindings::iterator itEnd = binds.end();
|
|
||||||
std::size_t pos = 0;
|
|
||||||
for (; it != itEnd && (*it)->canBind(); ++it)
|
|
||||||
{
|
|
||||||
(*it)->bind(pos);
|
|
||||||
pos += (*it)->numOfColumnsHandled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool StatementImpl::hasNext()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void StatementImpl::next()
|
|
||||||
{
|
|
||||||
Poco::Data::AbstractExtractionVec::iterator it = extractions().begin();
|
|
||||||
Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end();
|
|
||||||
std::size_t pos = 0;
|
|
||||||
for (; it != itEnd; ++it)
|
|
||||||
{
|
|
||||||
(*it)->extract(pos);
|
|
||||||
pos += (*it)->numOfColumnsHandled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} } } // namespace Poco::Data::Test
|
|
@ -1,91 +0,0 @@
|
|||||||
//
|
|
||||||
// StatementImpl.h
|
|
||||||
//
|
|
||||||
// Definition of the StatementImpl class.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
||||||
// and Contributors.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef Data_Test_StatementImpl_INCLUDED
|
|
||||||
#define Data_Test_StatementImpl_INCLUDED
|
|
||||||
|
|
||||||
|
|
||||||
#include "Poco/Data/StatementImpl.h"
|
|
||||||
#include "Poco/SharedPtr.h"
|
|
||||||
#include "Binder.h"
|
|
||||||
#include "Extractor.h"
|
|
||||||
#include "Preparator.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct sqlite3;
|
|
||||||
struct sqlite3_stmt;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
|
||||||
namespace Data {
|
|
||||||
namespace Test {
|
|
||||||
|
|
||||||
|
|
||||||
class StatementImpl: public Poco::Data::StatementImpl
|
|
||||||
/// A no-op implementation of StatementImpl for testing.
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StatementImpl();
|
|
||||||
/// Creates the StatementImpl.
|
|
||||||
|
|
||||||
~StatementImpl();
|
|
||||||
/// Destroys the StatementImpl.
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool hasNext();
|
|
||||||
/// Returns true if a call to next() will return data.
|
|
||||||
|
|
||||||
void next();
|
|
||||||
/// Retrieves the next row from the resultset.
|
|
||||||
/// Will throw, if the resultset is empty.
|
|
||||||
|
|
||||||
bool canBind() const;
|
|
||||||
/// Returns true if a valid statement is set and we can bind.
|
|
||||||
|
|
||||||
void compileImpl();
|
|
||||||
/// Compiles the statement, doesn't bind yet
|
|
||||||
|
|
||||||
void bindImpl();
|
|
||||||
/// Binds parameters
|
|
||||||
|
|
||||||
AbstractExtractor& extractor();
|
|
||||||
/// Returns the concrete extractor used by the statement.
|
|
||||||
|
|
||||||
AbstractBinder& binder();
|
|
||||||
/// Returns the concrete binder used by the statement.
|
|
||||||
|
|
||||||
private:
|
|
||||||
Poco::SharedPtr<Binder> _ptrBinder;
|
|
||||||
Poco::SharedPtr<Extractor> _ptrExtractor;
|
|
||||||
Poco::SharedPtr<Preparation> _ptrPrepare;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// inlines
|
|
||||||
//
|
|
||||||
inline AbstractExtractor& StatementImpl::extractor()
|
|
||||||
{
|
|
||||||
return *_ptrExtractor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline AbstractBinder& StatementImpl::binder()
|
|
||||||
{
|
|
||||||
return *_ptrBinder;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} } } // namespace Poco::Data::Test
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Data_Test_StatementImpl_INCLUDED
|
|
33
Data/testsuite/testsuite.cmake
Normal file
33
Data/testsuite/testsuite.cmake
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Sources
|
||||||
|
file(GLOB SRCS_G "src/*.cpp")
|
||||||
|
LIST(REMOVE_ITEM SRCS_G "${CMAKE_CURRENT_SOURCE_DIR}/src/SQLExecutor.cpp")
|
||||||
|
POCO_SOURCES_AUTO(TEST_SRCS ${SRCS_G})
|
||||||
|
|
||||||
|
# Headers
|
||||||
|
file(GLOB HDRS_G "src/*.h")
|
||||||
|
POCO_HEADERS_AUTO(TEST_SRCS ${HDRS_G})
|
||||||
|
|
||||||
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WIN
|
||||||
|
src/WinDriver.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
POCO_SOURCES_AUTO_PLAT(TEST_SRCS WINCE
|
||||||
|
src/WinCEDriver.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(Data-testrunner ${TEST_SRCS})
|
||||||
|
if(ANDROID)
|
||||||
|
add_test(
|
||||||
|
NAME Data
|
||||||
|
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/Data-testrunner -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_test(
|
||||||
|
NAME Data
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMAND Data-testrunner -ignore ${CMAKE_SOURCE_DIR}/cppignore.lnx -all
|
||||||
|
)
|
||||||
|
set_tests_properties(Data PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
target_link_libraries(Data-testrunner PUBLIC Poco::Data CppUnit)
|
@ -32,7 +32,10 @@ target_include_directories(Encodings
|
|||||||
POCO_INSTALL(Encodings)
|
POCO_INSTALL(Encodings)
|
||||||
POCO_GENERATE_PACKAGE(Encodings)
|
POCO_GENERATE_PACKAGE(Encodings)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
@ -234,10 +234,13 @@ endif()
|
|||||||
POCO_INSTALL(Foundation)
|
POCO_INSTALL(Foundation)
|
||||||
POCO_GENERATE_PACKAGE(Foundation)
|
POCO_GENERATE_PACKAGE(Foundation)
|
||||||
|
|
||||||
|
if(ENABLE_SAMPLES)
|
||||||
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
if(NOT BUILD_SHARED_LIBS)
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared.
|
set_property(TARGET Foundation PROPERTY POSITION_INDEPENDENT_CODE ON) # This is needed to build TestLibrary.so as shared.
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(samples)
|
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
@ -41,7 +41,10 @@ endif()
|
|||||||
POCO_INSTALL(JSON)
|
POCO_INSTALL(JSON)
|
||||||
POCO_GENERATE_PACKAGE(JSON)
|
POCO_GENERATE_PACKAGE(JSON)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
@ -32,8 +32,11 @@ target_include_directories(MongoDB
|
|||||||
POCO_INSTALL(MongoDB)
|
POCO_INSTALL(MongoDB)
|
||||||
POCO_GENERATE_PACKAGE(MongoDB)
|
POCO_GENERATE_PACKAGE(MongoDB)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -46,8 +46,11 @@ target_include_directories(Net
|
|||||||
POCO_INSTALL(Net)
|
POCO_INSTALL(Net)
|
||||||
POCO_GENERATE_PACKAGE(Net)
|
POCO_GENERATE_PACKAGE(Net)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -36,8 +36,11 @@ endif()
|
|||||||
POCO_INSTALL(NetSSL)
|
POCO_INSTALL(NetSSL)
|
||||||
POCO_GENERATE_PACKAGE(NetSSL)
|
POCO_GENERATE_PACKAGE(NetSSL)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -32,9 +32,12 @@ target_include_directories(NetSSLWin
|
|||||||
POCO_INSTALL(NetSSLWin)
|
POCO_INSTALL(NetSSLWin)
|
||||||
POCO_GENERATE_PACKAGE(NetSSLWin)
|
POCO_GENERATE_PACKAGE(NetSSLWin)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
#TODO: Looks like the samples use crypto somehow?
|
#TODO: Looks like the samples use crypto somehow?
|
||||||
#add_subdirectory(samples)
|
#add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
#add_subdirectory(testsuite)
|
#add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -146,8 +146,11 @@ target_include_directories(PDF
|
|||||||
POCO_INSTALL(PDF)
|
POCO_INSTALL(PDF)
|
||||||
POCO_GENERATE_PACKAGE(PDF)
|
POCO_GENERATE_PACKAGE(PDF)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -32,8 +32,11 @@ target_include_directories(Prometheus
|
|||||||
POCO_INSTALL(Prometheus)
|
POCO_INSTALL(Prometheus)
|
||||||
POCO_GENERATE_PACKAGE(Prometheus)
|
POCO_GENERATE_PACKAGE(Prometheus)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -34,6 +34,5 @@ POCO_GENERATE_PACKAGE(Redis)
|
|||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
# add_subdirectory(samples)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -75,7 +75,5 @@ POCO_GENERATE_PACKAGE(SevenZip)
|
|||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
# TODO: Add tests
|
|
||||||
#add_subdirectory(testsuite)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -49,7 +49,10 @@ target_include_directories(Util
|
|||||||
POCO_INSTALL(Util)
|
POCO_INSTALL(Util)
|
||||||
POCO_GENERATE_PACKAGE(Util)
|
POCO_GENERATE_PACKAGE(Util)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
@ -65,8 +65,11 @@ endif()
|
|||||||
POCO_INSTALL(XML)
|
POCO_INSTALL(XML)
|
||||||
POCO_GENERATE_PACKAGE(XML)
|
POCO_GENERATE_PACKAGE(XML)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -32,8 +32,11 @@ target_include_directories(Zip
|
|||||||
POCO_INSTALL(Zip)
|
POCO_INSTALL(Zip)
|
||||||
POCO_GENERATE_PACKAGE(Zip)
|
POCO_GENERATE_PACKAGE(Zip)
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_SAMPLES)
|
||||||
add_subdirectory(samples)
|
add_subdirectory(samples)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
add_subdirectory(testsuite)
|
add_subdirectory(testsuite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -222,10 +222,17 @@ else()
|
|||||||
NAMESPACE "${PROJECT_NAME}::"
|
NAMESPACE "${PROJECT_NAME}::"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if("${target_name}" STREQUAL "CppUnit")
|
||||||
|
configure_file("cmake/${target_name}Config.cmake"
|
||||||
|
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
else()
|
||||||
configure_file("cmake/Poco${target_name}Config.cmake"
|
configure_file("cmake/Poco${target_name}Config.cmake"
|
||||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set config script install location in a location that find_package() will
|
# Set config script install location in a location that find_package() will
|
||||||
# look for, which is different on MS Windows than for UNIX
|
# look for, which is different on MS Windows than for UNIX
|
||||||
|
@ -389,6 +389,7 @@ Here an overview of POCO build options:
|
|||||||
* ENABLE_PAGECOMPILER_FILE2PAGE Set to OFF|ON (default is ON) to build File2Page
|
* ENABLE_PAGECOMPILER_FILE2PAGE Set to OFF|ON (default is ON) to build File2Page
|
||||||
* ENABLE_POCODOC Set to OFF|ON (default is OFF) to build Poco Documentation Generator
|
* ENABLE_POCODOC Set to OFF|ON (default is OFF) to build Poco Documentation Generator
|
||||||
* ENABLE_TESTS Set to OFF|ON (default is OFF) to build Unit tests
|
* ENABLE_TESTS Set to OFF|ON (default is OFF) to build Unit tests
|
||||||
|
* ENABLE_SAMPLES Set to OFF|ON (default is OFF) to build samples
|
||||||
* ENABLE_LONG_RUNNING_TESTS Set to OFF|ON (default is ON) to use long running test
|
* ENABLE_LONG_RUNNING_TESTS Set to OFF|ON (default is ON) to use long running test
|
||||||
* POCO_UNBUNDLED Set to OFF|ON (default is OFF) to control linking dependencies as external
|
* POCO_UNBUNDLED Set to OFF|ON (default is OFF) to control linking dependencies as external
|
||||||
|
|
||||||
|
@ -1,20 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Script to rebuild a library and dependencies
|
# Script to rebuild libraries and dependencies
|
||||||
# (with or without a sanitizer) and run the tests.
|
# (with or without a sanitizer) and run the tests.
|
||||||
# Currently works only for top-level libs
|
#
|
||||||
# dependent on Foundation only.
|
# The use case of the script is mainly for development purposes -
|
||||||
|
# to clean and rebuild a single library, with all of its dependencies,
|
||||||
|
# and run the tests.
|
||||||
#
|
#
|
||||||
# Usage: ./runLibTests.sh library [address | undefined | thread ]
|
# Usage: ./runLibTests.sh library [address | undefined | thread ]
|
||||||
#
|
#
|
||||||
|
# Example: ./runLibTests.sh Data/SQLite address
|
||||||
|
# (distcleans, rebuilds and runs tests for Data/SQLite with address sanitizer)
|
||||||
|
#
|
||||||
|
|
||||||
library=$1
|
# g++ does not like empty quoted arguments, but
|
||||||
if [ -z "${library}" ]; then
|
# the shellcheck wants them quoted to remain quiet
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
|
||||||
|
path=$1
|
||||||
|
if [ -z "${path}" ]; then
|
||||||
echo "Library not specified"
|
echo "Library not specified"
|
||||||
echo "Usage: $0 library [address | undefined | thread ]"
|
echo "Usage: $0 path [address | undefined | thread ]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
libraries=
|
||||||
|
IFS='/' read -r -a libraries <<< "$path"
|
||||||
|
|
||||||
self="${BASH_SOURCE[0]}"
|
self="${BASH_SOURCE[0]}"
|
||||||
|
|
||||||
if [ -d "$self" ] ; then
|
if [ -d "$self" ] ; then
|
||||||
@ -27,30 +39,41 @@ fi
|
|||||||
. "$basedir"/poco_env.bash
|
. "$basedir"/poco_env.bash
|
||||||
|
|
||||||
flag=$2
|
flag=$2
|
||||||
|
flags=
|
||||||
make distclean -C CppUnit
|
|
||||||
make distclean -C Foundation
|
|
||||||
if [[ "$library" != "Foundation" ]]; then
|
|
||||||
make distclean -C "$library"
|
|
||||||
fi
|
|
||||||
make distclean -C "$library"/testsuite
|
|
||||||
|
|
||||||
if [ -n "${flag}" ]; then
|
if [ -n "${flag}" ]; then
|
||||||
make -s -j4 -C "$POCO_BASE"/CppUnit SANITIZEFLAGS+=-fsanitize="$flag"
|
flags=SANITIZEFLAGS+=-fsanitize="$flag"
|
||||||
make -s -j4 -C "$POCO_BASE"/Foundation SANITIZEFLAGS+=-fsanitize="$flag"
|
|
||||||
if [[ "$library" != "Foundation" ]]; then
|
|
||||||
make -s -j4 -C "$POCO_BASE"/"$library" SANITIZEFLAGS+=-fsanitize="$flag"
|
|
||||||
fi
|
|
||||||
make -s -j4 -C "$POCO_BASE"/"$library"/testsuite SANITIZEFLAGS+=-fsanitize="$flag"
|
|
||||||
else
|
|
||||||
make -s -j4 -C "$POCO_BASE"/CppUnit
|
|
||||||
make -s -j4 -C "$POCO_BASE"/Foundation
|
|
||||||
if [[ "$library" != "Foundation" ]]; then
|
|
||||||
make -s -j4 -C "$POCO_BASE"/"$library"
|
|
||||||
fi
|
|
||||||
make -s -j4 -C "$POCO_BASE"/"$library"/testsuite
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$basedir"/"$library"/testsuite/bin/"$OSNAME"/"$OSARCH"/ || exit
|
path="$basedir"/"${libraries[0]}"
|
||||||
|
|
||||||
|
make distclean -C "$basedir"/Foundation
|
||||||
|
make distclean -C "$basedir"/CppUnit
|
||||||
|
|
||||||
|
make -s -j4 -C "$basedir"/Foundation $flags
|
||||||
|
make -s -j4 -C "$basedir"/CppUnit $flags
|
||||||
|
|
||||||
|
# Foundation requested, build/run tests and exit
|
||||||
|
if [[ "$path" == "$basedir"/"Foundation" ]]; then
|
||||||
|
cd "$path/testsuite/" || exit
|
||||||
|
make -s -j4 -C ./ $flags
|
||||||
|
cd "bin/$OSNAME/$OSARCH/" || exit
|
||||||
./testrunner -all
|
./testrunner -all
|
||||||
./testrunnerd -all
|
./testrunnerd -all
|
||||||
|
echo "$path $flags done."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for library in "${libraries[@]}"
|
||||||
|
do
|
||||||
|
cd "$library" || exit
|
||||||
|
make distclean
|
||||||
|
make -s -j4 -C ./ $flags
|
||||||
|
cd testsuite || exit
|
||||||
|
make distclean
|
||||||
|
make -s -j4 -C ./ $flags
|
||||||
|
cd bin/"$OSNAME"/"$OSARCH"/ || exit
|
||||||
|
./testrunner -all
|
||||||
|
./testrunnerd -all
|
||||||
|
echo "$1 $flags done."
|
||||||
|
cd ../../../../ || exit
|
||||||
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user