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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
#!/bin/sh
# Copyright (c) 2007 MySQL AB
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#############################################################
# This script created by Jonas does the following #
# Cleans up clones and pevious builds, pulls new clones, #
# builds, deploys, configures the tests and launches ATRT #
#############################################################
###############
#Script setup #
##############
save_args=$*
VERSION="upgrade-boot.sh version 1.00"
DATE=`date '+%Y-%m-%d'`
HOST=`hostname -s`
export DATE HOST
set -e
echo "`date` starting: $*"
verbose=0
do_clone=yes
build=yes
tag0=
tag1=
conf=
extra_args=
extra_clone=
LOCK=$HOME/.autotest-lock
############################
# Read command line entries#
############################
while [ "$1" ]
do
case "$1" in
--no-clone) do_clone="";;
--no-build) build="";;
--verbose) verbose=`expr $verbose + 1`;;
--clone=*) clone0=`echo $1 | sed s/--clone=//`;;
--clone0=*) clone0=`echo $1 | sed s/--clone0=//`;;
--clone1=*) clone1=`echo $1 | sed s/--clone1=//`;;
--version) echo $VERSION; exit;;
--conf=*) conf=`echo $1 | sed s/--conf=//`;;
--tag=*) tag0=`echo $1 | sed s/--tag=//`;;
--tag0=*) tag0=`echo $1 | sed s/--tag0=//`;;
--tag1=*) tag1=`echo $1 | sed s/--tag1=//`;;
--*) echo "Unknown arg: $1";;
*) RUN=$*;;
esac
shift
done
if [ -z "$clone1" ]
then
clone1=$clone0
fi
if [ -z "$tag0" ]
then
echo "No tag0 specified"
exit
fi
if [ -z "$tag1" ]
then
echo "No tag1 specified"
exit
fi
#################################
#Make sure the configfile exists#
#if it does not exit. if it does#
# (.) load it #
#################################
if [ -z "$conf" ]
then
if [ -f "`pwd`/autotest.conf" ]
then
conf="`pwd`/autotest.conf"
elif [ -f "$HOME/autotest.conf" ]
then
conf="$HOME/autotest.conf"
fi
fi
if [ -f $conf ]
then
. $conf
else
echo "Can't find config file: >$conf<"
exit
fi
###############################
# Validate that all interesting
# variables where set in conf
###############################
vars="src_clone_base install_dir build_dir"
for i in $vars
do
t=`echo echo \\$$i`
if [ -z "`eval $t`" ]
then
echo "Invalid config: $conf, variable $i is not set"
exit
fi
done
###############################
#Print out the enviroment vars#
###############################
if [ $verbose -gt 0 ]
then
env
fi
####################################
# Setup the lock file name and path#
# Setup the clone source location #
####################################
src_clone0=${src_clone_base}${clone0}
src_clone1=${src_clone_base}${clone1}
#######################################
# Check to see if the lock file exists#
# If it does exit. #
#######################################
if [ -f $LOCK ]
then
echo "Lock file exists: $LOCK"
exit 1
fi
#######################################
# If the lock file does not exist then#
# create it with date and run info #
#######################################
echo "$DATE $RUN" > $LOCK
#############################
#If any errors here down, we#
# trap them, and remove the #
# Lock file before exit #
#############################
if [ `uname -s` != "SunOS" ]
then
trap "rm -f $LOCK" ERR
fi
# You can add more to this path#
################################
dst_place0=${build_dir}/clone-$tag0-$DATE.$$
dst_place1=${build_dir}/clone-$tag1-$DATE.$$
#########################################
# Delete source and pull down the latest#
#########################################
if [ "$do_clone" ]
then
rm -rf $dst_place0 $dst_place1
if [ `echo $src_clone0 | grep -c 'file:\/\/'` = 1 ]
then
bk clone -l -r$tag0 $src_clone0 $dst_place0
else
bk clone -r$tag0 $src_clone0 $dst_place0
fi
if [ `echo $src_clone1 | grep -c 'file:\/\/'` = 1 ]
then
bk clone -l -r$tag1 $src_clone1 $dst_place1
else
bk clone -r$tag1 $src_clone1 $dst_place1
fi
fi
##########################################
# Build the source, make installs, and #
# create the database to be rsynced #
##########################################
install_dir0=$install_dir/$tag0
install_dir1=$install_dir/$tag1
if [ "$build" ]
then
cd $dst_place0
rm -rf $install_dir0
BUILD/compile-ndb-autotest --prefix=$install_dir0
make install
cd $dst_place1
rm -rf $install_dir1
BUILD/compile-ndb-autotest --prefix=$install_dir1
make install
fi
################################
# Start run script #
################################
script=$install_dir1/mysql-test/ndb/upgrade-run.sh
$script $save_args --conf=$conf --install-dir=$install_dir --suite=$RUN --nolock $extra_args
if [ "$build" ]
then
rm -rf $dst_place0 $dst_place1
fi
rm -f $LOCK
|