Test for restricted prefetch (now passing again after previous commit)
[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
6if [[ -n "$BREWVER" ]] ; then
7 # .travis.yml already restricts branches to master, topic/* and smoke/*
8 # do some extra short-circuiting here
9
10 # when smoking master do not attempt bleadperl (not release-critical)
e0824081 11 if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
12 echo_err "$(tstamp) pull-request smoking with custom perl compilation requested - bailing out"
13 export SHORT_CIRCUIT_SMOKE=1
14 elif [[ "$TRAVIS_BRANCH" = "master" ]] && [[ "$BREWVER" = "blead" ]]; then
b58ecb01 15 echo_err "$(tstamp) master branch is not smoked with bleadperl - bailing out"
16 export SHORT_CIRCUIT_SMOKE=1
17 # on topic/ branches test only with travis perls
18 elif [[ "$TRAVIS_BRANCH" =~ "topic/" ]]; then
19 echo_err "$(tstamp) non-smoke branch and custom perl compilation requested - bailing out"
20 export SHORT_CIRCUIT_SMOKE=1
21 fi
22
23 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]]; then
24 sleep 20 # give the console time to attach, otherwise it hangs
25 return # this is like an `exit 0` in sourcing
26 fi
27fi
28
29# different boxes we run on may have different amount of hw threads
30# hence why we need to query
31# result is 1.5 times the physical threads
32export NUMTHREADS=$(( ( $(cut -f 2 -d '-' /sys/devices/system/cpu/online) + 1 ) * 15 / 10 ))
33
34if [[ "$CLEANTEST" != "true" ]]; then
35### apt-get invocation - faster to grab everything at once
36 #
37 # FIXME these debconf lines should automate the firebird config but do not :(((
38 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections'
39 sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections'
40
41 APT_PACKAGES="memcached firebird2.5-super firebird2.5-dev expect"
42 run_or_err "Installing packages ($APT_PACKAGES)" "sudo apt-get install --allow-unauthenticated -y $APT_PACKAGES"
43
44### config memcached
45 export DBICTEST_MEMCACHED=127.0.0.1:11211
46
47### config mysql
48 run_or_err "Creating MySQL TestDB" "mysql -e 'create database dbic_test;'"
49 export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1'
50 export DBICTEST_MYSQL_USER=root
51
52### config pg
53 run_or_err "Creating PostgreSQL TestDB" "psql -c 'create database dbic_test;' -U postgres"
54 export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1'
55 export DBICTEST_PG_USER=postgres
56
57### conig firebird
58 # poor man's deb config
59 EXPECT_FB_SCRIPT='
60 spawn dpkg-reconfigure --frontend=text firebird2.5-super
61 expect "Enable Firebird server?"
62 send "\177\177\177\177yes\r"
63 expect "Password for SYSDBA"
64 send "123\r"
65 sleep 1
66 wait
67 sleep 1
68 '
b58ecb01 69 # creating testdb
70 # FIXME - this step still fails from time to time >:(((
71 # has to do with the FB reconfiguration I suppose
906c0355 72 # for now if it fails twice - simply skip FB testing
73 for i in 1 2 ; do
74
75 run_or_err "Re-configuring Firebird" "
76 sync
77 DEBIAN_FRONTEND=text sudo expect -c '$EXPECT_FB_SCRIPT'
78 sleep 1
79 sync
80 # restart the server for good measure
81 sudo /etc/init.d/firebird2.5-super stop || true
82 sleep 1
83 sync
84 sudo /etc/init.d/firebird2.5-super start
85 sleep 1
86 sync
87 "
88
89 if run_or_err "Creating Firebird TestDB" \
90 "echo \"CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';\" | sudo isql-fb -u sysdba -p 123"
91 then
92 export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
93 export DBICTEST_FIREBIRD_USER=SYSDBA
94 export DBICTEST_FIREBIRD_PASS=123
95
96 export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb
97 export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA
98 export DBICTEST_FIREBIRD_INTERBASE_PASS=123
99
100 break
101 fi
102
103 done
b58ecb01 104
105### oracle
106 # FIXME: todo
107 #DBICTEST_ORA_DSN=dbi:Oracle:host=localhost;sid=XE
108 #DBICTEST_ORA_USER=dbic_test
109 #DBICTEST_ORA_PASS=123
110 #DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle:host=localhost;sid=XE
111 #DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra
112 #DBICTEST_ORA_EXTRAUSER_PASS=123
113 #ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
114fi