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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
- job:
name: tcwg-buildfarm-maxim
project-type: matrix
defaults: global
properties:
- authorization:
anonymous:
- job-read
- job-extended-read
linaro:
- job-build
- job-cancel
- build-discarder:
days-to-keep: 30
num-to-keep: 100
parameters:
- string:
name: override
default: ''
description: 'Versions of components to build; e.g. binutils=binutils-gdb.git/linaro_binutils-2_25-branch gcc=gcc.git~linaro/gcc-5-branch glibc=glibc.git~release/2.21/master'
- string:
name: host_x86_64_languages
default: 'default'
description: 'Languages to build for x86_64-hosted toolchains, e.g., "c,c++" or "all" or "default"'
- string:
name: host_aarchXX_languages
default: 'c,c++'
description: 'Languages to build for AArchXX-hosted toolchains, e.g., "c,c++" or "all" or "default"'
- string:
name: runtests
default: 'x86_64-host'
description: 'Run toolchain testsuites: "yes", "no", "x86_64-host"'
- bool:
name: try_bootstrap
default: 'true'
description: 'Attempt to bootstrap GCC for compatible host and target combinations'
- string:
name: host_x86_64_excludecheck
default: 'gdb'
description: 'Do not run "make check" on these components on x86_64'
- string:
name: host_aarchXX_excludecheck
default: 'gcc'
description: 'Do not run "make check" on these components on AArchXX'
- string:
name: extraconfig
default: ''
description: 'Extra configuration files, syntax tool=path'
- bool:
name: rebuild
default: true
description: 'Rebuild the toolchain even if results are already on logserver'
- string:
name: log_name
default: '${JOB_NAME}-${BUILD_NUMBER}/$(uname -m).$target'
description: 'Logname directory on logserver'
- bool:
name: dont_fail
default: false
description: 'Do not fail the build'
- string:
name: log_server
default: dev-01.tcwglab:/home/maxim.kuvyrkov/logs
description: 'Log_Server'
- string:
name: abe_branch
default: refs/remotes/origin/stable
description: 'ABE revision to test'
- string:
name: target_list
default: 'native'
description: 'List of targets to use: aarch64-linux-gnu armv8l-linux-gnueabihf arm-linux-gnueabi arm-linux-gnueabihf armeb-linux-gnueabihf aarch64-none-elf aarch64_be-none-elf native'
disabled: false
node: tcwg-x86_64-build
child-workspace: $target
concurrent: true
display-name: 'TCWG ZZZ BuildFarm Maxim'
scm:
- git:
url: https://git-us.linaro.org/toolchain/abe.git
refspec: +refs/changes/*:refs/remotes/changes/*
branches:
- $abe_branch
skip-tag: true
shallow-clone: true
wipe-workspace: true
axes:
- axis:
type: slave
name: label
values:
- tcwg-x86_64-build
- tcwg-x86_32-build
- tcwg-apm-build
- tcwg-apm_32-build
- tcwg-tx1-build
- tcwg-tx1_32-build
- tcwg-tk1_32-build
- axis:
type: dynamic
name: target
values:
- target_list
execution-strategy:
sequential: false
wrappers:
- timeout:
timeout: 600
- timestamps
- ssh-agent-credentials:
# tcwg-buildslave user id
users:
- 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
- build-name:
name: '#${BUILD_NUMBER}'
builders:
- shell: |
#!/bin/bash
set -ex
mkdir -p artifacts/
case "$target:$label" in
native--aarch64) target_kind=native_aarch64 ;;
native--arm*) target_kind=native_aarch32 ;;
native--x86_64|native--i686) target_kind=native_x86 ;;
armeb-linux-gnueabihf--*|*-none-elf--*) target_kind=cross_aux ;;
*-linux-gnu*--*) target_kind=cross_main ;;
*) echo "ERROR: Cannot handle target: $target"; exit 1 ;;
esac
case "$label" in
tcwg-x86_64-build) container_arch="amd64" ;;
tcwg-x86_32-build) container_arch="i386" ;;
tcwg-apm-build) container_arch="arm64" ;;
tcwg-apm_32-build) container_arch="armhf" ;;
tcwg-tx1-build) container_arch="arm64" ;;
tcwg-tx1_32-build) container_arch="armhf" ;;
tcwg-tk1_32-build) container_arch="armhf" ;;
docker-*) container_arch="" ;;
*) echo "Wrong label: $label"; exit 1 ;;
esac
case "$label" in
tcwg-tk1_32-build) container="schroot" ;;
tcwg-*-build) container="docker" ;;
docker-*) container="none" ;;
esac
case "$container" in
"none")
if [ x"$DOCKER_HOST" = x"" ]; then
session_host="$(hostname).tcwglab"
session_port="22"
else
session_host="$(echo $DOCKER_HOST | sed -e "s#^tcp://\(.*\):.*#\1#")"
session_port="$(ssh $session_host docker port $DOCKER_CONTAINER_ID 22)"
session_port="$(echo $session_port | cut -d: -f 2)"
fi
;;
"schroot")
session_host="$(hostname).tcwglab"
session_port="22"
schroot_image="tcwg-build-${container_arch}-trusty"
session_id=$(schroot -b -c chroot:$schroot_image --preserve-environment)
;;
"docker")
session_host="$(hostname).tcwglab"
session_name=$(echo $BUILD_NUMBER-$JOB_NAME | sed -e "s#[/=,]#-#g")
session_id=$(ssh $session_host docker run --name $session_name -dtP -v $HOME/snapshots-ref:$HOME/snapshots-ref:ro -v $WORKSPACE:$WORKSPACE --memory=7500M --pids-limit=5000 linaro/trusty-$container_arch-tcwg)
session_port=$(ssh $session_host docker port $session_id 22 | cut -d: -f 2)
;;
esac
case "$target:$runtests" in
armeb-*:*) ;;
*-linux-gnu*:x86_64-host|*-linux-gnu*:yes)
case "$target" in
aarch64*) test_container_arch=arm64 ;;
arm*) test_container_arch=armhf ;;
*) echo "ERROR: Wrong target $target"; exit 1 ;;
esac
cat > test-container.param << EOF
container_name=docker-trusty-$test_container_arch-tcwg-test
upstream_dest=$session_host:$session_port:$WORKSPACE/test-container.data
watchdog=upstream
EOF
;;
esac
if echo "$override" | grep -q -e "--extraconfigdir ../config/gcc5" \
|| true \
&& [ x"$target" = x"aarch64-linux-gnu" ]; then
# Sanitizers in GCC-5 and GCC-6 toolchains for aarch64-linux-gnu
# don't support 48-bit VA. Therefore don't run them on Xenial tester.
rm -f test-container.param
fi
cat > ./env << EOF
session_host=$session_host
session_port=$session_port
session_id=$session_id
EOF
- conditional-step:
condition-kind: file-exists
condition-filename: test-container.param
steps:
- trigger-builds:
- project: tcwg-test-container-matrix
property-file: test-container.param
block: false
- conditional-step:
condition-kind: not
condition-operand:
condition-kind: file-exists
condition-filename: artifacts/target-skipped.txt
steps:
- shell: |
#!/bin/bash
set -ex
. ./env
case "$container" in
"none")
ulimit -u 5000
BUILD_SHELL="bash"
;;
"schroot")
ulimit -u 5000
# Remove schroot session on exit
trap "schroot -f -e -c session:$session_id" 0
BUILD_SHELL="schroot -r -c session:$session_id --preserve-environment -- bash"
;;
"docker")
trap "docker -H $session_host:2375 rm -fv $session_id" 0
BUILD_SHELL="ssh -p $session_port -A $session_host bash"
;;
esac
if [ -f test-container.param ]; then
runtests_opt="--runtests --testcontainerfile $WORKSPACE/test-container.data"
else
case "$runtests-$(uname -m)" in
"yes"-*|"x86_64-host"-"x86_64"|"x86_64-host"-"i686")
runtests_opt="--runtests"
;;
*)
runtests_opt=""
;;
esac
fi
case $(uname -m) in
x86_64|i686) languages="$host_x86_64_languages" ;;
*) languages="$host_aarchXX_languages" ;;
esac
if $try_bootstrap; then
bootstrap="--bootstrap"
else
bootstrap=""
fi
if [ x"$log_name" != x"" ]; then
eval "logname_opt=\"--logname $log_name\""
fi
if $rebuild; then
norebuild=""
else
norebuild="--norebuild"
fi
case $(uname -m) in
x86_64|i686) excludecheck="$host_x86_64_excludecheck" ;;
*) excludecheck="$host_aarchXX_excludecheck" ;;
esac
excludecheck_opt=""
for testsuite in $excludecheck; do
excludecheck_opt="$excludecheck_opt --excludecheck $testsuite"
done
# If there were extraconfig options, extract the
# corresponding repo
if test -n "$extraconfig" ; then
git clone http://git.linaro.org/toolchain/abe-extraconfigs.git
fi
extraconfig_opt=""
for config in $extraconfig; do
case ${extraconfig} in
*=*)
tool=${extraconfig%=*}
value=${extraconfig#*=}
;;
*)
echo ERROR: wrong extraconfig: $extraconfig
exit 1
;;
esac
extraconfig_opt="${extraconfig_opt} --extraconfig $tool=$PWD/abe-extraconfigs/$value"
done
$BUILD_SHELL -c "echo \"Build session is up; ulimit config:\"; ulimit -a"
cat > $WORKSPACE/run.sh << EOF
#!/bin/bash
cd $WORKSPACE
exec /bin/bash -x ./jenkins.sh --target ${target} --override "$override" --languages ${languages} $bootstrap $runtests_opt $excludecheck_opt ${extraconfig_opt} --logserver $log_server $logname_opt $norebuild
EOF
chmod +x $WORKSPACE/run.sh
result="0"
$BUILD_SHELL -x $WORKSPACE/run.sh || result=$?
#if [ x"$container" = x"docker" ]; then
# rsync -az -e "ssh -p $session_port" $WORKSPACE/ localhost:$WORKSPACE/
#fi
# If we actually built a toolchain, save its manifest.
# If the build was a no-op (results already present on log_server),
# copy the existing ones.
if [ -d _build/builds ]; then
manifest="`find _build/builds/ -name destdir -prune -o -name \*manifest.txt -print`"
else
manifest=""
fi
if [ x"${manifest}" != x ]; then
cp ${manifest} artifacts/
else
# We need to do the same name expansion as jenkins.sh
eval dir="$log_name"
scp "$log_server/$dir/*manifest.txt" artifacts/
fi
# Save logs and their directory structure
rsync -a --exclude="/logs/" --include="*/" --include="*.log" --include="*.err" --include="*.out" --include="*.txt" --exclude="*" --prune-empty-dirs ./ ./logs/
if ! tar -I pxz -cf ./artifacts/logs.tar.xz ./logs/ >/dev/null 2>&1; then
# PXZ can [rarely] fail due to high RAM usage, so fallback to normal XZ.
rm -f ./artifacts/logs.tar.xz
tar -cJf ./artifacts/logs.tar.xz ./logs/
fi
echo "Result of jenkins.sh: $result"
if $dont_fail; then
result="0"
fi
exit $result
publishers:
- archive:
artifacts: 'artifacts/*'
latest-only: false
|