Fix stupid bug in run-diagnostics-suite.sh - destination config file
[arvados-dev.git] / jenkins / run-diagnostics-suite.sh
1 #!/bin/bash
2
3 EXITCODE=0
4
5 INSTANCE=$1
6
7 if [[ "$INSTANCE" == '' ]]; then
8   echo "Syntax: $0 <instance>"
9   exit 1
10 fi
11
12 # Sanity check
13 if ! [[ -n "$WORKSPACE" ]]; then
14   echo "WORKSPACE environment variable not set"
15   exit 1
16 fi
17
18 title () {
19     txt="********** $1 **********"
20     printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
21 }
22
23 timer_reset() {
24     t0=$SECONDS
25 }
26
27 timer() {
28     echo -n "$(($SECONDS - $t0))s"
29 }
30
31 source /etc/profile.d/rvm.sh
32 echo $WORKSPACE
33
34 title "Starting diagnostics"
35 timer_reset
36
37 cd $WORKSPACE
38
39 cp -f /home/jenkins/diagnostics/arvados-workbench/$INSTANCE-application.yml $WORKSPACE/apps/workbench/config/application.yml
40
41 cd $WORKSPACE/apps/workbench
42
43 HOME="$GEMHOME" bundle install --no-deployment
44
45 if [[ ! -d tmp ]]; then
46   mkdir tmp
47 fi
48
49 RAILS_ENV=diagnostics bundle exec rake TEST=test/diagnostics/pipeline_test.rb
50
51 ECODE=$?
52
53 if [[ "$ECODE" != "0" ]]; then
54   title "!!!!!! DIAGNOSTICS FAILED (`timer`) !!!!!!"
55   EXITCODE=$(($EXITCODE + $ECODE))
56   exit $EXITCODE
57 fi
58
59 title "Diagnostics complete (`timer`)"
60
61 exit $EXITCODE