blob: 7d63cd5003ea901411a5b55932e37c0884d81699 [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 Shebc61db72025-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"
Saheer Babudd9d8122025-02-10 14:32:54 +000031 elif echo "$JENKINS_PUBLIC_URL" | grep -q "jenkins.openci"; then
32 # This is Arm infrastructure while migration from ci.trustedfirmware.org
33 source "$ci_root/openci-env.sh"
Arthur Shebc61db72025-02-03 21:39:57 -080034 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.trustedfirmware.org"; then
Paul Sokolovskyc90cb772023-07-31 14:28:41 +030035 if echo "$TF_GERRIT_BRANCH" | grep -q "lts-v2.8"; then
laurenw-arm8f595d02023-07-10 15:05:43 -050036 source "$ci_root/openci-lts-v2.8-env.sh"
laurenw-arm92881b92024-03-28 12:57:42 -050037 elif echo "$TF_GERRIT_BRANCH" | grep -q "lts-v2.10"; then
38 source "$ci_root/openci-lts-v2.10-env.sh"
laurenw-arm8f595d02023-07-10 15:05:43 -050039 else
40 source "$ci_root/openci-env.sh"
41 fi
Arthur Shebc61db72025-02-03 21:39:57 -080042 elif echo "$JENKINS_PUBLIC_URL" | grep -q "ci.staging.trustedfirmware.org"; then
Chris Kay73a91b02022-12-19 16:56:51 +000043 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020044 fi
45fi
46
Fathi Boudra422bf772019-12-02 11:10:16 +020047# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
48nfs_volume="${nfs_volume:-$NFS_VOLUME}"
49nfs_volume="${nfs_volume:?}"
50
51# Override workspace for local runs
52workspace="${workspace:-$WORKSPACE}"
53workspace="${workspace:?}"
54workspace="$(readlink -f "$workspace")"
55artefacts="$workspace/artefacts"
56
57# pushd and popd outputs the directory stack every time, which could be
58# confusing when shown on the log. Suppress its output.
59pushd() {
60 builtin pushd "$1" &>/dev/null
61}
62popd() {
63 builtin popd &>/dev/null
64}
65
66# Copy a file to the $archive directory
67archive_file() {
68 local f out target md5
69 f="${1:?}"
70
71 out="${archive:?}"
72 [ ! -d "$out" ] && die "$out is not a directory"
73
74 target="$out/$(basename $f)"
75 if [ -f "$target" ]; then
76 # Prevent same file error
77 if [ "$(stat --format=%i "$target")" = \
78 "$(stat --format=%i "$f")" ]; then
79 return
80 fi
81 fi
82
83 md5="$(md5sum "$f" | awk '{print $1}')"
84 cp -t "$out" "$f"
85 echo "Archived: $f (md5: $md5)"
86}
87
88die() {
89 [ "$1" ] && echo "$1" >&2
90 exit 1
91}
92
93# Emit environment variables for the purpose of sourcing from shells and as
94# Jenkins property files. Whether the RHS is quoted depends on "$quote".
95emit_env() {
96 local env_file="${env_file:?}"
97 local var="${1:?}"
98
99 # Value parameter is mandatory, but allow for it to be empty
100 local val="${2?}"
101
102 if upon "$quote"; then
103 val="\"$val\""
104 else
105 # If RHS is not required to be quoted, any white space in it
106 # won't go well with a shell sourcing this file.
107 if echo "$var" | grep -q '\s'; then
108 die "$var: value '$val' has white space"
109 fi
110 fi
111
112 echo "$var=$val" >> "$env_file"
113}
114
Fathi Boudra422bf772019-12-02 11:10:16 +0200115fetch_directory() {
116 local base="$(basename "${url:?}")"
117 local sa
118
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200119 case "${url}" in
120 http*://*)
121 # Have exactly one trailing /
122 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200123
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200124 # Figure out the number of components between hostname and the
125 # final one
126 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
127 sa="${saveas:-$base}"
128 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500129 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200130 --reject="index.html*" "$modified_url"
131 if [ "$sa" != "$base" ]; then
132 mv "$base" "$sa"
133 fi
134 ;;
135 file://*)
136 sa="${saveas:-.}"
137 echo "Fetch: ${url} -> $sa"
138 cp -r "${url#file://}" "$sa"
139 ;;
140 *)
141 sa="${saveas:-.}"
142 echo "Fetch: ${url} -> $sa"
143 cp -r "${url}" "$sa"
144 ;;
145 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200146}
147
148fetch_file() {
149 local url="${url:?}"
150 local sa
151 local saveas
152
153 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200154 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200155 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200156 echo "Fetch: $url -> $saveas"
157 # Use curl to support file protocol
Paul Sokolovsky532a4882023-05-22 15:50:04 +0300158 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200159 else
160 sa="${saveas-.}"
161 echo "Fetch: $url -> $sa"
162 cp "$url" "$sa"
163 fi
164}
165
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100166fetch_and_archive() {
167 url=${url:?}
168 filename=${filename:-basename $url}
169
170 url="$url" saveas="$filename" fetch_file
171 archive_file "$filename"
172}
173
174filter_artefacts(){
175 local model_param_file="${model_param_file-$archive/model_params}"
176
177 # Bash doesn't have array values, we have to create references to the
178 # array of artefacts and the artefact filters.
179 declare -ga "$1"
180 declare -n artefacts="$1"
181 declare -n filters="$2"
182
183 for artefact in "${!filters[@]}"; do
184 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
185 artefacts+=("${artefact}")
186 fi
187 done
188}
189
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100190# Generate link to an archived binary.
191gen_bin_url() {
192 local bin_mode="${bin_mode:?}"
193 local bin="${1:?}"
194
195 if upon "$jenkins_run"; then
196 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
197 else
198 echo "file://$workspace/artefacts/$bin_mode/$bin"
199 fi
200}
201
Harrison Mutaid993ce12023-03-27 13:21:28 +0100202get_boot_image() {
203 local image=${image:?}
204 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100205
Harrison Mutaid993ce12023-03-27 13:21:28 +0100206 declare -n image_list=${image_list-${image}_list}
207
208 local url="${image_list[${type}]}"
209
210 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100211}
212
Harrison Mutaid993ce12023-03-27 13:21:28 +0100213get_boot_image_from_fip() {(
214 local url="${url:?}"
215 local image="${image:?}"
216 local output_name="${output_name-bl32.bin}"
217
218 cd "$(mktempdir)"
219
220 extract_fip "$url"
221 mv "$image" "$output_name"
222 archive_file "$output_name"
223)}
224
Chris Kay03ffbe72022-11-17 18:53:50 +0000225# Get the path to the run environment variables file.
226#
227# Run environment variables are the test-specific environment variables
228# configured by the CI's test configuration.
229#
230# Usage: get_run_env_path <archive>
231get_run_env_path() {
232 echo "${1:?}/run/env"
233}
234
235# Get a run environment variable.
236#
237# Run environment variables are the test-specific environment variables
238# configured by the CI's test configuration.
239#
240# Usage: get_run_env <archive> <variable> [default]
241get_run_env() {
242 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
243 . "$(get_run_env_path "${1:?}")"
244 fi
245
246 echo "${!2:-${3}}"
247}
248
249# Get the number of UARTs configured by the current test configuration. This
250# defaults to `4`.
251#
252# Usage: get_num_uarts <archive> [default]
253get_num_uarts() {
254 local default=4
255
256 get_run_env "${1:?}" num_uarts "${2-${default}}"
257}
258
259# Get the ports script configured by the current test configuration. This
260# defaults to `script/default-ports-script.awk`.
261#
262# Usage: get_ports_script <archive> [default]
263get_ports_script() {
264 local default="${ci_root}/script/default-ports-script.awk"
265
266 get_run_env "${1:?}" ports_script "${2-${default}}"
267}
268
269# Get the primary UART configured by the current test configuration. This
270# defaults to `0`.
271#
272# Usage: get_primary_uart <archive> [default]
273get_primary_uart() {
274 local default=0
275
276 get_run_env "${1:?}" primary_uart "${2-${default}}"
277}
278
279# Get the payload UART configured by the current test configuration. This
280# defaults to the primary UART.
281#
282# Usage: get_payload_uart <archive> [default]
283get_payload_uart() {
284 local default="$(get_primary_uart "${1:?}")"
285
286 get_run_env "${1:?}" payload_uart "${2-${default}}"
287}
288
289# Get the path to a UART's environment variable directory.
290#
291# UART environment variables are the UART-specific environment variables
292# configured by the CI's test configuration.
293#
294# Usage: get_uart_env_path <archive> <uart>
295get_uart_env_path() {
296 echo "${1:?}/run/uart${2:?}"
297}
298
299# Get a UART environment variable.
300#
301# UART environment variables are the UART-specific environment variables
302# configured by the CI's test configuration.
303#
304# Usage: get_uart_env <archive> <uart> <variable> [default]
305get_uart_env() {
306 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
307 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
308 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000309 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000310 fi
311}
312
313# Get the path to the Expect script for a given UART. This defaults to nothing.
314#
315# Usage: get_uart_expect_script <archive> <uart> [default]
316get_uart_expect_script() {
317 local default=
318
319 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
320}
321
322# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
323#
324# Usage: get_uart_port <archive> <uart> [default]
325get_uart_port() {
326 local default="$(( 5000 + "${2:?}" ))"
327
328 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
329}
330
Chris Kay24d039f2022-11-23 12:53:30 +0000331# Set a UART environment variable.
332#
333# UART environment variables are the UART-specific environment variables
334# configured by the CI's test configuration.
335#
336# Usage: set_uart_env <archive> <uart> <variable> <value>
337set_uart_env() {
338 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
339
340 mkdir -p "${path}" && \
341 echo "${4:?}" > "${path}/${3:?}"
342}
343
344# Set the FVP port for a given UART.
345#
346# Usage: set_uart_port <archive> <uart> <port>
347set_uart_port() {
348 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
349}
350
Fathi Boudra422bf772019-12-02 11:10:16 +0200351# Make a temporary directory/file insdie workspace, so that it doesn't need to
352# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
353mktempdir() {
354 local ws="${workspace:?}"
355
356 mktemp -d --tmpdir="$ws"
357}
358mktempfile() {
359 local ws="${workspace:?}"
360
361 mktemp --tmpdir="$ws"
362}
363
364not_upon() {
365 ! upon "$1"
366}
367
368# Use "$1" as a boolean
369upon() {
370 case "$1" in
371 "" | "0" | "false") return 1;;
372 *) return 0;;
373 esac
374}
375
376# Check if the argument is a URL
377is_url() {
378 echo "$1" | grep -q "://"
379}
380
381# Check if a path is absolute
382is_abs() {
383 [ "${1:0:1}" = "/" ]
384}
385
386# Unset a variable based on its boolean value
387# If foo=, foo will be unset
388# If foo=blah, then leave it as is
389reset_var() {
390 local var="$1"
391 local val="${!var}"
392
393 if [ -z "$val" ]; then
394 unset "$var"
395 else
396 var="$val"
397 fi
398}
399
400default_var() {
401 local var="$1"
402 local val="${!var}"
403 local default="$2"
404
405 if [ -z "$val" ]; then
406 eval "$var=$default"
407 fi
408}
409
410# String various items joined by ":" to form a path. Items are prepended by
411# default; or 'op' can be set to 'append' to have them appended.
412# For example, to set: PATH=foo:bar:baz:$PATH
413extend_path() {
414 local path_var="$1"
415 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500416 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200417 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500418 local sep=':'
419 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200420
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500421 eval "array_val=\"\${$array_var[@]}\""
422 array_val="$(echo ${array_val// /:})"
423
424 [ -z "$path_val" ] && sep=''
425
426 if [ "$op" = "prepend" ]; then
427 array_val="${array_val}${sep}${path_val}"
428 elif [ "$op" = "append" ]; then
429 array_val="${path_val}${sep}${array_val}"
430 fi
431
432 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200433}
434
Chris Kay3d807882022-08-31 16:00:02 +0100435# Expand and evaluate Bash variables and expressions in a file, whose path is
436# given by the first parameter.
437#
438# For example, to expand a file containing the following:
439#
440# My name is ${name}!
441#
442# You might use:
443#
444# name="Chris" expand_template "path-to-my-file.txt"
445#
446# This would yield:
447#
448# My name is Chris!
449#
450# If you need to run multiple expansions on a file (e.g. to fill out information
451# incrementally), then you can escape expansion of a variable with a backslash,
452# e.g. `\${name}`.
453#
454# The expanded output is printed to the standard output stream.
455expand_template() {
456 local path="$1"
457
458 eval "cat <<-EOF
459 $(<${path})
460 EOF"
461}
462
Harrison Mutai013f6332022-02-16 16:06:33 +0000463# Fetch and extract the latest supported version of the LLVM toolchain from
464# a compressed archive file to a target directory, if it is required.
465setup_llvm_toolchain() {
466 link="${1:-$llvm_archive}"
467 archive="${2:-"$workspace/llvm.tar.xz"}"
468 target_dir="${3:-$llvm_dir}"
469
470 if is_arm_jenkins_env || upon "$local_ci"; then
471 url="$link" saveas="$archive" fetch_file
472 mkdir -p $target_dir
473 extract_tarball $archive $target_dir --strip-components=1 -k
474 fi
475}
476
477# Extract files from compressed archive to target directory. Supports .zip,
478# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500479extract_tarball() {
480 local archive="$1"
481 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500482 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500483
484 pushd "$target_dir"
485 case $(file --mime-type -b "$archive") in
486 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500487 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500488 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500489 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500490 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500491 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000492 application/x-xz)
493 tar -x $extra_params -f $archive
494 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500495 esac
Zelalem219df412020-05-17 19:21:20 -0500496 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500497}
498
Gary Morrison999a9d72022-03-14 18:29:06 -0500499# See if execution is done by Jenkins. If called with a parameter,
500# representing a 'domain', e.g. arm.com, it will also check if
Arthur Shebc61db72025-02-03 21:39:57 -0800501# JENKINS_PUBLIC_URL contains the latter.
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500502is_jenkins_env () {
503 local domain="${1-}"
504
505 # check if running under Jenkins, if not, return non-zero
506 # the checks assumes Jenkins executing if JENKINS_HOME is set
507 [ -z "$JENKINS_HOME" ] && return 1
508
509 # if no parameter passed, no more checks, quit
510 [ -z "$domain" ] && return 0
511
Arthur Shebc61db72025-02-03 21:39:57 -0800512 if echo "$JENKINS_PUBLIC_URL" | grep -q "$domain"; then
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500513 return 0
514 fi
515
516 return 1
517}
518
519
520# Check if execution is under ARM's jenkins
521is_arm_jenkins_env() {
522 local arm_domain="arm.com"
523 return $(is_jenkins_env "$arm_domain")
524}
525
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600526
527# Provide correct linaro cross toolchain based on environment
528set_cross_compile_gcc_linaro_toolchain() {
529 local cross_compile_path="/home/buildslave/tools"
530
531 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600532 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600533
534 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
535}
536
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500537if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200538 jenkins_run=1
539 umask 0002
540else
541 unset jenkins_run
542fi
543
544# Project scratch location for Trusted Firmware CI
545project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
546project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
547warehouse="${nfs_volume}/warehouse"
Arthur Shebc61db72025-02-03 21:39:57 -0800548jenkins_url="${JENKINS_PUBLIC_URL%/*}"
549JENKINS_PUBLIC_URL="${JENKINS_PUBLIC_URL:-https://ci.trustedfirmware.org/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200550
551# Model revisions
Govindraj Raja02e14fa2024-06-18 13:34:17 -0500552model_version_11_24="${model_version:-11.24}"
553model_build_11_24="${model_build:-24}"
554
Govindraj Raja8962c452024-06-04 14:50:28 -0500555model_version="${model_version:-11.26}"
556model_build="${model_build:-11}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100557model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200558
559# Model snapshots from filer are not normally not accessible from developer
560# systems. Ignore failures from picking real path for local runs.
561pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
562pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
563
Fathi Boudra422bf772019-12-02 11:10:16 +0200564tforg_gerrit_url="review.trustedfirmware.org"
565
566# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
567# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200568tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
569tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200570tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
571tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500572ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
573ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500574tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200575scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100576scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100577spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
578spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Jimmy Brisson0d5e12c2023-05-16 14:51:51 -0500579tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
580tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
581tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"
582tf_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 +0200583
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500584tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200585tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
586css_downloads="${css_downloads:-$tfa_downloads/css}"
587
Chris Kay52b8d432023-04-27 16:10:57 +0100588# SCP/MCP release binaries.
Sona Mathew914d6b42024-04-04 18:04:48 -0500589scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.14.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000590
Leonardo Sandoval15676062020-11-19 11:58:09 -0600591linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100592linaro_release="${linaro_release:-$linaro_2001_release}"
Jimmy Brisson6b73bd32024-04-16 11:19:56 -0500593mbedtls_version="${mbedtls_version:-3.6.0}"
Zelalem219df412020-05-17 19:21:20 -0500594
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500595# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000596mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200597
Harrison Mutai013f6332022-02-16 16:06:33 +0000598# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
599# LLVM archive public hosting available at github.com
600llvm_version="${llvm_version:-14.0.0}"
601llvm_dir="$workspace/llvm-$llvm_version"
602llvm_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}"
603
Mark Dykes30138ad2021-11-09 16:48:17 -0600604coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200605coverity_default_checkers=(
606"--all"
607"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200608"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500609"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200610"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200611"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500612"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200613)
614
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500615docker_registry="${docker_registry:-}"
616
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500617# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanand06df2b42024-04-05 12:44:38 +0100618toolchain_version="13.2.Rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500619
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100620aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500621aarch64_none_elf_prefix="aarch64-none-elf-"
622
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100623arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500624arm_none_eabi_prefix="arm-none-eabi-"
625
Fathi Boudra422bf772019-12-02 11:10:16 +0200626path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500627 "${aarch64_none_elf_dir}/bin"
628 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000629 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500630 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
631 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200632)
633
634ld_library_path_list=(
635)
636
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200637license_path_list=${license_path_list-(
638)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200639
640# Setup various paths
641if upon "$retain_paths"; then
642 # If explicitly requested, retain local paths; apppend CI paths to the
643 # existing ones.
644 op="append" extend_path "PATH" "path_list"
645 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
646 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
647else
648 # Otherwise, prepend CI paths so that they take effect before local ones
649 extend_path "PATH" "path_list"
650 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
651 extend_path "LM_LICENSE_FILE" "license_path_list"
652fi
653
654export LD_LIBRARY_PATH
655export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200656export ARM_TOOL_VARIANT=ult
657
658# vim: set tw=80 sw=8 noet: