~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to storage/ndb/test/run-test/upgrade-boot.sh

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Copyright (C) 2007 MySQL AB
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; version 2 of the License.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
17
 
 
18
#############################################################
 
19
# This script created by Jonas does the following           #
 
20
# Cleans up clones and pevious builds, pulls new clones,    #
 
21
# builds, deploys, configures the tests and launches ATRT   #
 
22
#############################################################
 
23
 
 
24
###############
 
25
#Script setup #
 
26
##############
 
27
 
 
28
save_args=$*
 
29
VERSION="upgrade-boot.sh version 1.00"
 
30
 
 
31
DATE=`date '+%Y-%m-%d'`
 
32
HOST=`hostname -s`
 
33
export DATE HOST
 
34
 
 
35
set -e
 
36
 
 
37
echo "`date` starting: $*"
 
38
 
 
39
verbose=0
 
40
do_clone=yes
 
41
build=yes
 
42
 
 
43
tag0=
 
44
tag1=
 
45
conf=
 
46
extra_args=
 
47
extra_clone=
 
48
LOCK=$HOME/.autotest-lock
 
49
 
 
50
############################
 
51
# Read command line entries#
 
52
############################
 
53
 
 
54
while [ "$1" ]
 
55
do
 
56
        case "$1" in
 
57
                --no-clone) do_clone="";;
 
58
                --no-build) build="";;
 
59
                --verbose) verbose=`expr $verbose + 1`;;
 
60
                --clone=*) clone0=`echo $1 | sed s/--clone=//`;;
 
61
                --clone0=*) clone0=`echo $1 | sed s/--clone0=//`;;
 
62
                --clone1=*) clone1=`echo $1 | sed s/--clone1=//`;;
 
63
                --version) echo $VERSION; exit;;
 
64
                --conf=*) conf=`echo $1 | sed s/--conf=//`;;
 
65
                --tag=*) tag0=`echo $1 | sed s/--tag=//`;;
 
66
                --tag0=*) tag0=`echo $1 | sed s/--tag0=//`;;
 
67
                --tag1=*) tag1=`echo $1 | sed s/--tag1=//`;;
 
68
                --*) echo "Unknown arg: $1";;
 
69
                *) RUN=$*;;
 
70
        esac
 
71
        shift
 
72
done
 
73
 
 
74
if [ -z "$clone1" ]
 
75
then
 
76
        clone1=$clone0
 
77
fi
 
78
 
 
79
if [ -z "$tag0" ]
 
80
then
 
81
        echo "No tag0 specified"
 
82
        exit
 
83
fi
 
84
 
 
85
if [ -z "$tag1" ]
 
86
then
 
87
        echo "No tag1 specified"
 
88
        exit
 
89
fi
 
90
 
 
91
#################################
 
92
#Make sure the configfile exists#
 
93
#if it does not exit. if it does#
 
94
# (.) load it                   # 
 
95
#################################
 
96
if [ -z "$conf" ]
 
97
then
 
98
        if [ -f "`pwd`/autotest.conf" ]
 
99
        then
 
100
                conf="`pwd`/autotest.conf"
 
101
        elif [ -f "$HOME/autotest.conf" ]
 
102
        then
 
103
                conf="$HOME/autotest.conf"
 
104
        fi
 
105
fi
 
106
 
 
107
if [ -f $conf ]
 
108
then
 
109
        . $conf
 
110
else
 
111
        echo "Can't find config file: >$conf<"
 
112
        exit
 
113
fi
 
114
 
 
115
###############################
 
116
# Validate that all interesting
 
117
#   variables where set in conf
 
118
###############################
 
119
vars="src_clone_base install_dir build_dir"
 
120
for i in $vars
 
121
do
 
122
  t=`echo echo \\$$i`
 
123
  if [ -z "`eval $t`" ]
 
124
  then
 
125
      echo "Invalid config: $conf, variable $i is not set"
 
126
      exit
 
127
  fi
 
128
done
 
129
 
 
130
###############################
 
131
#Print out the enviroment vars#
 
132
###############################
 
133
 
 
134
if [ $verbose -gt 0 ]
 
135
then
 
136
        env
 
137
fi
 
138
 
 
139
####################################
 
140
# Setup the lock file name and path#
 
141
# Setup the clone source location  #
 
142
####################################
 
143
 
 
144
src_clone0=${src_clone_base}${clone0}
 
145
src_clone1=${src_clone_base}${clone1}
 
146
 
 
147
#######################################
 
148
# Check to see if the lock file exists#
 
149
# If it does exit.                    #
 
150
#######################################
 
151
 
 
152
if [ -f $LOCK ]
 
153
then
 
154
        echo "Lock file exists: $LOCK"
 
155
        exit 1
 
156
fi
 
157
 
 
158
#######################################
 
159
# If the lock file does not exist then#
 
160
# create it with date and run info    #
 
161
#######################################
 
162
 
 
163
echo "$DATE $RUN" > $LOCK
 
164
 
 
165
#############################
 
166
#If any errors here down, we#
 
167
# trap them, and remove the #
 
168
# Lock file before exit     #
 
169
#############################
 
170
if [ `uname -s` != "SunOS" ]
 
171
then
 
172
        trap "rm -f $LOCK" ERR
 
173
fi
 
174
 
 
175
# You can add more to this path#
 
176
################################
 
177
 
 
178
dst_place0=${build_dir}/clone-$tag0-$DATE.$$
 
179
dst_place1=${build_dir}/clone-$tag1-$DATE.$$
 
180
 
 
181
#########################################
 
182
# Delete source and pull down the latest#
 
183
#########################################
 
184
 
 
185
if [ "$do_clone" ]
 
186
then
 
187
        rm -rf $dst_place0 $dst_place1
 
188
        if [ `echo $src_clone0 | grep -c 'file:\/\/'` = 1 ]
 
189
        then
 
190
                bk clone -l -r$tag0 $src_clone0 $dst_place0
 
191
        else
 
192
                bk clone -r$tag0 $src_clone0 $dst_place0
 
193
        fi
 
194
 
 
195
        if [ `echo $src_clone1 | grep -c 'file:\/\/'` = 1 ]
 
196
        then
 
197
                bk clone -l -r$tag1 $src_clone1 $dst_place1
 
198
        else
 
199
                bk clone -r$tag1 $src_clone1 $dst_place1
 
200
        fi
 
201
fi
 
202
 
 
203
##########################################
 
204
# Build the source, make installs, and   #
 
205
# create the database to be rsynced      #
 
206
##########################################
 
207
install_dir0=$install_dir/$tag0
 
208
install_dir1=$install_dir/$tag1
 
209
if [ "$build" ]
 
210
then
 
211
        cd $dst_place0
 
212
        rm -rf $install_dir0
 
213
        BUILD/compile-ndb-autotest --prefix=$install_dir0
 
214
        make install
 
215
 
 
216
        cd $dst_place1
 
217
        rm -rf $install_dir1
 
218
        BUILD/compile-ndb-autotest --prefix=$install_dir1
 
219
        make install
 
220
fi
 
221
 
 
222
 
 
223
################################
 
224
# Start run script             #
 
225
################################
 
226
 
 
227
script=$install_dir1/mysql-test/ndb/upgrade-run.sh
 
228
$script $save_args --conf=$conf --install-dir=$install_dir --suite=$RUN --nolock $extra_args
 
229
 
 
230
if [ "$build" ]
 
231
then
 
232
    rm -rf $dst_place0 $dst_place1
 
233
fi
 
234
rm -f $LOCK