diff --git a/.travis.yml b/.travis.yml index fc5fb512..2bed5bf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ addons: before_install: - chmod +x .travis/script.sh + - chmod +x .travis/osx.sh - chmod +x .travis/gen-ssl.sh - chmod +x .travis/build/build.sh - chmod +x .travis/build/docker-entrypoint.sh @@ -20,20 +21,45 @@ before_install: matrix: allow_failures: - - env: DB=build - - env: DB=mariadb:10.2 PACKET=8M MAXSCALE_VERSION=2.1.8 - - env: DB=mysql:5.5 - - env: DB=mysql:5.6 - - env: DB=mysql:5.7 + - os: linux + env: DB=mariadb:10.2 PACKET=8M MAXSCALE_VERSION=2.1.8 + - os: linux + env: DB=mysql:5.5 + - os: linux + env: DB=mysql:5.6 + - os: linux + env: DB=mysql:5.7 include: - - env: DB=build - - env: DB=mariadb:5.5 - - env: DB=mariadb:10.0 - - env: DB=mariadb:10.1 - - env: DB=mariadb:10.2 - - env: DB=mariadb:10.3 + - os: linux + env: DB=build + - os: linux + env: DB=mariadb:5.5 + - os: linux + env: DB=mariadb:10.0 + - os: linux + env: DB=mariadb:10.1 + - os: linux + env: DB=mariadb:10.2 + - os: linux + compiler: gcc + env: DB=mariadb:10.3 + - os: linux + compiler: clang + env: DB=mariadb:10.3 + - os: osx + compiler: clang + env: DB=mariadb:10.3 + - os: linux + env: DB=mariadb:10.2 PACKET=8M MAXSCALE_VERSION=2.1.8 + - os: linux + env: DB=mysql:5.5 + - os: linux + env: DB=mysql:5.6 + - os: linux + env: DB=mysql:5.7 script: - - if [ "$DB" = "build" ] ; then .travis/build/build.sh; fi - - if [ "$DB" = "build" ] ; then docker build -t build:latest --label build .travis/build/; fi - - .travis/script.sh + - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$DB" = "build" ] ; then .travis/build/build.sh; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$DB" = "build" ] ; then docker build -t build:latest --label build .travis/build/; fi + - if [ "$TRAVIS_OS_NAME" = "linux" ] ; then .travis/script.sh; fi + - if [ "$TRAVIS_OS_NAME" = "osx" ]; then .travis/osx.sh; fi diff --git a/.travis/osx.sh b/.travis/osx.sh new file mode 100644 index 00000000..487c8919 --- /dev/null +++ b/.travis/osx.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -x +set -e + +# set variables for Connector/ODBC +export TEST_DRIVER="$PWD/libmaodbc.dylib" +export TEST_DSN=madb_connstring_test +export TEST_SERVER=localhost +export TEST_SOCKET= +export TEST_SCHEMA=odbc_test +export TEST_UID=root +export TEST_PASSWORD= + +# for some reason brew upgrades postgresql, so let's remove it +brew remove postgis +brew uninstall --ignore-dependencies postgresql +# upgrade openssl +brew upgrade openssl +# install unixodbc +brew install libiodbc +# install and start MariaDB Server +brew install mariadb +mysql.server start + +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_OPENSSL=ON -DWITH_IODBC=ON -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2q -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2q/lib +cmake --build . --config RelWithDebInfo +################################################################################################################### +# run test suite +################################################################################################################### + +# set variables for odbc.ini and odbcinst.ini +export ODBCINI="$PWD/test/odbc.ini" +cat ${ODBCINI} +export ODBCINSTINI="$PWD/test/odbcinst.ini" +cat ${ODBCINSTINI} + +# check users of MariaDB and create test database +mysql --version +mysql -u root -e "SELECT user, host FROM mysql.user" +mysql -u root -e "CREATE DATABASE odbc_test" +mysql -u root -e "SHOW DATABASES" + +echo "Running tests" +cd test +ctest -V diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e69e421..a916225c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,6 +172,14 @@ ENDIF() IF(NOT WIN32) # Looking for DM(UnixODBC) files INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindDM.cmake) + MESSAGE(STATUS "DM_FOUND: ${DM_FOUND}, ODBC_LIB_DIR: ${ODBC_LIB_DIR}, ODBC_INCLUDE_DIR: ${ODBC_INCLUDE_DIR}") + + IF(APPLE) + SET(ODBC_LIB_DIR "/usr/local/Cellar/libiodbc/3.52.12/lib/") + SET(ODBC_INCLUDE_DIR "/usr/local/Cellar/libiodbc/3.52.12/include") + SET(DM_FOUND TRUE) + ENDIF() + IF(DM_FOUND) INCLUDE_DIRECTORIES(${ODBC_INCLUDE_DIR}) LINK_DIRECTORIES(${ODBC_LIB_DIR}) @@ -274,6 +282,7 @@ IF(WIN32) ELSE() MESSAGE(STATUS "Version script: ${CMAKE_SOURCE_DIR}/maodbc.def") ADD_LIBRARY(${LIBRARY_NAME} SHARED ${MARIADB_ODBC_SOURCES} maodbcu.rc) + IF(APPLE) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-Wl") ELSE() diff --git a/test/tap.h b/test/tap.h index 5d151b73..064414d2 100644 --- a/test/tap.h +++ b/test/tap.h @@ -1274,6 +1274,9 @@ char * GenGUID(char *buffer) } #endif +/* Atm iODBC is the only DM using SQLWCHAR of 4 bytes size */ +#define iOdbc() (sizeof(SQLWCHAR)==4) + BOOL UnixOdbc() { #ifdef SQL_ATTR_UNIXODBC_VERSION