-
Notifications
You must be signed in to change notification settings - Fork 2
/
travis-test
executable file
·170 lines (134 loc) · 3.57 KB
/
travis-test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash -e
set -x
source vars
function apt_install {
sudo apt-get install -qq -y "$@"
}
function minimal_ts_etl_checkout {
test -d env/tranSMART-ETL || svn checkout --depth immediates \
https://github.com/transmart/tranSMART-ETL/trunk env/tranSMART-ETL
svn up --set-depth infinity env/tranSMART-ETL/{Postgres,Kettle-GPL}
}
function postgres_target_deps {
apt_install php5-cli php5-json
minimal_ts_etl_checkout
sudo make -C env /var/lib/postgresql/tablespaces
}
function test_main_pg {
postgres_target_deps
apt_install rsync #solr needs it
make -j4 postgres
test_clinical_load
test_clinical_load_tsbatch
test_solr
}
function customize_vars_oracle {
local readonly port=$1
echo "export ORACLE=1" >> vars
echo "export ORAHOST=$ORACLE_MACHINE" >> vars
echo "export ORAPORT=$port" >> vars
echo "export ORASID=ORCL" >> vars
echo "export ORAUSER=system" >> vars
echo "export ORAPASSWORD=manager" >> vars
echo "export ORACLE_MANAGE_TABLESPACES=1" >> vars
# The pool process seems flaky at this point. Most builds fail
# echo "export USE_POOL_PROCESS=1" >> vars
echo "export export _JAVA_OPTIONS='-Djava.security.egd=file:///dev/urandom'" >> vars
}
function test_main_ora {
local port
if [[ -z "$ORACLE_SECRET" ]]; then
echo "Skipping because \$ORACLE_SECRET is not set"
return 0
fi
apt_install nmap
source ~/ts-travis/oracle_database.sh
port=$(get_oracle_db)
customize_vars_oracle "$port"
source vars
make -C data/oracle start_pool &
make oracle
}
function test_clinical_load {
make -C env data-integration
make -C samples/postgres load_clinical_GSE8581
make -C samples/postgres showdblog
}
function test_clinical_load_tsbatch {
USE_TRANSMART_BATCH=1 make -C samples/postgres load_clinical_GSE27831
}
function test_solr {
local solr_pid
make -C solr solr_home
make -C solr start > /tmp/solr_log 2>&1 &
if ! timeout 30s bash -c 'while ! lsof -iTCP:8983 -sTCP:LISTEN; do sleep 1; done'; then
echo "Solr didn't start within 30 seconds!" >&2
cat /tmp/solr_log
exit 1
fi
make -C solr browse_full_import
solr_pid=%1
kill -HUP $solr_pid
if ! timeout 15s bash -c "while test -d /proc/$solr_pid; do sleep 1; done"; then
echo "Solr didn't exit within 15 seconds!" >&2
cat /tmp/solr_log
exit 1
fi
}
function test_load_dump_load_pg {
postgres_target_deps
make -j4 postgres
# ddl
make -C ddl/postgres clean_all
make -C ddl/postgres dump
make -C ddl/postgres files_all
# data
make -C data/common clean_dumps
make -C data/postgres dump
make postgres_drop
make -j4 postgres
# ideally, there should be no diff, but...
git diff --shortstat ddl/postgres/ data/common/
}
function test_R {
apt_install libcairo-dev clang gfortran g++ libreadline-dev
export CC=clang
export CXX=clang++
export R_FLAGS=-O0
export TRANSMART_USER=$USER
make -C R -j3 root/bin/R
make -C R install_packages
sudo -E make -C R install_rserve_upstart
sudo initctl start rserve
if ! sudo initctl status rserve | grep 'start/running'; then
echo "Rserve not running!" >&2
exit 1
fi
}
function test_configuration_syntax {
make -C config install
groovy -e 'new ConfigSlurper().parse(new File('\
'System.getProperty("user.home"),'\
'".grails/transmartConfig/Config.groovy").toURL())'
}
case $1 in
main_pg)
test_main_pg
;;
main_oracle)
test_main_ora
;;
load_dump_load_pg)
test_load_dump_load_pg
;;
configuration_syntax)
test_configuration_syntax
;;
R)
test_R
;;
*)
echo "Unknown test suite: $1" >&2
;;
esac
# vim: set ts=2 sw=2 et: