Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:SOCI/soci into hotfix/3.2.2_174
Browse files Browse the repository at this point in the history
Conflicts:
	bin/ci/before_install.sh
	bin/ci/before_script.sh
	bin/ci/script.sh

Closes #174
  • Loading branch information
mloskot committed Jul 25, 2013
2 parents 1db4dac + adcec56 commit 4a7afd6
Show file tree
Hide file tree
Showing 22 changed files with 391 additions and 159 deletions.
21 changes: 15 additions & 6 deletions .travis.yml
@@ -1,19 +1,29 @@
# .travis.yml
# Configure Travis CI service to build SOCI library
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
# Configure Travis CI service to build SOCI library, http://github.com/SOCI
#
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
language: cpp

# Testing against two compilers will create (at least) 2 rows in build matrix
# http://about.travis-ci.org/docs/user/languages/cpp/
compiler:
- g++
- clang
#- clang

services:
- mysql
- postgresql

env:
matrix:
- SOCI_TRAVIS_BACKEND=db2
- SOCI_TRAVIS_BACKEND=empty
- SOCI_TRAVIS_BACKEND=firebird
- SOCI_TRAVIS_BACKEND=mysql
- SOCI_TRAVIS_BACKEND=odbc
- SOCI_TRAVIS_BACKEND=oracle
- SOCI_TRAVIS_BACKEND=postgresql
- SOCI_TRAVIS_BACKEND=sqlite3

before_install: ./bin/ci/before_install.sh
before_script: ./bin/ci/before_script.sh
script: ./bin/ci/script.sh
Expand All @@ -22,7 +32,6 @@ notifications:
email:
recipients:
- soci-devel@lists.sourceforge.net
- mateusz@loskot.net
on_success: change # [always|never|change] # default: change
on_failure: always # [always|never|change] # default: always

Expand Down
96 changes: 9 additions & 87 deletions bin/ci/before_install.sh
@@ -1,91 +1,13 @@
#!/bin/bash
# Run before_intsall actions for SOCI build at travis-ci.org
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#!/bin/bash -e
# Run before_install actions for SOCI build at travis-ci.org
#
source ./bin/ci/common.sh
# Install dependencies
echo "$(tmstamp) *** before_install::apt-get starting $(date) ***"
#sudo apt-get install -qq apt-transport-https
#wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O - | sudo apt-key add -
#sudo bash -c 'echo "deb https://oss.oracle.com/debian unstable main non-free" >> /etc/apt/sources.list'
sudo bash -c 'echo "deb http://archive.canonical.com/ubuntu precise partner" >> /etc/apt/sources.list'
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
sudo apt-get update -qq
#if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes ia32-libs ia32-libs-multiarch fi
sudo apt-get install -qq \
tar bzip2 \
libstdc++5 \
libaio1 \
libboost-dev libboost-date-time-dev \
libmyodbc odbc-postgresql \
firebird2.5-super firebird2.5-dev
echo "$(tmstamp) *** before_install::apt-get finished $(date) ***"

echo "$(tmstamp) *** before_install::oracle starting $(date) ***"

if wget http://brzuchol.loskot.net/software/oracle/instantclient_11_2-linux-x64-mloskot.tar.bz2 ; then
tar -jxf instantclient_11_2-linux-x64-mloskot.tar.bz2
sudo mkdir -p /opt
sudo mv instantclient_11_2 /opt
sudo ln -s ${ORACLE_HOME}/libclntsh.so.11.1 ${ORACLE_HOME}/libclntsh.so
sudo ln -s ${ORACLE_HOME}/libocci.so.11.1 ${ORACLE_HOME}/libocci.so
else
echo "WARNING: failed to download Orcale distribution. Oracle will not be tested."
fi
echo "$(tmstamp) *** before_install::oracle finished $(date) ***"

echo "$(tmstamp) *** before_install::db2 starting $(date) ***"
echo "Running apt-get install db2exc"
# deliberately verbose to test - mloskot
sudo apt-get install -y db2exc
echo "Running db2profile and db2rmln"
sudo /bin/sh -c '. ~db2inst1/sqllib/db2profile ; $DB2DIR/cfg/db2rmln'
echo "Setting up db2 users"
echo -e "db2inst1\ndb2inst1" | sudo passwd db2inst1
echo -e "db2fenc1\ndb2fenc1" | sudo passwd db2fenc1
echo -e "dasusr1\ndasusr1" | sudo passwd dasusr1
echo "Configuring DB2 ODBC driver"
if test `getconf LONG_BIT` = "64" ; then
if test -f /home/db2inst1/sqllib/lib64/libdb2o.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib64/libdb2o.so
else
echo "ERROR: can't find the 64-bit DB2 ODBC library"
exit 1
fi
else
if test -f /home/db2inst1/sqllib/lib32/libdb2.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib32/libdb2.so
elif test -f /home/db2inst1/sqllib/lib/libdb2.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib/libdb2.so
else
echo "ERROR: can't find the 32-bit DB2 ODBC library"
exit 1
fi
fi
echo "DB2 ODBC driver set to $DB2_ODBC_DRIVER"
echo "$(tmstamp) *** before_install::db2 finished $(date) ***"

echo "$(tmstamp) *** before_install::odbc starting $(date) ***"
# to prevent header file conflicts, unixodbc-dev has to be installed after
# db2rmln is run
sudo apt-get install -qq unixodbc-dev
echo "$(tmstamp) *** before_install::odbc finished $(date) ***"
sudo apt-get install -qq libboost-dev libboost-date-time-dev

echo "$(tmstamp) *** before_install::config starting $(date) ***"
# Configure Firebird
# See: Non-interactive setup for travis-ci.org
# http://tech.groups.yahoo.com/group/firebird-support/message/120883
#sudo dpkg-reconfigure -f noninteractive firebird2.5-super
sudo sed /ENABLE_FIREBIRD_SERVER=/s/no/yes/ -i /etc/default/firebird2.5
cat /etc/default/firebird2.5 | grep ENABLE_FIREBIRD_SERVER
sudo service firebird2.5-super start
# Configure ODBC
sudo odbcinst -i -d -f /usr/share/libmyodbc/odbcinst.ini
cat <<EOF | sudo odbcinst -i -d -r
[DB2]
Description = ODBC for DB2
Driver = $DB2_ODBC_DRIVER
FileUsage = 1
Threading = 0
EOF
echo "$(tmstamp) *** before_install::config finished $(date) ***"
before_install="${TRAVIS_BUILD_DIR}/bin/ci/before_install_${SOCI_TRAVIS_BACKEND}.sh"
[ -x ${before_install} ] && ${before_install} || echo "nothing to run"
39 changes: 39 additions & 0 deletions bin/ci/before_install_db2.sh
@@ -0,0 +1,39 @@
#!/bin/bash -e
# Installs DB2 for SOCI build at travis-ci.org
#
# Copyright (c) 2013 Brian R. Toonen <toonen@alcf.anl.gov>
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo bash -c 'echo "deb http://archive.canonical.com/ubuntu precise partner" >> /etc/apt/sources.list'
sudo apt-get update -qq
sudo apt-get install -y db2exc

echo "Running db2profile and db2rmln"
sudo /bin/sh -c '. ~db2inst1/sqllib/db2profile ; $DB2DIR/cfg/db2rmln'

echo "Setting up db2 users"
echo -e "db2inst1\ndb2inst1" | sudo passwd db2inst1
echo -e "db2fenc1\ndb2fenc1" | sudo passwd db2fenc1
echo -e "dasusr1\ndasusr1" | sudo passwd dasusr1

echo "Configuring DB2 ODBC driver"
if test `getconf LONG_BIT` = "64" ; then
if test -f /home/db2inst1/sqllib/lib64/libdb2o.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib64/libdb2o.so
else
echo "ERROR: can't find the 64-bit DB2 ODBC library"
exit 1
fi
else
if test -f /home/db2inst1/sqllib/lib32/libdb2.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib32/libdb2.so
elif test -f /home/db2inst1/sqllib/lib/libdb2.so ; then
DB2_ODBC_DRIVER=/home/db2inst1/sqllib/lib/libdb2.so
else
echo "ERROR: can't find the 32-bit DB2 ODBC library"
exit 1
fi
fi
echo "DB2 ODBC driver set to $DB2_ODBC_DRIVER"
16 changes: 16 additions & 0 deletions bin/ci/before_install_firebird.sh
@@ -0,0 +1,16 @@
#!/bin/bash -e
# Install Firebird server for SOCI at travis-ci.org
#
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo apt-get install -qq firebird2.5-super firebird2.5-dev

# Configure Firebird server
# See: Non-interactive setup for travis-ci.org
# http://tech.groups.yahoo.com/group/firebird-support/message/120883
#sudo dpkg-reconfigure -f noninteractive firebird2.5-super
sudo sed /ENABLE_FIREBIRD_SERVER=/s/no/yes/ -i /etc/default/firebird2.5
cat /etc/default/firebird2.5 | grep ENABLE_FIREBIRD_SERVER
sudo service firebird2.5-super start
13 changes: 13 additions & 0 deletions bin/ci/before_install_odbc.sh
@@ -0,0 +1,13 @@
#!/bin/bash -e
# Install ODBC libraries for SOCI at travis-ci.org
#
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo apt-get install -qq \
tar bzip2 \
unixodbc-dev \
libmyodbc odbc-postgresql

sudo odbcinst -i -d -f /usr/share/libmyodbc/odbcinst.ini
15 changes: 15 additions & 0 deletions bin/ci/before_install_oracle.sh
@@ -0,0 +1,15 @@
#!/bin/bash -e
# Install Oracle client libraries for SOCI at travis-ci.org
#
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo apt-get install -qq tar bzip2 libaio1

wget http://brzuchol.loskot.net/software/oracle/instantclient_11_2-linux-x64-mloskot.tar.bz2
tar -jxf instantclient_11_2-linux-x64-mloskot.tar.bz2
sudo mkdir -p /opt
sudo mv instantclient_11_2 /opt
sudo ln -s ${ORACLE_HOME}/libclntsh.so.11.1 ${ORACLE_HOME}/libclntsh.so
sudo ln -s ${ORACLE_HOME}/libocci.so.11.1 ${ORACLE_HOME}/libocci.so
26 changes: 7 additions & 19 deletions bin/ci/before_script.sh
@@ -1,21 +1,9 @@
#!/bin/bash
#!/bin/bash -e
# Run before_script actions for SOCI build at travis-ci.org
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ./bin/ci/common.sh
# Create local databases
echo "$(tmstamp) *** before_script::createdb starting $(date) ***"
# MySQL (service provided)
mysql --version
mysql -e 'create database soci_test;'
# PostgreSQL (service provided)
psql --version
psql -c 'create database soci_test;' -U postgres
# Firebird (installed manually, see before_install.sh)
isql-fb -z -q -i /dev/null # --version
echo 'CREATE DATABASE "LOCALHOST:/tmp/soci_test.fdb" PAGE_SIZE = 16384;' > /tmp/create_soci_test.sql
isql-fb -u SYSDBA -p masterkey -i /tmp/create_soci_test.sql -q
cat /tmp/create_soci_test.sql
sudo -u db2inst1 -i db2 "CREATE DATABASE SOCITEST"
sudo -u db2inst1 -i db2 "ACTIVATE DATABASE SOCITEST"
echo "$(tmstamp) *** before_script::createdb finished $(date) ***"
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

before_script="${TRAVIS_BUILD_DIR}/bin/ci/before_script_${SOCI_TRAVIS_BACKEND}.sh"
[ -x ${before_script} ] && ${before_script} || echo "nothing to run"
10 changes: 10 additions & 0 deletions bin/ci/before_script_db2.sh
@@ -0,0 +1,10 @@
#!/bin/bash -e
# Sets up environment for SOCI backend DB2 at travis-ci.org
#
# Copyright (c) 2013 Brian R. Toonen <toonen@alcf.anl.gov>
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

sudo -u db2inst1 -i db2 "CREATE DATABASE SOCITEST"
sudo -u db2inst1 -i db2 "ACTIVATE DATABASE SOCITEST"
11 changes: 11 additions & 0 deletions bin/ci/before_script_firebird.sh
@@ -0,0 +1,11 @@
#!/bin/bash -e
# Configure Firebird database for SOCI build at travis-ci.org
#
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

isql-fb -z -q -i /dev/null # --version
echo 'CREATE DATABASE "LOCALHOST:/tmp/soci_test.fdb" PAGE_SIZE = 16384;' > /tmp/create_soci_test.sql
isql-fb -u SYSDBA -p masterkey -i /tmp/create_soci_test.sql -q
cat /tmp/create_soci_test.sql
9 changes: 9 additions & 0 deletions bin/ci/before_script_mysql.sh
@@ -0,0 +1,9 @@
#!/bin/bash -e
# Sets up environment for SOCI backend MySQL at travis-ci.org
#
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

mysql --version
mysql -e 'create database soci_test;'
11 changes: 11 additions & 0 deletions bin/ci/before_script_odbc.sh
@@ -0,0 +1,11 @@
#!/bin/bash -e
# Sets up environment for SOCI backend ODBC at travis-ci.org
#
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

mysql --version
mysql -e 'create database soci_test;'
psql --version
psql -c 'create database soci_test;' -U postgres
9 changes: 9 additions & 0 deletions bin/ci/before_script_postgresql.sh
@@ -0,0 +1,9 @@
#!/bin/bash -e
# Sets up environment for SOCI backend PostgreSQL at travis-ci.org
#
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh

psql --version
psql -c 'create database soci_test;' -U postgres
33 changes: 24 additions & 9 deletions bin/ci/common.sh
@@ -1,21 +1,36 @@
#!/bin/bash
#!/bin/bash -e
# Common definitions used by SOCI build scripts at travis-ci.org
# Mateusz Loskot <mateusz@loskot.net>, http://github.com/SOCI
#
set -e

# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
if [[ "$TRAVIS" != "true" ]] ; then
echo "Running this script makes no sense outside of travis-ci.org"
exit 1
fi
# Functions
tmstamp() { echo -n "[$(date '+%H:%M:%S')]" ; }
#
# Environment
NUMTHREADS=4
#
TCI_NUMTHREADS=2
if [[ -f /sys/devices/system/cpu/online ]]; then
# Calculates 1.5 times physical threads
NUMTHREADS=$(( ( $(cut -f 2 -d '-' /sys/devices/system/cpu/online) + 1 ) * 15 / 10 ))
TCI_NUMTHREADS=$(( ( $(cut -f 2 -d '-' /sys/devices/system/cpu/online) + 1 ) * 15 / 10 ))
fi
export NUMTHREADS
export ORACLE_HOME=/opt/instantclient_11_2
export LD_LIBRARY_PATH=${ORACLE_HOME}:${LD_LIBRARY_PATH}
#
# Functions
#
tmstamp()
{
echo -n "[$(date '+%H:%M:%S')]" ;
}

run_make()
{
[ $TCI_NUMTHREADS -gt 0 ] && make -j $TCI_NUMTHREADS ] || make
}

run_test()
{
ctest -V --output-on-failure .
}

0 comments on commit 4a7afd6

Please sign in to comment.