Commit | Line | Data |
b58ecb01 |
1 | #!/bin/bash |
2 | |
3 | source maint/travis-ci_scripts/common.bash |
4 | if [[ -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 |
003e97c5 |
14 | export NUMTHREADS="$(( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ))" |
15 | |
16 | export CACHE_DIR="/tmp/poormanscache" |
17 | |
18 | # install some common tools from APT, more below unless CLEANTEST |
19 | apt_install libapp-nopaste-perl tree apt-transport-https |
b58ecb01 |
20 | |
1e735709 |
21 | # FIXME - the debian package is oddly broken - uses a bin/env based shebang |
22 | # so nothing works under a brew. Fix here until #debian-perl patches it up |
23 | sudo /usr/bin/perl -p -i -e 's|#!/usr/bin/env perl|#!/usr/bin/perl|' $(which nopaste) |
24 | |
b58ecb01 |
25 | if [[ "$CLEANTEST" != "true" ]]; then |
26 | ### apt-get invocation - faster to grab everything at once |
27 | # |
28 | # FIXME these debconf lines should automate the firebird config but do not :((( |
29 | sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/enabled\tboolean\ttrue" | debconf-set-selections' |
30 | sudo bash -c 'echo -e "firebird2.5-super\tshared/firebird/sysdba_password/new_password\tpassword\t123" | debconf-set-selections' |
31 | |
003e97c5 |
32 | # add extra APT repo for Oracle |
33 | # (https is critical - apt-get update can't seem to follow the 302) |
34 | sudo bash -c 'echo -e "\ndeb [arch=i386] https://oss.oracle.com/debian unstable main non-free" >> /etc/apt/sources.list' |
35 | |
36 | run_or_err "Cloning poor man's cache from github" "git clone --depth=1 --branch=poor_mans_travis_cache https://github.com/ribasushi/travis_futzing.git $CACHE_DIR && $CACHE_DIR/reassemble" |
37 | |
38 | run_or_err "Priming up the APT cache with $(echo $(ls -d $CACHE_DIR/apt_cache/*.deb))" "sudo cp $CACHE_DIR/apt_cache/*.deb /var/cache/apt/archives" |
39 | |
40 | apt_install memcached firebird2.5-super firebird2.5-dev expect oracle-xe |
b58ecb01 |
41 | |
42 | ### config memcached |
106c81a5 |
43 | run_or_err "Starting memcached" "sudo /etc/init.d/memcached start" |
b58ecb01 |
44 | export DBICTEST_MEMCACHED=127.0.0.1:11211 |
45 | |
46 | ### config mysql |
47 | run_or_err "Creating MySQL TestDB" "mysql -e 'create database dbic_test;'" |
48 | export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1' |
49 | export DBICTEST_MYSQL_USER=root |
50 | |
51 | ### config pg |
52 | run_or_err "Creating PostgreSQL TestDB" "psql -c 'create database dbic_test;' -U postgres" |
53 | export DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=127.0.0.1' |
54 | export DBICTEST_PG_USER=postgres |
55 | |
56 | ### conig firebird |
57 | # poor man's deb config |
58 | EXPECT_FB_SCRIPT=' |
59 | spawn dpkg-reconfigure --frontend=text firebird2.5-super |
60 | expect "Enable Firebird server?" |
61 | send "\177\177\177\177yes\r" |
62 | expect "Password for SYSDBA" |
63 | send "123\r" |
64 | sleep 1 |
003e97c5 |
65 | expect eof |
b58ecb01 |
66 | ' |
b58ecb01 |
67 | # creating testdb |
68 | # FIXME - this step still fails from time to time >:((( |
69 | # has to do with the FB reconfiguration I suppose |
906c0355 |
70 | # for now if it fails twice - simply skip FB testing |
71 | for i in 1 2 ; do |
72 | |
73 | run_or_err "Re-configuring Firebird" " |
74 | sync |
75 | DEBIAN_FRONTEND=text sudo expect -c '$EXPECT_FB_SCRIPT' |
76 | sleep 1 |
77 | sync |
78 | # restart the server for good measure |
79 | sudo /etc/init.d/firebird2.5-super stop || true |
80 | sleep 1 |
81 | sync |
82 | sudo /etc/init.d/firebird2.5-super start |
83 | sleep 1 |
84 | sync |
85 | " |
86 | |
87 | if run_or_err "Creating Firebird TestDB" \ |
88 | "echo \"CREATE DATABASE '/var/lib/firebird/2.5/data/dbic_test.fdb';\" | sudo isql-fb -u sysdba -p 123" |
89 | then |
90 | export DBICTEST_FIREBIRD_DSN=dbi:Firebird:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb |
91 | export DBICTEST_FIREBIRD_USER=SYSDBA |
92 | export DBICTEST_FIREBIRD_PASS=123 |
93 | |
94 | export DBICTEST_FIREBIRD_INTERBASE_DSN=dbi:InterBase:dbname=/var/lib/firebird/2.5/data/dbic_test.fdb |
95 | export DBICTEST_FIREBIRD_INTERBASE_USER=SYSDBA |
96 | export DBICTEST_FIREBIRD_INTERBASE_PASS=123 |
97 | |
98 | break |
99 | fi |
100 | |
101 | done |
b58ecb01 |
102 | |
003e97c5 |
103 | ### config oracle |
104 | EXPECT_ORA_SCRIPT=' |
105 | spawn /etc/init.d/oracle-xe configure |
106 | |
107 | sleep 1 |
108 | set send_slow {1 .005} |
109 | |
110 | expect "Specify the HTTP port that will be used for Oracle Application Express" |
111 | sleep 0.5 |
112 | send -s "8021\r" |
113 | |
114 | expect "Specify a port that will be used for the database listener" |
115 | sleep 0.5 |
116 | send -s "1521\r" |
117 | |
118 | expect "Specify a password to be used for database accounts" |
119 | sleep 0.5 |
120 | send -s "adminpass\r" |
121 | |
122 | expect "Confirm the password" |
123 | sleep 0.5 |
124 | send -s "adminpass\r" |
125 | |
126 | expect "Do you want Oracle Database 10g Express Edition to be started on boot" |
127 | sleep 0.5 |
128 | send -s "n\r" |
129 | |
130 | sleep 0.5 |
131 | expect "Configuring Database" |
132 | |
133 | sleep 1 |
134 | expect eof |
135 | wait |
136 | ' |
137 | |
138 | # if we do not redirect to some random file, but instead try to capture |
139 | # into a var the way run_or_err does - everything hangs |
140 | # FIXME: I couldn't figure it out after 3 hours of headdesking, |
141 | # would be nice to know the reason eventually |
142 | run_or_err "Configuring OracleXE" "sudo $(which expect) -c '$EXPECT_ORA_SCRIPT' &>/tmp/ora_configure_10.2.log" |
143 | SRV_ORA_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server |
144 | |
145 | export DBICTEST_ORA_DSN=dbi:Oracle://localhost:1521/XE |
146 | export DBICTEST_ORA_USER=dbic_test |
147 | export DBICTEST_ORA_PASS=abc123456 |
148 | export DBICTEST_ORA_EXTRAUSER_DSN=dbi:Oracle://localhost:1521/XE |
149 | export DBICTEST_ORA_EXTRAUSER_USER=dbic_test_extra |
150 | export DBICTEST_ORA_EXTRAUSER_PASS=abc123456 |
151 | |
152 | 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 <<< ' |
153 | CREATE USER $DBICTEST_ORA_USER IDENTIFIED BY $DBICTEST_ORA_PASS; |
154 | GRANT connect,resource TO $DBICTEST_ORA_USER; |
155 | CREATE USER $DBICTEST_ORA_EXTRAUSER_USER IDENTIFIED BY $DBICTEST_ORA_EXTRAUSER_PASS; |
156 | GRANT connect,resource TO $DBICTEST_ORA_EXTRAUSER_USER; |
157 | '" |
158 | |
159 | export ORACLE_HOME="$CACHE_DIR/ora_instaclient/x86-64/oracle_instaclient_10.2.0.5.0" |
b58ecb01 |
160 | fi |