3 export SHORT_CIRCUIT_SMOKE
7 # Stop pre-started RDBMS, move their data back to disk (save RAM)
8 # sync for some settle time (not available on all platforms)
9 for d in mysql postgresql ; do
10 # maybe not even running
11 run_or_err "Stopping $d" "sudo /etc/init.d/$d stop || /bin/true"
13 # no longer available on newer build systems
14 if [[ -d /var/ramfs/$d ]] ; then
15 sudo rm -rf /var/lib/$d
16 sudo mv /var/ramfs/$d /var/lib/
17 sudo ln -s /var/lib/$d /var/ramfs/$d
23 # Sanity check VM before continuing
25 =============================================================================
30 ============================================================================="
32 CI_VM_MIN_FREE_MB=2000
33 if [[ "$(free -m | grep 'buffers/cache:' | perl -p -e '$_ = (split /\s+/, $_)[3]')" -lt "$CI_VM_MIN_FREE_MB" ]]; then
36 =============================================================================
38 CI virtual machine stuck in a state with a lot of memory locked for no reason.
39 Under Travis this state usually results in a failed build.
40 Short-circuiting buildjob to avoid false negatives, please restart it manually.
42 ============================================================================="
44 # pull requests are always scrutinized after the fact anyway - run a
46 elif [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
47 if [[ -n "$BREWVER" ]]; then
48 # just don't brew anything
51 # running PRs with 1 thread is non-sensical
56 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
58 # Previously we were going off the OpenVZ vcpu count and dividing by 3
59 # With the new infrastructure, somply go with "something high"
60 export VCPU_AVAILABLE=10
62 if [[ -z "$VCPU_USE" ]] ; then
63 export VCPU_USE="$VCPU_AVAILABLE"
67 if [[ "$CLEANTEST" != "true" ]]; then
69 if [[ -z "$(tail -n +2 /proc/swaps)" ]] ; then
70 run_or_err "Configuring swap (for Oracle)" \
71 "sudo bash -c 'dd if=/dev/zero of=/swap.img bs=256M count=5 && chmod 600 /swap.img && mkswap /swap.img && swapon /swap.img'"
74 export CACHE_DIR="/tmp/poormanscache"
77 # FIXME these debconf lines should automate the firebird config but do not :(((
78 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections'
79 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections'
81 # these APT sources do not mean anything to us anyway
82 sudo rm -rf /etc/apt/sources.list.d/*
84 # never installed, this looks like trusty
85 if [[ ! -d /var/lib/mysql ]] ; then
86 sudo dpkg --add-architecture i386
87 extra_debs="postgresql mysql-server"
90 run_or_err "Updating APT sources" "sudo apt-get update"
92 apt_install $extra_debs libmysqlclient-dev memcached firebird2.5-super firebird2.5-dev unixodbc-dev expect
94 # need to stop them again
95 if [[ -n "$extra_debs" ]] ; then
96 for d in mysql postgresql ; do
97 sudo /etc/init.d/$d stop || /bin/true
101 run_or_err "Cloning poor man's cache from github" "git clone --depth=1 --single-branch --branch=oracle/10.2.0 https://github.com/poormanscache/poormanscache.git $CACHE_DIR && $CACHE_DIR/reassemble"
102 run_or_err "Installing OracleXE manually from deb" \
103 "sudo dpkg -i $CACHE_DIR/apt_cache/bc-multiarch-travis_1.0_all.deb $CACHE_DIR/apt_cache/oracle-xe_10.2.0.1-1.1_i386.deb || sudo bash -c 'source maint/travis-ci_scripts/common.bash && apt_install -f'"
106 run_or_err "Starting memcached" "sudo /etc/init.d/memcached start"
107 export DBICTEST_MEMCACHED=127.0.0.1:11211
110 run_or_err "Installing minimizing MySQL config" "\
111 sudo bash -c 'rm /var/lib/mysql/ib*' \
112 && sudo cp maint/travis-ci_scripts/configs/minimal_mysql_travis.cnf /etc/mysql/conf.d/ \
113 && sudo chmod 644 /etc/mysql/conf.d/*.cnf \
116 run_or_err "Starting MySQL" "sudo /etc/init.d/mysql start"
117 run_or_err "Creating MySQL TestDB" "mysql -u root -e 'create database dbic_test;'"
118 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
119 export DBICTEST_MYSQL_USER=root
122 run_or_err "Starting PostgreSQL" "sudo /etc/init.d/postgresql start"
123 run_or_err "Creating PostgreSQL TestDB" "psql -c 'create database dbic_test;' -U postgres"
124 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
125 export DBICTEST_PG_USER=postgres
128 # poor man's deb config
130 spawn dpkg-reconfigure --frontend=text firebird2.5-super
131 expect "Enable Firebird server?"
132 send "\177\177\177\177yes\r"
133 expect "Password for SYSDBA"
139 # FIXME - this step still fails from time to time >:(((
140 # has to do with the FB reconfiguration I suppose
141 # for now if it fails twice - simply skip FB testing
144 run_or_err "Re-configuring Firebird" "
146 DEBIAN_FRONTEND=text sudo expect -c '$EXPECT_FB_SCRIPT'
149 # restart the server for good measure
150 sudo /etc/init.d/firebird2.5-super stop || true
153 sudo /etc/init.d/firebird2.5-super start
158 if run_or_err "Creating Firebird TestDB" \
159 "echo \"CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';\" | sudo isql-fb -u sysdba -p 123"
162 run_or_err "Fetching and building Firebird ODBC driver" '
164 wget -qO- http://sourceforge.net/projects/firebird/files/firebird-ODBC-driver/2.0.2-Release/OdbcFb-Source-2.0.2.153.gz/download | tar -zx
166 perl -p -i -e "s|/usr/lib64|/usr/lib/x86_64-linux-gnu|g" ../makefile.environ
167 make -f makefile.linux
168 sudo make -f makefile.linux install
171 sudo bash -c 'cat >> /etc/odbcinst.ini' <<< "
173 Description = InterBase/Firebird ODBC Driver
174 Driver = /usr/lib/x86_64-linux-gnu/libOdbcFb.so
175 Setup = /usr/lib/x86_64-linux-gnu/libOdbcFb.so
180 export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
181 export DBICTEST_FIREBIRD_USER=SYSDBA
182 export DBICTEST_FIREBIRD_PASS=123
184 export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
185 export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA
186 export DBICTEST_FIREBIRD_INTERBASE_PASS=123
188 export DBICTEST_FIREBIRD_ODBC_DSN="dbi:ODBC:Driver=Firebird;Dbname=/var/lib/firebird/2.5/data/dbic_test.fdb"
189 export DBICTEST_FIREBIRD_ODBC_USER=SYSDBA
190 export DBICTEST_FIREBIRD_ODBC_PASS=123
198 SRV_ORA_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
200 # without this some of the more zealous tests can exhaust the amount
201 # of listeners and oracle is too slow to spin extras up :(
202 sudo bash -c "echo -e '\nprocesses=150' >> $SRV_ORA_HOME/config/scripts/init.ora"
205 spawn /etc/init.d/oracle-xe configure
208 set send_slow {1 .005}
210 expect "Specify the HTTP port that will be used for Oracle Application Express"
214 expect "Specify a port that will be used for the database listener"
218 expect "Specify a password to be used for database accounts"
220 send -s "adminpass\r"
222 expect "Confirm the password"
224 send -s "adminpass\r"
226 expect "Do you want Oracle Database 10g Express Edition to be started on boot"
231 expect "Configuring Database"
238 # if we do not redirect to some random file, but instead try to capture
239 # into a var the way run_or_err does - everything hangs
240 # FIXME: I couldn't figure it out after 3 hours of headdesking,
241 # would be nice to know the reason eventually
242 run_or_err "Configuring OracleXE" "sudo $(which expect) -c '$EXPECT_ORA_SCRIPT' &>/tmp/ora_configure_10.2.log"
244 export DBICTEST_ORA_DSN=dbi:Oracle://localhost:1521/XE
245 export DBICTEST_ORA_USER=dbic_test
246 export DBICTEST_ORA_PASS=abc123456
247 export DBICTEST_ORA_EXTRAUSER_DSN="$DBICTEST_ORA_DSN"
248 export DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
249 export DBICTEST_ORA_EXTRAUSER_PASS=abc123456
251 run_or_err "Create Oracle users" "ORACLE_SID=XE ORACLE_HOME=$SRV_ORA_HOME $SRV_ORA_HOME/bin/sqlplus -L -S system/adminpass @/dev/stdin <<< '
252 CREATE USER $DBICTEST_ORA_USER IDENTIFIED BY $DBICTEST_ORA_PASS;
253 GRANT connect,resource TO $DBICTEST_ORA_USER;
254 CREATE USER $DBICTEST_ORA_EXTRAUSER_USER IDENTIFIED BY $DBICTEST_ORA_EXTRAUSER_PASS;
255 GRANT connect,resource TO $DBICTEST_ORA_EXTRAUSER_USER;
258 export ORACLE_HOME="$CACHE_DIR/ora_instaclient/x86-64/oracle_instaclient_10.2.0.5.0"