blob: 50e2265bacfdb8a7de9976f39ffb23787593baf3 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Yann Gautier47193692024-04-19 14:57:26 +02003# Copyright (c) 2019-2024, Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# This file is meant to be SOURCED only after setting $ci_root. $ci_root must be
9# the absolute path to the root of the CI repository
10#
11# A convenient way to set ci_root from the calling script like this:
12# ci_root="$(readlink -f "$(dirname "$0")/..")"
13#
14
15# Accept root of CI location from $CI_ROOT or $ci_root, in that order
16ci_root="${ci_root:-$CI_ROOT}"
17ci_root="${ci_root:?}"
18
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020019# Optionally source a file containing environmental settings.
20if [ -n "$host_env" ]; then
21 source "$host_env"
22else
23 # Are we running on Arm infrastructure?
Saheer Babubdb0d652025-02-10 14:08:20 +000024 if echo "$JENKINS_PUBLIC_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020025 source "$ci_root/arm-env.sh"
Saheer Babu734e6d62025-02-10 10:32:19 +000026 elif echo "$JENKINS_PUBLIC_URL" | grep -q "jenkins.openci"; then
Chris Kay1fd850f2025-03-11 13:15:19 +000027 source "$ci_root/openci-lts-v2.8-env.sh"
Saheer Babubdb0d652025-02-10 14:08:20 +000028 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.trustedfirmware.org"; then
Chris Kay1fd850f2025-03-11 13:15:19 +000029 source "$ci_root/openci-lts-v2.8-env.sh"
Saheer Babubdb0d652025-02-10 14:08:20 +000030 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.staging.trustedfirmware.org"; then
Chris Kayfa20ea92022-12-19 16:56:51 +000031 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020032 fi
33fi
34
Fathi Boudra422bf772019-12-02 11:10:16 +020035# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
36nfs_volume="${nfs_volume:-$NFS_VOLUME}"
37nfs_volume="${nfs_volume:?}"
38
39# Override workspace for local runs
40workspace="${workspace:-$WORKSPACE}"
41workspace="${workspace:?}"
42workspace="$(readlink -f "$workspace")"
43artefacts="$workspace/artefacts"
44
45# pushd and popd outputs the directory stack every time, which could be
46# confusing when shown on the log. Suppress its output.
47pushd() {
48 builtin pushd "$1" &>/dev/null
49}
50popd() {
51 builtin popd &>/dev/null
52}
53
54# Copy a file to the $archive directory
55archive_file() {
56 local f out target md5
57 f="${1:?}"
58
59 out="${archive:?}"
60 [ ! -d "$out" ] && die "$out is not a directory"
61
62 target="$out/$(basename $f)"
63 if [ -f "$target" ]; then
64 # Prevent same file error
65 if [ "$(stat --format=%i "$target")" = \
66 "$(stat --format=%i "$f")" ]; then
67 return
68 fi
69 fi
70
71 md5="$(md5sum "$f" | awk '{print $1}')"
72 cp -t "$out" "$f"
73 echo "Archived: $f (md5: $md5)"
74}
75
76die() {
77 [ "$1" ] && echo "$1" >&2
78 exit 1
79}
80
81# Emit environment variables for the purpose of sourcing from shells and as
82# Jenkins property files. Whether the RHS is quoted depends on "$quote".
83emit_env() {
84 local env_file="${env_file:?}"
85 local var="${1:?}"
86
87 # Value parameter is mandatory, but allow for it to be empty
88 local val="${2?}"
89
90 if upon "$quote"; then
91 val="\"$val\""
92 else
93 # If RHS is not required to be quoted, any white space in it
94 # won't go well with a shell sourcing this file.
95 if echo "$var" | grep -q '\s'; then
96 die "$var: value '$val' has white space"
97 fi
98 fi
99
100 echo "$var=$val" >> "$env_file"
101}
102
Fathi Boudra422bf772019-12-02 11:10:16 +0200103fetch_directory() {
104 local base="$(basename "${url:?}")"
105 local sa
106
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200107 case "${url}" in
108 http*://*)
109 # Have exactly one trailing /
110 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200111
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200112 # Figure out the number of components between hostname and the
113 # final one
114 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
115 sa="${saveas:-$base}"
116 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500117 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200118 --reject="index.html*" "$modified_url"
119 if [ "$sa" != "$base" ]; then
120 mv "$base" "$sa"
121 fi
122 ;;
123 file://*)
124 sa="${saveas:-.}"
125 echo "Fetch: ${url} -> $sa"
126 cp -r "${url#file://}" "$sa"
127 ;;
128 *)
129 sa="${saveas:-.}"
130 echo "Fetch: ${url} -> $sa"
131 cp -r "${url}" "$sa"
132 ;;
133 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200134}
135
136fetch_file() {
137 local url="${url:?}"
138 local sa
139 local saveas
140
141 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200142 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200143 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200144 echo "Fetch: $url -> $saveas"
145 # Use curl to support file protocol
Paul Sokolovskycd93b372023-02-06 11:30:00 +0700146 curl --fail --connect-timeout 5 --retry 5 -sLS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200147 else
148 sa="${saveas-.}"
149 echo "Fetch: $url -> $sa"
150 cp "$url" "$sa"
151 fi
152}
153
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100154fetch_and_archive() {
155 url=${url:?}
156 filename=${filename:-basename $url}
157
158 url="$url" saveas="$filename" fetch_file
159 archive_file "$filename"
160}
161
162filter_artefacts(){
163 local model_param_file="${model_param_file-$archive/model_params}"
164
165 # Bash doesn't have array values, we have to create references to the
166 # array of artefacts and the artefact filters.
167 declare -ga "$1"
168 declare -n artefacts="$1"
169 declare -n filters="$2"
170
171 for artefact in "${!filters[@]}"; do
172 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
173 artefacts+=("${artefact}")
174 fi
175 done
176}
177
178gen_lava_job_def() {
179 local yaml_template_file="${yaml_template_file:?}"
180 local yaml_file="${yaml_file:?}"
181 local yaml_job_file="${yaml_job_file}"
182
183 # Bash doesn't have array values, we have to create references to the
184 # array of artefacts and their urls.
185 declare -n artefacts="$1"
186 declare -n artefact_urls="$2"
187
188 readarray -t boot_arguments < "${lava_model_params}"
189
190 # Generate the LAVA job definition, minus the test expectations
191 expand_template "${yaml_template_file}" > "${yaml_file}"
192
193 if [[ ! $model =~ "qemu" ]]; then
194 # Append expect commands into the job definition through
195 # test-interactive commands
196 gen_fvp_yaml_expect >> "$yaml_file"
197 fi
198
199 # create job.yaml
200 cp "$yaml_file" "$yaml_job_file"
201
202 # archive both yamls
203 archive_file "$yaml_file"
204 archive_file "$yaml_job_file"
205}
206
207gen_lava_model_params() {
208 local lava_model_params="${lava_model_params:?}"
209 declare -n macros="$1"
210
211 # Derive LAVA model parameters from the non-LAVA ones
212 cp "${archive}/model_params" "${lava_model_params}"
213
214 if [[ $model =~ "qemu" ]]; then
215 # Strip the model parameters of parameters already specified in the deploy
216 # overlay and job context.
217 sed -i '/-M/d;/kernel/d;/initrd/d;/bios/d;/cpu/d;/^[[:space:]]*$/d' \
218 $lava_model_params
219 elif [[ ! $model =~ "qemu" ]]; then
220 # FIXME find a way to properly match FVP configurations.
221 # Ensure braces in the FVP model parameters are not accidentally
222 # interpreted as LAVA macros.
223 sed -i -e 's/{/{{/g' "${lava_model_params}"
224 sed -i -e 's/}/}}/g' "${lava_model_params}"
225 else
226 echo "Unsupported emulated platform $model."
227 fi
228
229 # LAVA expects binary paths as macros, i.e. `{X}` instead of `x.bin`, so
230 # replace the file paths in our pre-generated model parameters.
231 for regex in "${!macros[@]}"; do
232 sed -i -e "s!${regex}!${macros[${regex}]}!" "${lava_model_params}"
233 done
234}
235
236gen_yaml_template() {
237 local target="${target-fvp}"
238 local yaml_template_file="${yaml_template_file-$workspace/${target}_template.yaml}"
239
240 local payload_type="${payload_type:?}"
241
242 cp "${ci_root}/script/lava-templates/${target}-${payload_type:?}.yaml" \
243 "${yaml_template_file}"
244
245 archive_file "$yaml_template_file"
246}
247
248# Generate link to an archived binary.
249gen_bin_url() {
250 local bin_mode="${bin_mode:?}"
251 local bin="${1:?}"
252
253 if upon "$jenkins_run"; then
254 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
255 else
256 echo "file://$workspace/artefacts/$bin_mode/$bin"
257 fi
258}
259
260get_kernel() {
261 local kernel_type="${kernel_type:?}"
262 local url="${plat_kernel_list[$kernel_type]}"
263
264 url="${url:?}" filename="kernel.bin" fetch_and_archive
265}
266
Chris Kaya75c0a62022-11-17 18:53:50 +0000267# Get the path to the run environment variables file.
268#
269# Run environment variables are the test-specific environment variables
270# configured by the CI's test configuration.
271#
272# Usage: get_run_env_path <archive>
273get_run_env_path() {
274 echo "${1:?}/run/env"
275}
276
277# Get a run environment variable.
278#
279# Run environment variables are the test-specific environment variables
280# configured by the CI's test configuration.
281#
282# Usage: get_run_env <archive> <variable> [default]
283get_run_env() {
284 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
285 . "$(get_run_env_path "${1:?}")"
286 fi
287
288 echo "${!2:-${3}}"
289}
290
291# Get the number of UARTs configured by the current test configuration. This
292# defaults to `4`.
293#
294# Usage: get_num_uarts <archive> [default]
295get_num_uarts() {
296 local default=4
297
298 get_run_env "${1:?}" num_uarts "${2-${default}}"
299}
300
301# Get the ports script configured by the current test configuration. This
302# defaults to `script/default-ports-script.awk`.
303#
304# Usage: get_ports_script <archive> [default]
305get_ports_script() {
306 local default="${ci_root}/script/default-ports-script.awk"
307
308 get_run_env "${1:?}" ports_script "${2-${default}}"
309}
310
311# Get the primary UART configured by the current test configuration. This
312# defaults to `0`.
313#
314# Usage: get_primary_uart <archive> [default]
315get_primary_uart() {
316 local default=0
317
318 get_run_env "${1:?}" primary_uart "${2-${default}}"
319}
320
321# Get the payload UART configured by the current test configuration. This
322# defaults to the primary UART.
323#
324# Usage: get_payload_uart <archive> [default]
325get_payload_uart() {
326 local default="$(get_primary_uart "${1:?}")"
327
328 get_run_env "${1:?}" payload_uart "${2-${default}}"
329}
330
331# Get the path to a UART's environment variable directory.
332#
333# UART environment variables are the UART-specific environment variables
334# configured by the CI's test configuration.
335#
336# Usage: get_uart_env_path <archive> <uart>
337get_uart_env_path() {
338 echo "${1:?}/run/uart${2:?}"
339}
340
341# Get a UART environment variable.
342#
343# UART environment variables are the UART-specific environment variables
344# configured by the CI's test configuration.
345#
346# Usage: get_uart_env <archive> <uart> <variable> [default]
347get_uart_env() {
348 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
349 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
350 else
Chris Kay3a968862022-11-17 19:18:32 +0000351 echo "${!3-${4}}"
Chris Kaya75c0a62022-11-17 18:53:50 +0000352 fi
353}
354
355# Get the path to the Expect script for a given UART. This defaults to nothing.
356#
357# Usage: get_uart_expect_script <archive> <uart> [default]
358get_uart_expect_script() {
359 local default=
360
361 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
362}
363
364# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
365#
366# Usage: get_uart_port <archive> <uart> [default]
367get_uart_port() {
368 local default="$(( 5000 + "${2:?}" ))"
369
370 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
371}
372
Chris Kay49437462022-11-23 12:53:30 +0000373# Set a UART environment variable.
374#
375# UART environment variables are the UART-specific environment variables
376# configured by the CI's test configuration.
377#
378# Usage: set_uart_env <archive> <uart> <variable> <value>
379set_uart_env() {
380 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
381
382 mkdir -p "${path}" && \
383 echo "${4:?}" > "${path}/${3:?}"
384}
385
386# Set the FVP port for a given UART.
387#
388# Usage: set_uart_port <archive> <uart> <port>
389set_uart_port() {
390 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
391}
392
Fathi Boudra422bf772019-12-02 11:10:16 +0200393# Make a temporary directory/file insdie workspace, so that it doesn't need to
394# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
395mktempdir() {
396 local ws="${workspace:?}"
397
398 mktemp -d --tmpdir="$ws"
399}
400mktempfile() {
401 local ws="${workspace:?}"
402
403 mktemp --tmpdir="$ws"
404}
405
406not_upon() {
407 ! upon "$1"
408}
409
410# Use "$1" as a boolean
411upon() {
412 case "$1" in
413 "" | "0" | "false") return 1;;
414 *) return 0;;
415 esac
416}
417
418# Check if the argument is a URL
419is_url() {
420 echo "$1" | grep -q "://"
421}
422
423# Check if a path is absolute
424is_abs() {
425 [ "${1:0:1}" = "/" ]
426}
427
428# Unset a variable based on its boolean value
429# If foo=, foo will be unset
430# If foo=blah, then leave it as is
431reset_var() {
432 local var="$1"
433 local val="${!var}"
434
435 if [ -z "$val" ]; then
436 unset "$var"
437 else
438 var="$val"
439 fi
440}
441
442default_var() {
443 local var="$1"
444 local val="${!var}"
445 local default="$2"
446
447 if [ -z "$val" ]; then
448 eval "$var=$default"
449 fi
450}
451
452# String various items joined by ":" to form a path. Items are prepended by
453# default; or 'op' can be set to 'append' to have them appended.
454# For example, to set: PATH=foo:bar:baz:$PATH
455extend_path() {
456 local path_var="$1"
457 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500458 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200459 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500460 local sep=':'
461 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200462
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500463 eval "array_val=\"\${$array_var[@]}\""
464 array_val="$(echo ${array_val// /:})"
465
466 [ -z "$path_val" ] && sep=''
467
468 if [ "$op" = "prepend" ]; then
469 array_val="${array_val}${sep}${path_val}"
470 elif [ "$op" = "append" ]; then
471 array_val="${path_val}${sep}${array_val}"
472 fi
473
474 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200475}
476
Chris Kay3d807882022-08-31 16:00:02 +0100477# Expand and evaluate Bash variables and expressions in a file, whose path is
478# given by the first parameter.
479#
480# For example, to expand a file containing the following:
481#
482# My name is ${name}!
483#
484# You might use:
485#
486# name="Chris" expand_template "path-to-my-file.txt"
487#
488# This would yield:
489#
490# My name is Chris!
491#
492# If you need to run multiple expansions on a file (e.g. to fill out information
493# incrementally), then you can escape expansion of a variable with a backslash,
494# e.g. `\${name}`.
495#
496# The expanded output is printed to the standard output stream.
497expand_template() {
498 local path="$1"
499
500 eval "cat <<-EOF
501 $(<${path})
502 EOF"
503}
504
Harrison Mutai013f6332022-02-16 16:06:33 +0000505# Fetch and extract the latest supported version of the LLVM toolchain from
506# a compressed archive file to a target directory, if it is required.
507setup_llvm_toolchain() {
508 link="${1:-$llvm_archive}"
509 archive="${2:-"$workspace/llvm.tar.xz"}"
510 target_dir="${3:-$llvm_dir}"
511
512 if is_arm_jenkins_env || upon "$local_ci"; then
513 url="$link" saveas="$archive" fetch_file
514 mkdir -p $target_dir
515 extract_tarball $archive $target_dir --strip-components=1 -k
516 fi
517}
518
519# Extract files from compressed archive to target directory. Supports .zip,
520# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500521extract_tarball() {
522 local archive="$1"
523 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500524 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500525
526 pushd "$target_dir"
527 case $(file --mime-type -b "$archive") in
528 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500529 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500530 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500531 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500532 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500533 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000534 application/x-xz)
535 tar -x $extra_params -f $archive
536 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500537 esac
Zelalem219df412020-05-17 19:21:20 -0500538 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500539}
540
Gary Morrison999a9d72022-03-14 18:29:06 -0500541# See if execution is done by Jenkins. If called with a parameter,
542# representing a 'domain', e.g. arm.com, it will also check if
Saheer Babubdb0d652025-02-10 14:08:20 +0000543# JENKINS_PUBLIC_URL contains the latter.
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500544is_jenkins_env () {
545 local domain="${1-}"
546
547 # check if running under Jenkins, if not, return non-zero
548 # the checks assumes Jenkins executing if JENKINS_HOME is set
549 [ -z "$JENKINS_HOME" ] && return 1
550
551 # if no parameter passed, no more checks, quit
552 [ -z "$domain" ] && return 0
553
Saheer Babubdb0d652025-02-10 14:08:20 +0000554 if echo "$JENKINS_PUBLIC_URL" | grep -q "$domain"; then
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500555 return 0
556 fi
557
558 return 1
559}
560
561
562# Check if execution is under ARM's jenkins
563is_arm_jenkins_env() {
Saheer Babu48e5f132025-01-08 16:32:17 +0000564 local arm_domain="oss.arm.com"
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500565 return $(is_jenkins_env "$arm_domain")
566}
567
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600568
569# Provide correct linaro cross toolchain based on environment
570set_cross_compile_gcc_linaro_toolchain() {
571 local cross_compile_path="/home/buildslave/tools"
572
573 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600574 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600575
576 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
577}
578
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500579if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200580 jenkins_run=1
581 umask 0002
582else
583 unset jenkins_run
584fi
585
586# Project scratch location for Trusted Firmware CI
587project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
588project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
589warehouse="${nfs_volume}/warehouse"
Saheer Babubdb0d652025-02-10 14:08:20 +0000590jenkins_url="${JENKINS_PUBLIC_URL%/*}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200591jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
592
593# Model revisions
Govindraj Raja74e5b452024-06-18 13:34:17 -0500594model_version_11_24="${model_version:-11.24}"
595model_build_11_24="${model_build:-24}"
596
Govindraj Rajae2415462024-06-04 14:50:28 -0500597model_version="${model_version:-11.26}"
598model_build="${model_build:-11}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100599model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200600
601# Model snapshots from filer are not normally not accessible from developer
602# systems. Ignore failures from picking real path for local runs.
603pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
604pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
605
Fathi Boudra422bf772019-12-02 11:10:16 +0200606tforg_gerrit_url="review.trustedfirmware.org"
607
608# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
609# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200610tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
611tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200612tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
613tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500614ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
615ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500616tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200617scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100618scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100619spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
620spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200621
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500622tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200623tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
624css_downloads="${css_downloads:-$tfa_downloads/css}"
625
Jayanth Dodderi Chidanandbf7369d2022-04-06 10:59:14 +0100626# SCP/MCP v2.10.0 release binaries.
Manish V Badarkhe83e4b8d2022-10-26 12:02:41 +0100627scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000628
Leonardo Sandoval15676062020-11-19 11:58:09 -0600629linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100630linaro_release="${linaro_release:-$linaro_2001_release}"
Ryan Everetta6bbfb72024-11-26 11:43:36 +0000631mbedtls_version="${mbedtls_version:-3.6.2}"
Zelalem219df412020-05-17 19:21:20 -0500632
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500633# mbedTLS archive public hosting available at github.com
Sandrine Bailleuxdf823892022-04-22 13:27:45 +0200634mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200635
Harrison Mutai013f6332022-02-16 16:06:33 +0000636# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
637# LLVM archive public hosting available at github.com
638llvm_version="${llvm_version:-14.0.0}"
639llvm_dir="$workspace/llvm-$llvm_version"
640llvm_archive="${llvm_archive:-https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvm_version/clang+llvm-$llvm_version-x86_64-linux-gnu-ubuntu-18.04.tar.xz}"
641
Mark Dykes30138ad2021-11-09 16:48:17 -0600642coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200643coverity_default_checkers=(
644"--all"
645"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200646"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500647"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200648"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200649"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500650"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200651)
652
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500653docker_registry="${docker_registry:-}"
654
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500655# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100656toolchain_version="11.3.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500657
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100658aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500659aarch64_none_elf_prefix="aarch64-none-elf-"
660
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100661arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500662arm_none_eabi_prefix="arm-none-eabi-"
663
Fathi Boudra422bf772019-12-02 11:10:16 +0200664path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500665 "${aarch64_none_elf_dir}/bin"
666 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000667 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500668 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
669 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200670)
671
672ld_library_path_list=(
673)
674
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200675license_path_list=${license_path_list-(
676)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200677
678# Setup various paths
679if upon "$retain_paths"; then
680 # If explicitly requested, retain local paths; apppend CI paths to the
681 # existing ones.
682 op="append" extend_path "PATH" "path_list"
683 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
684 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
685else
686 # Otherwise, prepend CI paths so that they take effect before local ones
687 extend_path "PATH" "path_list"
688 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
689 extend_path "LM_LICENSE_FILE" "license_path_list"
690fi
691
692export LD_LIBRARY_PATH
693export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200694export ARM_TOOL_VARIANT=ult
695
696# vim: set tw=80 sw=8 noet: