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