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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
#!/bin/bash
#
# Copyright (C) 2014,2015 Linaro, Inc
#
# 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; either version 3 of the License, or
# (at your option) any later version.
#
# 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
#
# To run, this script takes arguments in the same format as abe.sh. The two
# arguments it needs are the target architecture to build, and the gcc backport
# branch name. Example:
# $PATH/test-backport.sh --target arm-linux-gnueabihf gcc.git~4.9-backport-209419
usage()
{
# Format this section with 75 columns.
cat << EOF
test-backport.sh [--help] [f|--fileserver remote file server] --target triplet branch
EOF
exit 0
}
# Improve debug logs
PRGNAME=`basename $0`
PS4='+ $PRGNAME: ${FUNCNAME+"$FUNCNAME : "}$LINENO: '
if test $# -lt 2; then
echo "ERROR: No branch to build!"
usage
exit 1
fi
# load commonly used functions
which_dir="`which $0`"
topdir="`dirname ${which_dir}`"
user_snapshots="${WORKSPACE}/snapshots"
shared="/home/buildslave/workspace/shared/"
snapshots_ref="${shared}/snapshots"
if test ! -d ${snapshots_ref}/gcc.git; then
git clone http://git.linaro.org/git/toolchain/gcc.git ${snapshots_ref}/gcc.git
fi
# Configure Abe itself. Force the use of bash instead of the Ubuntu
# default of dash as some configure scripts go into an infinite loop with
# dash. Not good...
# In addition, we may have overridden CONFIG_SHELL to use a schroot
# before, and need to reset it now that we are in the schroot.
export CONFIG_SHELL="/bin/bash"
if test x"${debug}" = x"true"; then
export CONFIG_SHELL="/bin/bash -x"
fi
if test x"${abe_dir}" = x; then
abe_dir=${topdir}
fi
$CONFIG_SHELL ${abe_dir}/configure --enable-schroot-test --with-local-snapshots=${user_snapshots} --with-git-reference-dir=${snapshots_ref}
# load commonly used functions
if test -e "${PWD}/host.conf"; then
. "${PWD}/host.conf"
else
echo "Error: this script needs to be run from a configured Abe tree!" 1>&2
exit 1
fi
abe="`which $0`"
abe_path="`dirname ${abe}`"
topdir="${abe_path}"
abe="`basename $0`"
# Non matrix builds use node_selector, but matrix builds use NODE_NAME
if test x"${node_selector}" != x; then
node="`echo ${node_selector} | tr '-' '_'`"
job=${JOB_NAME}
else
node="`echo ${NODE_NAME} | tr '-' '_'`"
job="`echo ${JOB_NAME} | cut -d '/' -f 1`"
fi
basedir="/work/logs"
repo="gcc.git"
fileserver="abe.tcwglab.linaro.org"
branch=""
# Whether to exclude some component from 'make check'
excludecheck=
OPTS="`getopt -o s:r:f:w:o:t:g:h -l target:,fileserver:,help,snapshots:,repo:,workspace:,options,check:,excludecheck: -- "$@"`"
while test $# -gt 0; do
case $1 in
-s|--snapshots) local_snapshots=$2; shift ;;
-f|--fileserver) fileserver=$2; shift ;;
-r|--repo) repo=$2; shift ;;
-w|--workspace) user_workspace=$2; shift ;;
-o|--options) user_options=$2; shift ;;
-t|--target) target=$2; shift ;;
-c|--check) check=$2; shift ;;
-h|--help) usage ;;
--excludecheck) excludecheck=$2; shift ;;
*) branch=$1;;
--) break ;;
esac
shift
done
if test x"${target}" != x"native" -a x"${target}" != x; then
platform="--target ${target}"
targetname=${target}
else
# For native builds, we need to know the effective target name to
# be able to find the results
targetname=${build}
fi
check="--check ${check:-all}"
check="${check}${excludecheck:+ --excludecheck ${excludecheck}}"
if test "`echo ${branch} | grep -c gcc.git`" -gt 0; then
branch="`echo ${branch} | sed -e 's:gcc.git~::'`"
fi
if test x"${git_reference_dir}" != x; then
srcdir="${git_reference_dir}/${branch}"
else
git_reference_dir="${local_snapshots}"
srcdir="${local_snapshots}/gcc.git~${branch}"
fi
# Due to update cycles, sometimes the branch isn't in the repository yet.
exists="`cd ${git_reference_dir}/${repo} && git branch -a | grep -c "${branch}"`"
if test "${exists}" -eq 0; then
pushd ${git_reference_dir}/${repo} && git fetch
popd
fi
rm -fr ${srcdir}
git-new-workdir ${git_reference_dir}/${repo} ${srcdir} ${branch} || exit 1
# Make sure we are at the top of ${branch}
pushd ${srcdir}
# If in 'detached HEAD' state, don't try to update to the top of the branch
detached=`git branch | grep detached`
if test x"${detached}" = x; then
git checkout -B ${branch} origin/${branch} || exit 1
fi
popd
# Get the last two revisions
declare -a revisions=(`cd ${srcdir} && git log -n 2 | grep ^commit | cut -d ' ' -f 2`)
# Force GCC to not build the docs
export BUILD_INFO=""
# Don't try to add comments to Gerrit if run manually
if test x"${GERRIT_PATCHSET_REVISION}" != x; then
gerrit="--enable gerrit"
else
gerrit=""
fi
# Checkout all the sources
#bash -x ${topdir}/abe.sh --checkout all
resultsdir="/tmp/${node}/abe$$/${target}@"
files="`find ${local_builds}/${build}/${target}/ -maxdepth 1 -type d | egrep 'stage2|binutils'`"
i=0
while test $i -lt ${#revisions[@]}; do
dir="${basedir}/gcc-linaro/${branch}/${job}${BUILD_NUMBER}/${build}.${target}/${revisions[$i]}"
# Don't build if a previous build of this revision exists
exists="`ssh ${fileserver} "if test -d ${dir}; then echo YES; else echo NO; fi"`"
if test x"${exists}" = x"YES"; then
echo "${dir} already exists"
i="`expr $i + 1`"
continue
fi
bash -x ${topdir}/abe.sh ${gerrit} --disable update ${platform} gcc=gcc.git@${revisions[$i]} --build all --disable make_docs ${check}
if test $? -gt 0; then
echo "ERROR: Abe failed!"
exit 1
fi
# Compress .sum and .log files
sums="`find ${local_builds}/${build}/${targetname}/ -name \*.sum`"
logs="`find ${local_builds}/${build}/${targetname}/ -name \*.log | egrep -v 'config.log|check-.*.log|install.log'`"
xz ${sums} ${logs}
# FIXME: The way this is currently implemented only handles GCC backports. If binutils
# backports are desired, this will have to be implented here.
sums="`find ${local_builds}/${build}/${targetname}/binutils-* -name \*.sum.xz`"
sums="${sums} `find ${local_builds}/${build}/${targetname}/gcc.git@${revisions[$i]}-stage2 -name \*.sum.xz`"
# Copy only the log files we want
logs="`find ${local_builds}/${build}/${targetname}/binutils-* -name \*.log.xz | egrep -v 'config.log|check-.*.log|install.log'`"
logs="${logs} `find ${local_builds}/${build}/${targetname}/gcc.git@${revisions[$i]}-stage2 -name \*.log.xz | egrep -v 'config.log|check-.*.log|install.log'`"
manifest="`find ${local_builds}/${build}/${targetname} -name manifest.txt`"
# xz ${resultsdir}${revisions[$i]}/*.sum ${resultsdir}${revisions[$i]}/*.log
echo "Copying test results files to ${fileserver}:${dir}/ which will take some time..."
ssh ${fileserver} mkdir -p ${dir}
scp -C ${manifest} ${sums} ${logs} ${fileserver}:${dir}/
# rm -fr ${resultsdir}${revisions[$i]}
i="`expr $i + 1`"
done
ret=0
# Test results and logs have been copied to this fileserver, so the validation is
# done remotely.
if test x"${fileserver}" != x; then
# Diff the two directories
tmp="/tmp/${node}/abe$$"
ssh ${fileserver} mkdir -p ${tmp}
# report.sh does not support .sum.xz for the moment
#scp -r ${topdir}/scripts/report.sh ${fileserver}:${tmp}
# For comparison with the perl script:
scp ${topdir}/scripts/compare_tests ${fileserver}:${tmp}
scp ${topdir}/scripts/compare_dg_tests.pl ${fileserver}:${tmp}
scp ${topdir}/scripts/unstable-tests.txt ${fileserver}:${tmp}
toplevel="`dirname ${dir}`"
dir1="${toplevel}/${revisions[0]}"
dir2="${toplevel}/${revisions[1]}"
# for i in gcc g++ gfortran libstdc++ ld gas binutils libgomp libitm; do
# ssh ${fileserver} "${tmp}/report.sh ${toplevel} ${i}.sum > ${toplevel}/diff-${i}.txt"
# if test $? -gt 0; then
# ret=1
# fi
# ssh ${fileserver} cat ${toplevel}/diff-${i}.txt
# done
ssh ${fileserver} "${tmp}/compare_tests -target ${target} ${dir2} ${dir1} > ${toplevel}/diff.txt"
if test $? -ne 0; then
ret=1
fi
ssh ${fileserver} cat ${toplevel}/diff.txt
rm -fr ${tmp}
echo "### Compared REFERENCE:"
ssh ${fileserver} cat ${dir2}/manifest.txt
echo "### with NEW COMMIT:"
ssh ${fileserver} cat ${dir1}/manifest.txt
wwwpath="`echo ${toplevel} | sed -e 's:/work::' -e 's:/space::'`"
echo "Full build logs: http://abe.tcwglab.linaro.org${wwwpath}/"
fi
exit ${ret}
|