Re-arranged unit/classes tests build

Moved common files to the separate OBJECT lib, as it looked like it is
quite difficult for the gcc to chew it.
Skipped tiem-outing test for now. Needs to be fixed.
This commit is contained in:
Lawrin Novitsky
2020-07-31 00:07:08 +02:00
parent dda40e1fc7
commit 485fa861a1
5 changed files with 55 additions and 70 deletions

View File

@ -98,6 +98,28 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC AND MYSQLCPPCONN_GCOV_ENABLE)
MESSAGE(STATUS "Configuring unit tests")
SET(test_common_src
unit_fixture.cpp
main.cpp)
IF(WIN32)
SET(test_common_src
${test_common_src}
unit_fixture.h)
ENDIF(WIN32)
IF(TRUE)#NOT WIN32)
# CREATE OBJECT LIBRARY
ADD_LIBRARY(classes_test_obj OBJECT ${test_common_src})
IF(UNIX)
#SET_TARGET_PROPERTIES(classes_test_obj PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
ENDIF()
SET (test_common_sources $<TARGET_OBJECTS:classes_test_obj>)
ELSE()
SET (test_common_sources ${test_common_src})
ENDIF()
ADD_SUBDIRECTORY(example/)
ADD_SUBDIRECTORY(classes/)
ADD_SUBDIRECTORY(performance/)

View File

@ -28,15 +28,13 @@
SET(bugs_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
bugs.cpp)
IF(WIN32)
SET(bugs_sources
${bugs_sources}
bugs.h
../unit_fixture.h)
bugs.h)
ENDIF(WIN32)

View File

@ -27,17 +27,6 @@
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(test_common_sources
../unit_fixture.cpp
../main.cpp)
IF(WIN32)
SET(test_common_sources
${test_common_sources}
../unit_fixture.h)
ENDIF(WIN32)
SET(test_connection_sources
${test_common_sources}
connection.cpp)
@ -59,14 +48,12 @@ TARGET_LINK_LIBRARIES(test_connection ${LIBRARY_NAME} ${PLATFORM_DEPENDENCIES} t
MESSAGE(STATUS "Configuring unit tests - connection")
SET(test_databasemetadata_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
connectionmetadata.cpp)
IF(WIN32)
SET(test_databasemetadata_sources
${test_databasemetadata_sources}
../unit_fixture.h
connectionmetadata.h)
ENDIF(WIN32)
@ -82,14 +69,12 @@ MESSAGE(STATUS "Configuring unit tests - databasemetadata")
SET(test_resultsetmetadata_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
resultsetmetadata.cpp)
IF(WIN32)
SET(test_resultsetmetadata_sources
${test_resultsetmetadata_sources}
../unit_fixture.h
resultsetmetadatatest.h)
ENDIF(WIN32)
@ -104,14 +89,12 @@ TARGET_LINK_LIBRARIES(test_resultsetmetadata ${LIBRARY_NAME} ${PLATFORM_DEPENDEN
MESSAGE(STATUS "Configuring unit tests - resultsetmetadata")
SET(test_resultset_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
resultset.cpp)
IF(WIN32)
SET(test_resultset_sources
${test_resultset_sources}
../unit_fixture.h
resultsettest.h)
ENDIF(WIN32)
@ -126,14 +109,12 @@ TARGET_LINK_LIBRARIES(test_resultset ${LIBRARY_NAME} ${PLATFORM_DEPENDENCIES} te
MESSAGE(STATUS "Configuring unit tests - resultset")
SET(test_savepoint_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
savepoint.cpp)
IF(WIN32)
SET(test_savepoint_sources
${test_savepoint_sources}
../unit_fixture.h
savepointtest.h)
ENDIF(WIN32)
@ -148,14 +129,12 @@ TARGET_LINK_LIBRARIES(test_savepoint ${LIBRARY_NAME} ${PLATFORM_DEPENDENCIES} te
MESSAGE(STATUS "Configuring unit tests - savepoint")
SET(test_preparedstatement_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
preparedstatement.cpp)
IF(WIN32)
SET(test_preparedstatement_sources
${test_preparedstatement_sources}
../unit_fixture.h
preparedstatementtest.h)
ENDIF(WIN32)
@ -170,14 +149,12 @@ TARGET_LINK_LIBRARIES(test_preparedstatement ${LIBRARY_NAME} ${PLATFORM_DEPENDEN
MESSAGE(STATUS "Configuring unit tests - preparedstatement")
SET(test_parametermetadata_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
parametermetadata.cpp)
IF(WIN32)
SET(test_parametermetadata_sources
${test_parametermetadata_sources}
../unit_fixture.h
parametermetadatatest.h)
ENDIF(WIN32)
@ -192,14 +169,12 @@ TARGET_LINK_LIBRARIES(test_parametermetadata ${LIBRARY_NAME} ${PLATFORM_DEPENDEN
MESSAGE(STATUS "Configuring unit tests - parametermetadata")
SET(test_art_resultset_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
art_resultset.cpp)
IF(WIN32)
SET(test_art_resultset_sources
${test_art_resultset_sources}
../unit_fixture.h
art_resultset.h)
ADD_DEFINITIONS("-DCPPCONN_PUBLIC_FUNC=")
@ -215,14 +190,12 @@ ENDIF(WIN32)
#MESSAGE(STATUS "Configuring unit tests - art_resultset")
SET(test_statement_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
statement.cpp)
IF(WIN32)
SET(test_statement_sources
${test_statement_sources}
../unit_fixture.h
statementtest.h)
ENDIF(WIN32)
@ -259,14 +232,12 @@ ENDIF(WIN32)
SET(test_variant_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
variant.cpp)
IF(WIN32)
SET(test_variant_sources
${test_variant_sources}
../unit_fixture.h
variant.h)
ENDIF(WIN32)

View File

@ -1103,13 +1103,9 @@ void preparedstatement::callSPWithPS()
{
logMsg("preparedstatement::callSPWithPS() - MySQL_PreparedStatement::*()");
SKIP("Before fixed");
try
{
int mysql_version=getMySQLVersion(con);
if (mysql_version < 60000)
SKIP("http://bugs.mysql.com/bug.php?id=44495 - Server crash");
std::string sp_code("CREATE PROCEDURE p(IN val VARCHAR(25)) BEGIN SET @sql = CONCAT('SELECT \"', val, '\"'); PREPARE stmt FROM @sql; EXECUTE stmt; DROP PREPARE stmt; END;");
if (!createSP(sp_code))
{

View File

@ -28,14 +28,12 @@
SET(perf_statement_sources
../unit_fixture.cpp
../main.cpp
${test_common_sources}
perf_statement.cpp)
IF(WIN32)
SET(perf_statement_sources
${perf_statement_sources}
../unit_fixture.h
perf_statement.h)
ENDIF(WIN32)