blob: 2e0f72e021eff7c43ea3eefae37b8a19dbbf8126 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
laurenw-arm92881b92024-03-28 12:57:42 -05003# 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
Chris Kay197b1022023-08-16 21:31:41 +010015set -ETe -o pipefail
16
Fathi Boudra422bf772019-12-02 11:10:16 +020017# Accept root of CI location from $CI_ROOT or $ci_root, in that order
18ci_root="${ci_root:-$CI_ROOT}"
19ci_root="${ci_root:?}"
20
Chris Kay197b1022023-08-16 21:31:41 +010021source "${ci_root}/backtrace.sh" && trap backtrace ERR
Harrison Mutai9b099892023-01-13 11:34:36 +000022source "${ci_root}/lava_utils.sh"
23
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020024# Optionally source a file containing environmental settings.
25if [ -n "$host_env" ]; then
26 source "$host_env"
27else
28 # Are we running on Arm infrastructure?
Arthur Shea813bdf2025-02-03 21:39:57 -080029 if echo "$JENKINS_PUBLIC_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020030 source "$ci_root/arm-env.sh"
Arthur Shea813bdf2025-02-03 21:39:57 -080031 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.trustedfirmware.org"; then
Arthur She2c9ca722025-01-19 21:30:39 -080032 source "$ci_root/openci-env.sh"
Arthur Shea813bdf2025-02-03 21:39:57 -080033 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.staging.trustedfirmware.org"; then
Chris Kay73a91b02022-12-19 16:56:51 +000034 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020035 fi
36fi
37
Fathi Boudra422bf772019-12-02 11:10:16 +020038# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
39nfs_volume="${nfs_volume:-$NFS_VOLUME}"
40nfs_volume="${nfs_volume:?}"
41
42# Override workspace for local runs
43workspace="${workspace:-$WORKSPACE}"
44workspace="${workspace:?}"
45workspace="$(readlink -f "$workspace")"
46artefacts="$workspace/artefacts"
47
48# pushd and popd outputs the directory stack every time, which could be
49# confusing when shown on the log. Suppress its output.
50pushd() {
51 builtin pushd "$1" &>/dev/null
52}
53popd() {
54 builtin popd &>/dev/null
55}
56
57# Copy a file to the $archive directory
58archive_file() {
59 local f out target md5
60 f="${1:?}"
61
62 out="${archive:?}"
63 [ ! -d "$out" ] && die "$out is not a directory"
64
65 target="$out/$(basename $f)"
66 if [ -f "$target" ]; then
67 # Prevent same file error
68 if [ "$(stat --format=%i "$target")" = \
69 "$(stat --format=%i "$f")" ]; then
70 return
71 fi
72 fi
73
74 md5="$(md5sum "$f" | awk '{print $1}')"
75 cp -t "$out" "$f"
76 echo "Archived: $f (md5: $md5)"
77}
78
79die() {
80 [ "$1" ] && echo "$1" >&2
81 exit 1
82}
83
84# Emit environment variables for the purpose of sourcing from shells and as
85# Jenkins property files. Whether the RHS is quoted depends on "$quote".
86emit_env() {
87 local env_file="${env_file:?}"
88 local var="${1:?}"
89
90 # Value parameter is mandatory, but allow for it to be empty
91 local val="${2?}"
92
93 if upon "$quote"; then
94 val="\"$val\""
95 else
96 # If RHS is not required to be quoted, any white space in it
97 # won't go well with a shell sourcing this file.
98 if echo "$var" | grep -q '\s'; then
99 die "$var: value '$val' has white space"
100 fi
101 fi
102
103 echo "$var=$val" >> "$env_file"
104}
105
Fathi Boudra422bf772019-12-02 11:10:16 +0200106fetch_directory() {
107 local base="$(basename "${url:?}")"
108 local sa
109
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200110 case "${url}" in
111 http*://*)
112 # Have exactly one trailing /
113 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200114
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200115 # Figure out the number of components between hostname and the
116 # final one
117 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
118 sa="${saveas:-$base}"
119 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500120 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200121 --reject="index.html*" "$modified_url"
122 if [ "$sa" != "$base" ]; then
123 mv "$base" "$sa"
124 fi
125 ;;
126 file://*)
127 sa="${saveas:-.}"
128 echo "Fetch: ${url} -> $sa"
129 cp -r "${url#file://}" "$sa"
130 ;;
131 *)
132 sa="${saveas:-.}"
133 echo "Fetch: ${url} -> $sa"
134 cp -r "${url}" "$sa"
135 ;;
136 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200137}
138
139fetch_file() {
140 local url="${url:?}"
141 local sa
142 local saveas
143
144 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200145 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200146 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200147 echo "Fetch: $url -> $saveas"
148 # Use curl to support file protocol
Paul Sokolovsky532a4882023-05-22 15:50:04 +0300149 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200150 else
151 sa="${saveas-.}"
152 echo "Fetch: $url -> $sa"
153 cp "$url" "$sa"
154 fi
155}
156
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100157fetch_and_archive() {
158 url=${url:?}
159 filename=${filename:-basename $url}
160
161 url="$url" saveas="$filename" fetch_file
162 archive_file "$filename"
163}
164
165filter_artefacts(){
166 local model_param_file="${model_param_file-$archive/model_params}"
167
168 # Bash doesn't have array values, we have to create references to the
169 # array of artefacts and the artefact filters.
170 declare -ga "$1"
171 declare -n artefacts="$1"
172 declare -n filters="$2"
173
174 for artefact in "${!filters[@]}"; do
175 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
176 artefacts+=("${artefact}")
177 fi
178 done
179}
180
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100181# Generate link to an archived binary.
182gen_bin_url() {
183 local bin_mode="${bin_mode:?}"
184 local bin="${1:?}"
185
186 if upon "$jenkins_run"; then
187 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
188 else
189 echo "file://$workspace/artefacts/$bin_mode/$bin"
190 fi
191}
192
Harrison Mutaid993ce12023-03-27 13:21:28 +0100193get_boot_image() {
194 local image=${image:?}
195 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100196
Harrison Mutaid993ce12023-03-27 13:21:28 +0100197 declare -n image_list=${image_list-${image}_list}
198
199 local url="${image_list[${type}]}"
200
201 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100202}
203
Harrison Mutaid993ce12023-03-27 13:21:28 +0100204get_boot_image_from_fip() {(
205 local url="${url:?}"
206 local image="${image:?}"
207 local output_name="${output_name-bl32.bin}"
208
209 cd "$(mktempdir)"
210
211 extract_fip "$url"
212 mv "$image" "$output_name"
213 archive_file "$output_name"
214)}
215
Chris Kay03ffbe72022-11-17 18:53:50 +0000216# Get the path to the run environment variables file.
217#
218# Run environment variables are the test-specific environment variables
219# configured by the CI's test configuration.
220#
221# Usage: get_run_env_path <archive>
222get_run_env_path() {
223 echo "${1:?}/run/env"
224}
225
226# Get a run environment variable.
227#
228# Run environment variables are the test-specific environment variables
229# configured by the CI's test configuration.
230#
231# Usage: get_run_env <archive> <variable> [default]
232get_run_env() {
233 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
234 . "$(get_run_env_path "${1:?}")"
235 fi
236
237 echo "${!2:-${3}}"
238}
239
240# Get the number of UARTs configured by the current test configuration. This
241# defaults to `4`.
242#
243# Usage: get_num_uarts <archive> [default]
244get_num_uarts() {
245 local default=4
246
247 get_run_env "${1:?}" num_uarts "${2-${default}}"
248}
249
250# Get the ports script configured by the current test configuration. This
251# defaults to `script/default-ports-script.awk`.
252#
253# Usage: get_ports_script <archive> [default]
254get_ports_script() {
255 local default="${ci_root}/script/default-ports-script.awk"
256
257 get_run_env "${1:?}" ports_script "${2-${default}}"
258}
259
260# Get the primary UART configured by the current test configuration. This
261# defaults to `0`.
262#
263# Usage: get_primary_uart <archive> [default]
264get_primary_uart() {
265 local default=0
266
267 get_run_env "${1:?}" primary_uart "${2-${default}}"
268}
269
270# Get the payload UART configured by the current test configuration. This
271# defaults to the primary UART.
272#
273# Usage: get_payload_uart <archive> [default]
274get_payload_uart() {
275 local default="$(get_primary_uart "${1:?}")"
276
277 get_run_env "${1:?}" payload_uart "${2-${default}}"
278}
279
280# Get the path to a UART's environment variable directory.
281#
282# UART environment variables are the UART-specific environment variables
283# configured by the CI's test configuration.
284#
285# Usage: get_uart_env_path <archive> <uart>
286get_uart_env_path() {
287 echo "${1:?}/run/uart${2:?}"
288}
289
290# Get a UART environment variable.
291#
292# UART environment variables are the UART-specific environment variables
293# configured by the CI's test configuration.
294#
295# Usage: get_uart_env <archive> <uart> <variable> [default]
296get_uart_env() {
297 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
298 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
299 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000300 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000301 fi
302}
303
304# Get the path to the Expect script for a given UART. This defaults to nothing.
305#
306# Usage: get_uart_expect_script <archive> <uart> [default]
307get_uart_expect_script() {
308 local default=
309
310 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
311}
312
313# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
314#
315# Usage: get_uart_port <archive> <uart> [default]
316get_uart_port() {
317 local default="$(( 5000 + "${2:?}" ))"
318
319 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
320}
321
Chris Kay24d039f2022-11-23 12:53:30 +0000322# Set a UART environment variable.
323#
324# UART environment variables are the UART-specific environment variables
325# configured by the CI's test configuration.
326#
327# Usage: set_uart_env <archive> <uart> <variable> <value>
328set_uart_env() {
329 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
330
331 mkdir -p "${path}" && \
332 echo "${4:?}" > "${path}/${3:?}"
333}
334
335# Set the FVP port for a given UART.
336#
337# Usage: set_uart_port <archive> <uart> <port>
338set_uart_port() {
339 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
340}
341
Fathi Boudra422bf772019-12-02 11:10:16 +0200342# Make a temporary directory/file insdie workspace, so that it doesn't need to
343# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
344mktempdir() {
345 local ws="${workspace:?}"
346
347 mktemp -d --tmpdir="$ws"
348}
349mktempfile() {
350 local ws="${workspace:?}"
351
352 mktemp --tmpdir="$ws"
353}
354
355not_upon() {
356 ! upon "$1"
357}
358
359# Use "$1" as a boolean
360upon() {
361 case "$1" in
362 "" | "0" | "false") return 1;;
363 *) return 0;;
364 esac
365}
366
367# Check if the argument is a URL
368is_url() {
369 echo "$1" | grep -q "://"
370}
371
372# Check if a path is absolute
373is_abs() {
374 [ "${1:0:1}" = "/" ]
375}
376
377# Unset a variable based on its boolean value
378# If foo=, foo will be unset
379# If foo=blah, then leave it as is
380reset_var() {
381 local var="$1"
382 local val="${!var}"
383
384 if [ -z "$val" ]; then
385 unset "$var"
386 else
387 var="$val"
388 fi
389}
390
391default_var() {
392 local var="$1"
393 local val="${!var}"
394 local default="$2"
395
396 if [ -z "$val" ]; then
397 eval "$var=$default"
398 fi
399}
400
401# String various items joined by ":" to form a path. Items are prepended by
402# default; or 'op' can be set to 'append' to have them appended.
403# For example, to set: PATH=foo:bar:baz:$PATH
404extend_path() {
405 local path_var="$1"
406 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500407 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200408 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500409 local sep=':'
410 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200411
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500412 eval "array_val=\"\${$array_var[@]}\""
413 array_val="$(echo ${array_val// /:})"
414
415 [ -z "$path_val" ] && sep=''
416
417 if [ "$op" = "prepend" ]; then
418 array_val="${array_val}${sep}${path_val}"
419 elif [ "$op" = "append" ]; then
420 array_val="${path_val}${sep}${array_val}"
421 fi
422
423 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200424}
425
Chris Kay3d807882022-08-31 16:00:02 +0100426# Expand and evaluate Bash variables and expressions in a file, whose path is
427# given by the first parameter.
428#
429# For example, to expand a file containing the following:
430#
431# My name is ${name}!
432#
433# You might use:
434#
435# name="Chris" expand_template "path-to-my-file.txt"
436#
437# This would yield:
438#
439# My name is Chris!
440#
441# If you need to run multiple expansions on a file (e.g. to fill out information
442# incrementally), then you can escape expansion of a variable with a backslash,
443# e.g. `\${name}`.
444#
445# The expanded output is printed to the standard output stream.
446expand_template() {
447 local path="$1"
448
449 eval "cat <<-EOF
450 $(<${path})
451 EOF"
452}
453
Harrison Mutai013f6332022-02-16 16:06:33 +0000454# Fetch and extract the latest supported version of the LLVM toolchain from
455# a compressed archive file to a target directory, if it is required.
456setup_llvm_toolchain() {
457 link="${1:-$llvm_archive}"
458 archive="${2:-"$workspace/llvm.tar.xz"}"
459 target_dir="${3:-$llvm_dir}"
460
461 if is_arm_jenkins_env || upon "$local_ci"; then
462 url="$link" saveas="$archive" fetch_file
463 mkdir -p $target_dir
464 extract_tarball $archive $target_dir --strip-components=1 -k
465 fi
466}
467
468# Extract files from compressed archive to target directory. Supports .zip,
469# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500470extract_tarball() {
471 local archive="$1"
472 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500473 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500474
475 pushd "$target_dir"
476 case $(file --mime-type -b "$archive") in
477 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500478 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500479 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500480 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500481 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500482 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000483 application/x-xz)
484 tar -x $extra_params -f $archive
485 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500486 esac
Zelalem219df412020-05-17 19:21:20 -0500487 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500488}
489
Gary Morrison999a9d72022-03-14 18:29:06 -0500490# See if execution is done by Jenkins. If called with a parameter,
491# representing a 'domain', e.g. arm.com, it will also check if
Arthur Shea813bdf2025-02-03 21:39:57 -0800492# JENKINS_PUBLIC_URL contains the latter.
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500493is_jenkins_env () {
494 local domain="${1-}"
495
496 # check if running under Jenkins, if not, return non-zero
497 # the checks assumes Jenkins executing if JENKINS_HOME is set
498 [ -z "$JENKINS_HOME" ] && return 1
499
500 # if no parameter passed, no more checks, quit
501 [ -z "$domain" ] && return 0
502
Arthur Shea813bdf2025-02-03 21:39:57 -0800503 if echo "$JENKINS_PUBLIC_URL" | grep -q "$domain"; then
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500504 return 0
505 fi
506
507 return 1
508}
509
510
511# Check if execution is under ARM's jenkins
512is_arm_jenkins_env() {
Saheer Babu4bb308e2025-01-08 16:32:17 +0000513 local arm_domain="oss.arm.com"
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500514 return $(is_jenkins_env "$arm_domain")
515}
516
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600517
518# Provide correct linaro cross toolchain based on environment
519set_cross_compile_gcc_linaro_toolchain() {
520 local cross_compile_path="/home/buildslave/tools"
521
522 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600523 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600524
525 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
526}
527
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500528if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200529 jenkins_run=1
530 umask 0002
531else
532 unset jenkins_run
533fi
534
535# Project scratch location for Trusted Firmware CI
536project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
537project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
538warehouse="${nfs_volume}/warehouse"
Arthur Shea813bdf2025-02-03 21:39:57 -0800539jenkins_url="${JENKINS_PUBLIC_URL%/*}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200540jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
541
542# Model revisions
Govindraj Raja02e14fa2024-06-18 13:34:17 -0500543model_version_11_24="${model_version:-11.24}"
544model_build_11_24="${model_build:-24}"
545
Govindraj Raja8962c452024-06-04 14:50:28 -0500546model_version="${model_version:-11.26}"
547model_build="${model_build:-11}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100548model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200549
550# Model snapshots from filer are not normally not accessible from developer
551# systems. Ignore failures from picking real path for local runs.
552pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
553pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
554
Fathi Boudra422bf772019-12-02 11:10:16 +0200555tforg_gerrit_url="review.trustedfirmware.org"
556
557# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
558# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200559tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
560tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200561tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
562tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500563ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
564ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500565tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200566scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100567scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100568spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
569spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Jimmy Brisson0d5e12c2023-05-16 14:51:51 -0500570tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
571tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
572tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"
573tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-extras}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200574
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500575tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200576tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
577css_downloads="${css_downloads:-$tfa_downloads/css}"
578
Chris Kay52b8d432023-04-27 16:10:57 +0100579# SCP/MCP release binaries.
Ryan Everett3836c6d2024-10-09 17:03:39 +0100580scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.15.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000581
Leonardo Sandoval15676062020-11-19 11:58:09 -0600582linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100583linaro_release="${linaro_release:-$linaro_2001_release}"
Ryan Everettf3eb2682024-11-26 11:43:36 +0000584mbedtls_version="${mbedtls_version:-3.6.2}"
Zelalem219df412020-05-17 19:21:20 -0500585
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500586# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000587mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200588
Harrison Mutai013f6332022-02-16 16:06:33 +0000589# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
590# LLVM archive public hosting available at github.com
591llvm_version="${llvm_version:-14.0.0}"
592llvm_dir="$workspace/llvm-$llvm_version"
593llvm_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}"
594
Mark Dykes30138ad2021-11-09 16:48:17 -0600595coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200596coverity_default_checkers=(
597"--all"
598"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200599"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500600"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200601"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200602"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500603"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200604)
605
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500606docker_registry="${docker_registry:-}"
607
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500608# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanand3feb2992024-09-30 18:11:54 +0100609toolchain_version="13.3.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500610
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100611aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500612aarch64_none_elf_prefix="aarch64-none-elf-"
613
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100614arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500615arm_none_eabi_prefix="arm-none-eabi-"
616
Fathi Boudra422bf772019-12-02 11:10:16 +0200617path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500618 "${aarch64_none_elf_dir}/bin"
619 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000620 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500621 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200622)
623
624ld_library_path_list=(
625)
626
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200627license_path_list=${license_path_list-(
628)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200629
630# Setup various paths
631if upon "$retain_paths"; then
632 # If explicitly requested, retain local paths; apppend CI paths to the
633 # existing ones.
634 op="append" extend_path "PATH" "path_list"
635 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
636 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
637else
638 # Otherwise, prepend CI paths so that they take effect before local ones
639 extend_path "PATH" "path_list"
640 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
641 extend_path "LM_LICENSE_FILE" "license_path_list"
642fi
643
644export LD_LIBRARY_PATH
645export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200646export ARM_TOOL_VARIANT=ult
647
648# vim: set tw=80 sw=8 noet: