forked from foss-for-synopsys-dwc-arc-processors/toolchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.sh
executable file
·436 lines (338 loc) · 9.84 KB
/
run-tests.sh
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
#!/bin/sh
# Copyright (C) 2012-2016 Synopsys Inc.
# Contributor Jeremy Bennett <[email protected]>
# Contributor Anton Kolesov <[email protected]>
# This file is a master script for building ARC tool chains.
# 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, see <http://www.gnu.org/licenses/>.
# SCRIPT TO RUN ARC-ELF32 and ARC-LINUX-UCLIBC REGRESSION TESTS
# =============================================================
# This script runs the ARC regression tests for the arc-elf32- and/or
# arc-uclibc-linux- tool chains. It is designed to work with the source tree
# as organized in GitHub. The arguments have the followign meaning.
# Invocation Syntax
# run-tests.sh [--source-dir <source_dir>] [--target <address>]
# [--jobs <count>] [--load <load>][--single-thread]
# [--elf32 | --no-elf32] [--uclibc | --no-uclibc]
# [--big-endian | --little-endian]
# [--multilib-options <options>]
# --source-dir <source_dir>
# The location of the ARC GNU tools source tree. If not specified, the
# script will use the value of the ARC_GNU environment variable if
# available.
# If this argument is not specified, and the ARC_GNU environment variable
# is also not set, the script will use the parent of the directory where
# this script is installed.
# --elf32-target-board <board>
# The board description for the ELF32 target. This should either be a
# standard DejaGnu board, or a board in the dejagnu/baseboards directory
# of the toolchain repository. Default value arc-sim
# --uclibc-target-board <board>
# The board description for the UCLIBC target. This should either be a
# standard DejaGnu board, or a board in the dejagnu/baseboards directory
# of the toolchain repository. Default value arc-linux-aa4
# --elf32-target-addr <address>
# The address of the ELF32 target, either symbolic, or as an IP
# address. By default no value is set.
# --uclibc-target-addr <address>
# The address of the UCLIBC target, either symbolic, or as an IP
# address. The default is aa4-32.
# --elf32-nsim-props <path/to/nsim/props/file>
# Path to file with nSIM properties. Examples can be found in
# $NSIM_HOME/systemc/configs. The default value is
# $NSIM_HOME/systemc/configs/nsim_a700.props. Make sure that props files
# matches multilib and endian options. This option makes sense only when
# target board is arc-nsim.
# --elf32-nsim-tcf <path/to/nsim/tcf/file>
# Kind of like the --elf32-nsim-props, but specifies tcf file instead. If
# this option is set, then --elf32-nsim-props will be ignored.
# --elf32-hostlink-library <path/to/hostlink/library>
# Path to hostlink library archive. Required for test runs with Metaware.
# --jobs <count>
# Specify that parallel make should run at most <count> jobs. The default
# is <count> equal to one more than the number of processor cores shown by
# /proc/cpuinfo.
# --load <load>
# Specify that parallel make should not start a new job if the load
# average exceed <load>. The default is <load> equal to one more than the
# number of processor cores shown by /proc/cpuinfo.
# --single-thread
# Equivalent to --jobs 1 --load 1000. Only run one job at a time, but run
# whatever the load average.
# --elf32 | --no-elf32
# If specified, run the arc-elf32- tests (default is --elf32).
# --uclibc | --no-uclibc
# If specified, run the arc-uclibc-linux- tests (default is --uclibc).
# --big-endian | --little-endian
# If --big-endian is specified, test the big-endian version of the tool
# chains (i.e. arceb-elf32- and arceb-linux-uclibc-), otherwise test the
# little endin versions.
# --multilib-options <options>
# Additional options for compiling to allow multilib variants to be
# tested.
# --binutils | --no-binutils
# --gas | --no-gas
# --ld | --no-ld
# --gcc | --no-gcc
# --libgcc | --no-libgcc
# --libgloss | --no-libgloss
# --newlib | --no-newlib
# --libstdc++ | --no-libstdc++
# --sim | --no-sim
# --gdb | --no-gdb
# Specify which tests are to be run. By default all are enabled except
# libgcc, libgloss and sim, for which no tests currently exist.
# This script exits with zero if every test has passed and with non-zero value
# otherwise.
# ------------------------------------------------------------------------------
# Set default values for some options
ARC_TEST_BOARD_ELF32=arc-sim
ARC_TEST_BOARD_UCLIBC=arc-linux-aa4
ARC_TEST_ADDR_ELF32=
ARC_TEST_ADDR_UCLIBC=aa4_32
ARC_MULTILIB_OPTIONS=""
ARC_NSIM_PROPS="${NSIM_HOME}/systemc/configs/nsim_a700.props"
ARC_NSIM_TCF="${NSIM_HOME}/etc/tcf/templates/hs36.tcf"
ARC_HOSTLINK_LIBRARY=
make_load="`(echo processor; cat /proc/cpuinfo 2>/dev/null echo processor) \
| grep -c processor`"
jobs=${make_load}
load=${make_load}
elf32="--elf32"
uclibc="--uclibc"
DO_BINUTILS="yes"
DO_GAS="yes"
DO_LD="yes"
DO_GCC="yes"
DO_LIBGCC="no"
DO_LIBGLOSS="no"
DO_NEWLIB="yes"
DO_LIBSTDCPP="yes"
DO_SIM="no"
DO_GDB="yes"
# Parse options
until
opt=$1
case ${opt} in
--source-dir)
shift
ARC_GNU=`(cd "$1" && pwd)`
;;
--elf32-target-board)
shift
ARC_TEST_BOARD_ELF32=$1
;;
--uclibc-target-board)
shift
ARC_TEST_BOARD_UCLIBC=$1
;;
--elf32-target-addr)
shift
ARC_TEST_ADDR_ELF32=$1
;;
--uclibc-target-addr)
shift
ARC_TEST_ADDR_UCLIBC=$1
;;
--elf32-nsim-props)
shift
ARC_NSIM_PROPS=$1
;;
--elf32-nsim-tcf)
shift
ARC_NSIM_TCF=$1
;;
--elf32-hostlink-library)
shift
ARC_HOSTLINK_LIBRARY=$1
;;
--jobs)
shift
jobs=$1
;;
--load)
shift
load=$1
;;
--single-thread)
jobs=1
load=1000
;;
--elf32 | --no-elf32)
elf32=$1
;;
--uclibc | --no-uclibc)
uclibc=$1
;;
--big-endian)
ARC_ENDIAN=big
;;
--little-endian)
ARC_ENDIAN=little
;;
--multilib-options)
shift
ARC_MULTILIB_OPTIONS="$1"
;;
--binutils)
DO_BINUTILS="yes"
;;
--no-binutils)
DO_BINUTILS="no"
;;
--gas)
DO_GAS="yes"
;;
--no-gas)
DO_GAS="no"
;;
--ld)
DO_LD="yes"
;;
--no-ld)
DO_LD="no"
;;
--gcc)
DO_GCC="yes"
;;
--no-gcc)
DO_GCC="no"
;;
--libgcc)
DO_LIBGCC="yes"
;;
--no-libgcc)
DO_LIBGCC="no"
;;
--libgloss)
DO_LIBGLOSS="yes"
;;
--no-libgloss)
DO_LIBGLOSS="no"
;;
--newlib)
DO_LIBGLOSS="yes"
;;
--no-newlib)
DO_NEWLIB="no"
;;
--libstdc++)
DO_LIBSTDCPP="yes"
;;
--no-libstdc++)
DO_LIBSTDCPP="no"
;;
--sim)
DO_SIM="yes"
;;
--no-sim)
DO_SIM="no"
;;
--gdb)
DO_GDB="yes"
;;
--no-gdb)
DO_GDB="no"
;;
?*)
echo "Unknown option \`$opt' specified."
echo "Usage: ./run-tests.sh [--source-dir <source_dir>]"
echo " [--elf32-target-board <board>]"
echo " [--uclibc-target-board <board>]"
echo " [--elf32-target-addr <address>]"
echo " [--uclibc-target-addr <address>]"
echo " [--elf32-nsim-props <path>]"
echo " [--elf32-nsim-tcf <path>]"
echo " [--elf32-hostlink-library <path>]"
echo " [--elf32 | --no-elf32]"
echo " [--uclibc | --no-uclibc]"
echo " [--big-endian | --little-endian]"
echo " [--multilib-options <options>]"
echo " [--binutils | --no-binutils]"
echo " [--gas | --no-gas]"
echo " [--ld | --no-ld]"
echo " [--gcc | --no-gcc]"
echo " [--libgcc | --no-libgcc]"
echo " [--libgloss | --no-libgloss]"
echo " [--newlib | --no-newlib]"
echo " [--libstdc++ | --no-libstdc++]"
echo " [--sim | --no-sim]"
echo " [--gdb | --no-gdb]"
exit 1
;;
*)
;;
esac
[ "x${opt}" = "x" ]
do
shift
done
# Default source directory if not already set.
if [ "x${ARC_GNU}" = "x" ]
then
d=`dirname "$0"`
ARC_GNU=`(cd "$d/.." && pwd)`
fi
# Little endian is default
if [ "x${ARC_ENDIAN}" = "x" ]
then
ARC_ENDIAN=little
fi
# Parallelism
PARALLEL="-j ${jobs} -l ${load}"
# Export everything needed by sub-scripts
export ARC_TEST_BOARD_ELF32
export ARC_TEST_BOARD_UCLIBC
export ARC_TEST_ADDR_ELF32
export ARC_TEST_ADDR_UCLIBC
export ARC_MULTILIB_OPTIONS
export ARC_NSIM_PROPS
export ARC_GNU
export ARC_ENDIAN
export PARALLEL
export DO_BINUTILS
export DO_GAS
export DO_LD
export DO_GCC
export DO_LIBGCC
export DO_LIBGLOSS
export DO_NEWLIB
export DO_LIBSTDCPP
export DO_SIM
export DO_GDB
if [ "x$ARC_NSIM_TCF" != x ]
then
export ARC_NSIM_TCF
fi
if [ "x${ARC_HOSTLINK_LIBRARY}" != x ]
then
export ARC_HOSTLINK_LIBRARY
fi
status=0
# Run the ELF32 tests
if [ "${elf32}" = "--elf32" ]
then
if ! "${ARC_GNU}"/toolchain/run-elf32-tests.sh
then
echo "ERROR: arc-elf32- some tests failed."
status=1
fi
fi
# Run the UCLIBC tests
if [ "${uclibc}" = "--uclibc" ]
then
if ! "${ARC_GNU}"/toolchain/run-uclibc-tests.sh
then
echo "ERROR: arc-linux-uclibc- some tests failed."
status=1
fi
fi
exit ${status}