Engage nuclear option of travis testing
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 10_before_install.bash
CommitLineData
b58ecb01 1#!/bin/bash
2
3source maint/travis-ci_scripts/common.bash
4if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5
03d379e5 6# Different boxes we run on may have different amount of hw threads
7# Hence why we need to query
8# Originally we used to read /sys/devices/system/cpu/online
9# but it is not available these days (odd). Thus we fall to
10# the alwas-present /proc/cpuinfo
11# The oneliner is a tad convoluted - basicaly what we do is
12# slurp the entire file and get the index off the last
13# `processor : XX` line
14export NUMTHREADS=$(( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ))
b58ecb01 15
16if [[ "$CLEANTEST" != "true" ]]; then
17### apt-get invocation - faster to grab everything at once
18 #
19 # FIXME these debconf lines should automate the firebird config but do not :(((
20 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections'
21 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections'
22
23 APT_PACKAGES="memcached firebird2.5-super firebird2.5-dev expect"
24 run_or_err "Installing packages ($APT_PACKAGES)" "sudo apt-get install --allow-unauthenticated -y $APT_PACKAGES"
25
26### config memcached
27 export DBICTEST_MEMCACHED=127.0.0.1:11211
28
29### config mysql
30 run_or_err "Creating MySQL TestDB" "mysql -e 'create database dbic_test;'"
31 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
32 export DBICTEST_MYSQL_USER=root
33
34### config pg
35 run_or_err "Creating PostgreSQL TestDB" "psql -c 'create database dbic_test;' -U postgres"
36 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
37 export DBICTEST_PG_USER=postgres
38
39### conig firebird
40 # poor man's deb config
41 EXPECT_FB_SCRIPT='
42 spawn dpkg-reconfigure --frontend=text firebird2.5-super
43 expect "Enable Firebird server?"
44 send "\177\177\177\177yes\r"
45 expect "Password for SYSDBA"
46 send "123\r"
47 sleep 1
48 wait
49 sleep 1
50 '
b58ecb01 51 # creating testdb
52 # FIXME - this step still fails from time to time >:(((
53 # has to do with the FB reconfiguration I suppose
906c0355 54 # for now if it fails twice - simply skip FB testing
55 for i in 1 2 ; do
56
57 run_or_err "Re-configuring Firebird" "
58 sync
59 DEBIAN_FRONTEND=text sudo expect -c '$EXPECT_FB_SCRIPT'
60 sleep 1
61 sync
62 # restart the server for good measure
63 sudo /etc/init.d/firebird2.5-super stop || true
64 sleep 1
65 sync
66 sudo /etc/init.d/firebird2.5-super start
67 sleep 1
68 sync
69 "
70
71 if run_or_err "Creating Firebird TestDB" \
72 "echo \"CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';\" | sudo isql-fb -u sysdba -p 123"
73 then
74 export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
75 export DBICTEST_FIREBIRD_USER=SYSDBA
76 export DBICTEST_FIREBIRD_PASS=123
77
78 export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
79 export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA
80 export DBICTEST_FIREBIRD_INTERBASE_PASS=123
81
82 break
83 fi
84
85 done
b58ecb01 86
87### oracle
88 # FIXME: todo
89 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
90 #DBICTEST_ORA_USER=dbic_test
91 #DBICTEST_ORA_PASS=123
92 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
93 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
94 #DBICTEST_ORA_EXTRAUSER_PASS=123
95 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
96fi