mirror of
https://github.com/SOCI/soci.git
synced 2026-05-05 02:39:13 -05:00
Include building tests
This commit is contained in:
@@ -50,8 +50,7 @@ function(soci_backend_objects_to_lib)
|
||||
endfunction()
|
||||
|
||||
|
||||
set(BACKENDS "empty" "db2" "firebird" "mysql" "odbc" "oracle" "postgresql" "sqlite3")
|
||||
foreach(CURRENT IN LISTS BACKENDS)
|
||||
foreach(CURRENT IN ITEMS "db2" "empty" "firebird" "mysql" "odbc" "oracle" "postgresql" "sqlite3")
|
||||
string(TOUPPER "${CURRENT}" CURRENT_UPPER)
|
||||
|
||||
# Backwards compatibility with the old cmake setup that used WITH_* variables
|
||||
|
||||
@@ -40,6 +40,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_db2
|
||||
STATIC_TARGET_NAME soci_db2_static
|
||||
ALIAS_NAME DB2
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -26,6 +26,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_empty
|
||||
STATIC_TARGET_NAME soci_empty_static
|
||||
ALIAS_NAME Empty
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -47,6 +47,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_firebird
|
||||
STATIC_TARGET_NAME soci_firebird_static
|
||||
ALIAS_NAME Firebird
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -41,6 +41,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_mysql
|
||||
STATIC_TARGET_NAME soci_mysql_static
|
||||
ALIAS_NAME MySQL
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -40,6 +40,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_odbc
|
||||
STATIC_TARGET_NAME soci_odbc_static
|
||||
ALIAS_NAME ODBC
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -41,6 +41,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_oracle
|
||||
STATIC_TARGET_NAME soci_oracle_static
|
||||
ALIAS_NAME Oracle
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -49,8 +49,8 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_postgresql
|
||||
STATIC_TARGET_NAME soci_postgresql_static
|
||||
ALIAS_NAME PostgreSQL
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
if (SOCI_POSTGRESQL_NO_LO64)
|
||||
target_compile_definitions(soci_postgresql INTERFACE SOCI_POSTGRESQL_NO_LO64)
|
||||
|
||||
@@ -41,6 +41,6 @@ soci_backend_objects_to_lib(
|
||||
SHARED_TARGET_NAME soci_sqlite3
|
||||
STATIC_TARGET_NAME soci_sqlite3_static
|
||||
ALIAS_NAME SQLite3
|
||||
SHARED_DEPS SOCI::shared::core
|
||||
STATIC_DEPS SOCI::static::core
|
||||
SHARED_DEPS SOCI::shared::Core
|
||||
STATIC_DEPS SOCI::static::Core
|
||||
)
|
||||
|
||||
@@ -92,12 +92,12 @@ target_compile_definitions(soci_core_objects
|
||||
if (SOCI_SHARED)
|
||||
add_library(soci_core SHARED)
|
||||
target_link_libraries(soci_core PUBLIC soci_core_objects)
|
||||
add_library(SOCI::shared::core ALIAS soci_core)
|
||||
add_library(SOCI::shared::Core ALIAS soci_core)
|
||||
target_link_libraries(soci_shared_interface INTERFACE SOCI::shared::core)
|
||||
endif()
|
||||
if (SOCI_STATIC)
|
||||
add_library(soci_core_static STATIC)
|
||||
target_link_libraries(soci_core_static PUBLIC soci_core_objects)
|
||||
add_library(SOCI::static::core ALIAS soci_core_static)
|
||||
add_library(SOCI::static::Core ALIAS soci_core_static)
|
||||
target_link_libraries(soci_static_interface INTERFACE SOCI::static::core)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
include(soci_utils)
|
||||
|
||||
add_library(soci_common_tests STATIC common-tests.cpp)
|
||||
target_include_directories(soci_common_tests
|
||||
PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
target_link_libraries(soci_common_tests PUBLIC soci_core_interface)
|
||||
target_include_directories(soci_common_tests PUBLIC "${PROJECT_SOURCE_DIR}/include/private/")
|
||||
|
||||
|
||||
function(soci_make_tests)
|
||||
set(FLAGS "")
|
||||
set(ONE_VAL_OPTIONS "CONNECTION_STRING" "OBJECT_LIB" "SOCI_DEP_ALIAS" "SHARED_NAME" "STATIC_NAME")
|
||||
set(MULTI_VAL_OPTIONS "")
|
||||
cmake_parse_arguments(SOCI_MAKE_TESTS "${FLAGS}" "${ONE_VAL_OPTIONS}" "${MULTI_VAL_OPTIONS}" ${ARGV})
|
||||
soci_verify_parsed_arguments(
|
||||
PREFIX "SOCI_MAKE_TESTS"
|
||||
FUNCTION_NAME "soci_make_tests"
|
||||
REQUIRED "CONNECTION_STRING" "OBJECT_LIB" "SHARED_NAME" "STATIC_NAME"
|
||||
)
|
||||
|
||||
set(CREATED_TESTS "")
|
||||
|
||||
if (SOCI_SHARED)
|
||||
add_executable(${SOCI_MAKE_TESTS_SHARED_NAME} "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_SHARED_NAME} PRIVATE ${SOCI_MAKE_TESTS_OBJECT_LIB})
|
||||
if (SOCI_MAKE_TESTS_SOCI_DEP_ALIAS)
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_SHARED_NAME} PRIVATE SOCI::shared::${SOCI_MAKE_TESTS_SOCI_DEP_ALIAS})
|
||||
endif()
|
||||
|
||||
list(APPEND CREATED_TESTS "${SOCI_MAKE_TESTS_SHARED_NAME}")
|
||||
endif()
|
||||
|
||||
if (SOCI_STATIC)
|
||||
add_executable(${SOCI_MAKE_TESTS_STATIC_NAME} "${SOCI_CXX_DUMMY_SOURCE}")
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_STATIC_NAME} PRIVATE ${SOCI_MAKE_TESTS_OBJECT_LIB})
|
||||
if (SOCI_MAKE_TESTS_SOCI_DEP_ALIAS)
|
||||
target_link_libraries(${SOCI_MAKE_TESTS_STATIC_NAME} PRIVATE SOCI::static::${SOCI_MAKE_TESTS_SOCI_DEP_ALIAS})
|
||||
endif()
|
||||
|
||||
list(APPEND CREATED_TESTS "${SOCI_MAKE_TESTS_STATIC_NAME}")
|
||||
endif()
|
||||
|
||||
foreach (CURRENT IN LISTS CREATED_TESTS)
|
||||
add_test(
|
||||
NAME "${CURRENT}"
|
||||
COMMAND "${CURRENT}" "${SOCI_MAKE_TESTS_CONNECTION_STRING}" "--invisibles"
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
foreach (CURRENT_BACKEND IN ITEMS "db2" "empty" "firebird" "mysql" "odbc" "oracle" "postgresql" "sqlite3")
|
||||
string(TOUPPER "${CURRENT_BACKEND}" CURRENT_BACKEND_UPPER)
|
||||
|
||||
if (SOCI_${CURRENT_BACKEND_UPPER} AND NOT SOCI_${CURRENT_BACKEND_UPPER}_DO_NOT_TEST)
|
||||
add_subdirectory(${CURRENT_BACKEND})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+173
-6692
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(db2_tests OBJECT db2_tests.cpp)
|
||||
target_link_libraries(db2_tests PUBLIC soci_common_tests soci_db2_interface)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND DB2
|
||||
DEPENDS DB2
|
||||
SOURCE test-db2.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "DSN=SAMPLE;Uid=db2inst1;Pwd=db2inst1;autocommit=off")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB db2_tests
|
||||
CONNECTION_STRING "DSN=SAMPLE;Uid=db2inst1;Pwd=db2inst1;autocommit=off"
|
||||
SHARED_NAME "soci_db2_test"
|
||||
STATIC_NAME "soci_db2_test_static"
|
||||
SOCI_DEP_ALIAS "DB2"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "common-tests.h"
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/db2/soci-db2.h"
|
||||
#include "common-tests.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
@@ -387,38 +391,21 @@ TEST_CASE("DB2 test 3", "[db2]")
|
||||
sql.commit();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Redirect errors, unrecoverable problems, and assert() failures to STDERR,
|
||||
// instead of debug message window.
|
||||
// This hack is required to run assert()-driven tests by Buildbot.
|
||||
// NOTE: Comment this 2 lines for debugging with Visual C++ debugger to catch assertions inside.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
#endif //_MSC_VER
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " connectstring [test-arguments...]\n"
|
||||
<< "example: " << argv[0]
|
||||
<< " \'DSN=SAMPLE;Uid=db2inst1;Pwd=db2inst1;autocommit=off\'\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+10
-14
@@ -1,15 +1,11 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(empty_tests OBJECT empty_tests.cpp)
|
||||
target_link_libraries(empty_tests PUBLIC soci_empty_interface)
|
||||
target_include_directories(empty_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../")
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND Empty
|
||||
SOURCE test-empty.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "dummy")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB empty_tests
|
||||
CONNECTION_STRING "dummy"
|
||||
SHARED_NAME "soci_empty_test"
|
||||
STATIC_NAME "soci_empty_test_static"
|
||||
SOCI_DEP_ALIAS "Empty"
|
||||
)
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/empty/soci-empty.h"
|
||||
|
||||
// Normally the tests would include common-tests.h here, but we can't run any
|
||||
// of the tests registered there, so instead include CATCH header directly.
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/empty/soci-empty.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
@@ -1,16 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(firebird_tests OBJECT firebird_tests.cpp)
|
||||
target_link_libraries(firebird_tests PUBLIC soci_common_tests soci_firebird_interface)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND Firebird
|
||||
DEPENDS Firebird
|
||||
SOURCE test-firebird.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "service=/tmp/soci_test.fdb user=SYSDBA password=masterkey")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB firebird_tests
|
||||
CONNECTION_STRING "service=/tmp/soci_test.fdb user=SYSDBA password=masterkey"
|
||||
SHARED_NAME "soci_firebird_test"
|
||||
STATIC_NAME "soci_firebird_test_static"
|
||||
SOCI_DEP_ALIAS "Firebird"
|
||||
)
|
||||
|
||||
@@ -6,12 +6,17 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "common-tests.h"
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/firebird/soci-firebird.h"
|
||||
#include "soci-compiler.h"
|
||||
|
||||
#include "firebird/error-firebird.h" // soci::details::Firebird::throw_iscerror()
|
||||
#include "firebird/common.h"
|
||||
#include "common-tests.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
@@ -1254,40 +1259,21 @@ class test_context : public tests::test_context_base
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Redirect errors, unrecoverable problems, and assert() failures to STDERR,
|
||||
// instead of debug message window.
|
||||
// This hack is required to run assert()-driven tests by Buildbot.
|
||||
// NOTE: Comment this 2 lines for debugging with Visual C++ debugger to catch assertions inside.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
#endif //_MSC_VER
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
// Replace the connect string with the process name to ensure that
|
||||
// CATCH uses the correct name in its messages.
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " connectstring [test-arguments...]\n"
|
||||
<< "example: " << argv[0]
|
||||
<< " \"service=/usr/local/firebird/db/test.fdb user=SYSDBA password=masterkey\"\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(mysql_tests OBJECT mysql_tests.cpp)
|
||||
target_link_libraries(mysql_tests PUBLIC soci_common_tests soci_mysql_interface)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND MySQL
|
||||
DEPENDS MySQL
|
||||
SOURCE test-mysql.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "db=soci_test")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB mysql_tests
|
||||
CONNECTION_STRING "db=soci_test"
|
||||
SHARED_NAME "soci_mysql_test"
|
||||
STATIC_NAME "soci_mysql_test_static"
|
||||
SOCI_DEP_ALIAS "MySQL"
|
||||
)
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "mysql/mysql_tests.h"
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci-compiler.h"
|
||||
#include "soci/mysql/soci-mysql.h"
|
||||
#include "mysql/test-mysql.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -794,29 +797,21 @@ void test15()
|
||||
std::cout << "test 15 passed" << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
if (argc >= 2)
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
// Replace the connect string with the process name to ensure that
|
||||
// CATCH uses the correct name in its messages.
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " connectstring [test-arguments...]\n"
|
||||
<< "example: " << argv[0]
|
||||
<< " \"dbname=test user=root password=\'Ala ma kota\'\"\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(oracle_tests OBJECT oracle_tests.cpp)
|
||||
target_link_libraries(oracle_tests PUBLIC soci_common_tests soci_oracle_interface)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND Oracle
|
||||
DEPENDS Oracle
|
||||
SOURCE test-oracle.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "service=orcl user=scott password=tiger")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB oracle_tests
|
||||
CONNECTION_STRING "service=orcl user=scott password=tiger"
|
||||
SHARED_NAME "soci_oracle_test"
|
||||
STATIC_NAME "soci_oracle_test_static"
|
||||
SOCI_DEP_ALIAS "Oracle"
|
||||
)
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "common-tests.h"
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/oracle/soci-oracle.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -142,7 +146,7 @@ TEST_CASE("Oracle datetime", "[oracle][datetime]")
|
||||
CHECK(t4.tm_year == t2.tm_year);
|
||||
CHECK((1900 + t4.tm_year) == i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// explicit calls test
|
||||
@@ -1536,44 +1540,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
// Redirect errors, unrecoverable problems, and assert() failures to STDERR,
|
||||
// instead of debug message window.
|
||||
// This hack is required to run assert()-driven tests by Buildbot.
|
||||
// NOTE: Comment this 2 lines for debugging with Visual C++ debugger to catch assertions inside.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
#endif //_MSC_VER
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
// Replace the connect string with the process name to ensure that
|
||||
// CATCH uses the correct name in its messages.
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " connectstring [test-arguments...]\n"
|
||||
<< "example: " << argv[0]
|
||||
<< " \'service=orcl user=scott password=tiger\'\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
if (!std::getenv("ORACLE_HOME"))
|
||||
{
|
||||
std::cerr << "ORACLE_HOME environment variable must be defined for Oracle tests.\n";
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(postgresql_tests OBJECT postgresql_tests.cpp)
|
||||
target_link_libraries(postgresql_tests PUBLIC soci_common_tests soci_postgresql_interface)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND PostgreSQL
|
||||
DEPENDS PostgreSQL
|
||||
SOURCE test-postgresql.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR "dbname=soci_test")
|
||||
soci_make_tests(
|
||||
OBJECT_LIB postgresql_tests
|
||||
CONNECTION_STRING "dbname=soci_test"
|
||||
SHARED_NAME "soci_postgresql_test"
|
||||
STATIC_NAME "soci_postgresql_test_static"
|
||||
SOCI_DEP_ALIAS "PostgreSQL"
|
||||
)
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "common-tests.h"
|
||||
|
||||
#include "soci/soci.h"
|
||||
#include "soci/postgresql/soci-postgresql.h"
|
||||
#include "common-tests.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -1401,39 +1405,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Redirect errors, unrecoverable problems, and assert() failures to STDERR,
|
||||
// instead of debug message window.
|
||||
// This hack is required to run assert()-driven tests by Buildbot.
|
||||
// NOTE: Comment this 2 lines for debugging with Visual C++ debugger to catch assertions inside.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
#endif //_MSC_VER
|
||||
|
||||
if (argc >= 2)
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
// Replace the connect string with the process name to ensure that
|
||||
// CATCH uses the correct name in its messages.
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " connectstring [test-arguments...]\n"
|
||||
<< "example: " << argv[0]
|
||||
<< " \'connect_string_for_PostgreSQL\'\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,11 @@
|
||||
###############################################################################
|
||||
#
|
||||
# This file is part of CMake configuration for SOCI library
|
||||
#
|
||||
# Copyright (C) 2010-2013 Mateusz Loskot <mateusz@loskot.net>
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
#
|
||||
###############################################################################
|
||||
add_library(sqlite_tests OBJECT sqlite3_tests.cpp)
|
||||
target_link_libraries(sqlite_tests PUBLIC soci_common_tests soci_sqlite3_interface)
|
||||
|
||||
soci_make_tests(
|
||||
OBJECT_LIB sqlite_tests
|
||||
CONNECTION_STRING ":memory:"
|
||||
SHARED_NAME "soci_sqlite3_test"
|
||||
STATIC_NAME "soci_sqlite3_test_static"
|
||||
SOCI_DEP_ALIAS "SQLite3"
|
||||
)
|
||||
|
||||
soci_backend_test(
|
||||
BACKEND SQLite3
|
||||
DEPENDS SQLite3
|
||||
SOURCE test-sqlite3.cpp ${SOCI_TESTS_COMMON}
|
||||
CONNSTR ":memory:")
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "common-tests.h"
|
||||
|
||||
#include <soci/soci.h>
|
||||
#include <soci/sqlite3/soci-sqlite3.h>
|
||||
#include "common-tests.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
@@ -15,6 +19,7 @@
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
using namespace soci;
|
||||
using namespace soci::tests;
|
||||
@@ -887,36 +892,22 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
||||
namespace soci
|
||||
{
|
||||
namespace tests
|
||||
{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Redirect errors, unrecoverable problems, and assert() failures to STDERR,
|
||||
// instead of debug message window.
|
||||
// This hack is required to run assert()-driven tests by Buildbot.
|
||||
// NOTE: Comment this 2 lines for debugging with Visual C++ debugger to catch assertions inside.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||
#endif //_MSC_VER
|
||||
|
||||
if (argc >= 2 && argv[1][0] != '-')
|
||||
{
|
||||
connectString = argv[1];
|
||||
|
||||
// Replace the connect string with the process name to ensure that
|
||||
// CATCH uses the correct name in its messages.
|
||||
argv[1] = argv[0];
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no file name is specfied then work in-memory
|
||||
connectString = ":memory:";
|
||||
}
|
||||
|
||||
test_context tc(backEnd, connectString);
|
||||
|
||||
return Catch::Session().run(argc, argv);
|
||||
std::unique_ptr<test_context_base> instantiate_test_context(const soci::backend_factory &backend, const std::string &connection_string)
|
||||
{
|
||||
connectString = connection_string;
|
||||
return std::make_unique<test_context>(backend, connection_string);
|
||||
}
|
||||
|
||||
const backend_factory &create_backend_factory()
|
||||
{
|
||||
return backEnd;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user