blob: b154773cd717803a33a17998e414251de19dcd5e [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Govindraj Rajafa86cf62025-02-19 14:55:48 -06003# Copyright (c) 2019-2025, 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
Saheer Babu3eda72e2025-05-20 21:03:33 +010028 if echo "$JENKINS_PUBLIC_URL" | grep -q "staging"; then
29 source "$ci_root/openci-staging-env.sh"
30 else
Saheer Babu3108a5d2025-02-10 14:32:54 +000031 source "$ci_root/openci-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 Sokolovsky532a4882023-05-22 15:50:04 +0300146 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $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:?}
Boyan Karatotev52fc8a12025-02-27 16:56:39 +0000156 filename=${filename:-$(basename $url)}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100157
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
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100178# Generate link to an archived binary.
179gen_bin_url() {
180 local bin_mode="${bin_mode:?}"
181 local bin="${1:?}"
182
183 if upon "$jenkins_run"; then
184 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
185 else
186 echo "file://$workspace/artefacts/$bin_mode/$bin"
187 fi
188}
189
Thaddeus Gonzalez-Serna211688c2025-03-21 19:12:37 -0500190# Generate link for code coverage plugin
191gen_cc_url(){
192 local filename="coverage_trace.so"
193
194 if upon "$jenkins_run"; then
195 echo "${coverage_trace_plugin}"
196 else
197
198 local url="https://downloads.trustedfirmware.org/coverage-plugin/qa-tools/coverage-tool/coverage-plugin/${filename}"
199 local local_path="$workspace/artefacts/${bin_mode:?}/${filename}"
200
201 mkdir -p "$(dirname "$local_path")"
202 url="$url" saveas="$local_path" fetch_file
203 coverage_trace_plugin=$local_path
204
205 echo $coverage_trace_plugin
206 fi
207
208}
209
Harrison Mutaid993ce12023-03-27 13:21:28 +0100210get_boot_image() {
211 local image=${image:?}
212 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100213
Harrison Mutaid993ce12023-03-27 13:21:28 +0100214 declare -n image_list=${image_list-${image}_list}
215
216 local url="${image_list[${type}]}"
217
218 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100219}
220
Harrison Mutaid993ce12023-03-27 13:21:28 +0100221get_boot_image_from_fip() {(
222 local url="${url:?}"
223 local image="${image:?}"
224 local output_name="${output_name-bl32.bin}"
225
226 cd "$(mktempdir)"
227
228 extract_fip "$url"
229 mv "$image" "$output_name"
230 archive_file "$output_name"
231)}
232
Chris Kay03ffbe72022-11-17 18:53:50 +0000233# Get the path to the run environment variables file.
234#
235# Run environment variables are the test-specific environment variables
236# configured by the CI's test configuration.
237#
238# Usage: get_run_env_path <archive>
239get_run_env_path() {
240 echo "${1:?}/run/env"
241}
242
243# Get a run environment variable.
244#
245# Run environment variables are the test-specific environment variables
246# configured by the CI's test configuration.
247#
248# Usage: get_run_env <archive> <variable> [default]
249get_run_env() {
250 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
251 . "$(get_run_env_path "${1:?}")"
252 fi
253
254 echo "${!2:-${3}}"
255}
256
257# Get the number of UARTs configured by the current test configuration. This
258# defaults to `4`.
259#
260# Usage: get_num_uarts <archive> [default]
261get_num_uarts() {
262 local default=4
263
264 get_run_env "${1:?}" num_uarts "${2-${default}}"
265}
266
267# Get the ports script configured by the current test configuration. This
268# defaults to `script/default-ports-script.awk`.
269#
270# Usage: get_ports_script <archive> [default]
271get_ports_script() {
272 local default="${ci_root}/script/default-ports-script.awk"
273
274 get_run_env "${1:?}" ports_script "${2-${default}}"
275}
276
277# Get the primary UART configured by the current test configuration. This
278# defaults to `0`.
279#
280# Usage: get_primary_uart <archive> [default]
281get_primary_uart() {
282 local default=0
283
284 get_run_env "${1:?}" primary_uart "${2-${default}}"
285}
286
287# Get the payload UART configured by the current test configuration. This
288# defaults to the primary UART.
289#
290# Usage: get_payload_uart <archive> [default]
291get_payload_uart() {
292 local default="$(get_primary_uart "${1:?}")"
293
294 get_run_env "${1:?}" payload_uart "${2-${default}}"
295}
296
297# Get the path to a UART's environment variable directory.
298#
299# UART environment variables are the UART-specific environment variables
300# configured by the CI's test configuration.
301#
302# Usage: get_uart_env_path <archive> <uart>
303get_uart_env_path() {
304 echo "${1:?}/run/uart${2:?}"
305}
306
307# Get a UART environment variable.
308#
309# UART environment variables are the UART-specific environment variables
310# configured by the CI's test configuration.
311#
312# Usage: get_uart_env <archive> <uart> <variable> [default]
313get_uart_env() {
314 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
315 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
316 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000317 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000318 fi
319}
320
321# Get the path to the Expect script for a given UART. This defaults to nothing.
322#
323# Usage: get_uart_expect_script <archive> <uart> [default]
324get_uart_expect_script() {
325 local default=
326
327 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
328}
329
330# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
331#
332# Usage: get_uart_port <archive> <uart> [default]
333get_uart_port() {
334 local default="$(( 5000 + "${2:?}" ))"
335
336 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
337}
338
Chris Kay24d039f2022-11-23 12:53:30 +0000339# Set a UART environment variable.
340#
341# UART environment variables are the UART-specific environment variables
342# configured by the CI's test configuration.
343#
344# Usage: set_uart_env <archive> <uart> <variable> <value>
345set_uart_env() {
346 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
347
348 mkdir -p "${path}" && \
349 echo "${4:?}" > "${path}/${3:?}"
350}
351
352# Set the FVP port for a given UART.
353#
354# Usage: set_uart_port <archive> <uart> <port>
355set_uart_port() {
356 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
357}
358
Fathi Boudra422bf772019-12-02 11:10:16 +0200359# Make a temporary directory/file insdie workspace, so that it doesn't need to
360# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
361mktempdir() {
362 local ws="${workspace:?}"
363
364 mktemp -d --tmpdir="$ws"
365}
366mktempfile() {
367 local ws="${workspace:?}"
368
369 mktemp --tmpdir="$ws"
370}
371
372not_upon() {
373 ! upon "$1"
374}
375
376# Use "$1" as a boolean
377upon() {
378 case "$1" in
379 "" | "0" | "false") return 1;;
380 *) return 0;;
381 esac
382}
383
384# Check if the argument is a URL
385is_url() {
386 echo "$1" | grep -q "://"
387}
388
389# Check if a path is absolute
390is_abs() {
391 [ "${1:0:1}" = "/" ]
392}
393
394# Unset a variable based on its boolean value
395# If foo=, foo will be unset
396# If foo=blah, then leave it as is
397reset_var() {
398 local var="$1"
399 local val="${!var}"
400
401 if [ -z "$val" ]; then
402 unset "$var"
403 else
404 var="$val"
405 fi
406}
407
408default_var() {
409 local var="$1"
410 local val="${!var}"
411 local default="$2"
412
413 if [ -z "$val" ]; then
414 eval "$var=$default"
415 fi
416}
417
418# String various items joined by ":" to form a path. Items are prepended by
419# default; or 'op' can be set to 'append' to have them appended.
420# For example, to set: PATH=foo:bar:baz:$PATH
421extend_path() {
422 local path_var="$1"
423 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500424 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200425 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500426 local sep=':'
427 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200428
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500429 eval "array_val=\"\${$array_var[@]}\""
430 array_val="$(echo ${array_val// /:})"
431
432 [ -z "$path_val" ] && sep=''
433
434 if [ "$op" = "prepend" ]; then
435 array_val="${array_val}${sep}${path_val}"
436 elif [ "$op" = "append" ]; then
437 array_val="${path_val}${sep}${array_val}"
438 fi
439
440 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200441}
442
Chris Kay3d807882022-08-31 16:00:02 +0100443# Expand and evaluate Bash variables and expressions in a file, whose path is
444# given by the first parameter.
445#
446# For example, to expand a file containing the following:
447#
448# My name is ${name}!
449#
450# You might use:
451#
452# name="Chris" expand_template "path-to-my-file.txt"
453#
454# This would yield:
455#
456# My name is Chris!
457#
458# If you need to run multiple expansions on a file (e.g. to fill out information
459# incrementally), then you can escape expansion of a variable with a backslash,
460# e.g. `\${name}`.
461#
462# The expanded output is printed to the standard output stream.
463expand_template() {
464 local path="$1"
465
466 eval "cat <<-EOF
467 $(<${path})
468 EOF"
469}
470
Harrison Mutai013f6332022-02-16 16:06:33 +0000471# Fetch and extract the latest supported version of the LLVM toolchain from
472# a compressed archive file to a target directory, if it is required.
473setup_llvm_toolchain() {
474 link="${1:-$llvm_archive}"
475 archive="${2:-"$workspace/llvm.tar.xz"}"
476 target_dir="${3:-$llvm_dir}"
477
478 if is_arm_jenkins_env || upon "$local_ci"; then
479 url="$link" saveas="$archive" fetch_file
480 mkdir -p $target_dir
481 extract_tarball $archive $target_dir --strip-components=1 -k
482 fi
483}
484
Jayanth Dodderi Chidanand985bb2f2025-04-09 17:02:39 +0100485# Fetch and extract the latest supported version of the GCC toolchain from
486# a compressed archive file to a target directory, if it is required.
487setup_gcc_toolchain() {
488 link="${1:-$gcc_archive}"
489 archive="${2:-"$workspace/gcc.tar.xz"}"
490 target_dir="${3:-$gcc_dir}"
491
492 if upon "$local_ci"; then
493 url="$link" saveas="$archive" fetch_file
494 mkdir -p $target_dir
495 extract_tarball $archive $target_dir --strip-components=1 -k
496 fi
497}
498
Harrison Mutai013f6332022-02-16 16:06:33 +0000499# Extract files from compressed archive to target directory. Supports .zip,
500# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500501extract_tarball() {
502 local archive="$1"
503 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500504 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500505
506 pushd "$target_dir"
507 case $(file --mime-type -b "$archive") in
508 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500509 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500510 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500511 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500512 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500513 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000514 application/x-xz)
515 tar -x $extra_params -f $archive
516 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500517 esac
Zelalem219df412020-05-17 19:21:20 -0500518 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500519}
520
Gary Morrison999a9d72022-03-14 18:29:06 -0500521# See if execution is done by Jenkins. If called with a parameter,
522# representing a 'domain', e.g. arm.com, it will also check if
Arthur Shea813bdf2025-02-03 21:39:57 -0800523# JENKINS_PUBLIC_URL contains the latter.
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500524is_jenkins_env () {
525 local domain="${1-}"
526
527 # check if running under Jenkins, if not, return non-zero
528 # the checks assumes Jenkins executing if JENKINS_HOME is set
529 [ -z "$JENKINS_HOME" ] && return 1
530
531 # if no parameter passed, no more checks, quit
532 [ -z "$domain" ] && return 0
533
Arthur Shea813bdf2025-02-03 21:39:57 -0800534 if echo "$JENKINS_PUBLIC_URL" | grep -q "$domain"; then
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500535 return 0
536 fi
537
538 return 1
539}
540
541
542# Check if execution is under ARM's jenkins
543is_arm_jenkins_env() {
Saheer Babu4bb308e2025-01-08 16:32:17 +0000544 local arm_domain="oss.arm.com"
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500545 return $(is_jenkins_env "$arm_domain")
546}
547
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600548
549# Provide correct linaro cross toolchain based on environment
550set_cross_compile_gcc_linaro_toolchain() {
551 local cross_compile_path="/home/buildslave/tools"
552
553 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600554 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600555
556 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
557}
558
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500559if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200560 jenkins_run=1
561 umask 0002
562else
563 unset jenkins_run
564fi
565
566# Project scratch location for Trusted Firmware CI
567project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
568project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
569warehouse="${nfs_volume}/warehouse"
Arthur Shea813bdf2025-02-03 21:39:57 -0800570jenkins_url="${JENKINS_PUBLIC_URL%/*}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200571jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
572
Govindraj Rajafa86cf62025-02-19 14:55:48 -0600573model_version="${model_version:-11.28}"
574model_build="${model_build:-23}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100575model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200576
577# Model snapshots from filer are not normally not accessible from developer
578# systems. Ignore failures from picking real path for local runs.
579pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
580pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
581
Fathi Boudra422bf772019-12-02 11:10:16 +0200582tforg_gerrit_url="review.trustedfirmware.org"
583
584# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
585# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200586tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
587tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200588tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
589tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500590ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
591ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500592tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200593scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100594scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100595spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
596spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Manish V Badarkhed62aa5f2025-03-18 21:18:14 +0000597rmm_src_repo_url="${rmm_src_repo_url:-$RMM_SRC_REPO_URL}"
598rmm_src_repo_url="${rmm_src_repo_url:-https://$tforg_gerrit_url/TF-RMM/tf-rmm}"
Jimmy Brisson0d5e12c2023-05-16 14:51:51 -0500599tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
600tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
601tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"
602tf_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 +0200603
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500604tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200605tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
606css_downloads="${css_downloads:-$tfa_downloads/css}"
607
Chris Kay52b8d432023-04-27 16:10:57 +0100608# SCP/MCP release binaries.
Govindraj Rajad345c922025-05-01 15:11:51 +0000609scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.14.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000610
Leonardo Sandoval15676062020-11-19 11:58:09 -0600611linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100612linaro_release="${linaro_release:-$linaro_2001_release}"
Lauren Wehrmeister7c76aca2025-04-03 12:56:54 -0500613mbedtls_version="${mbedtls_version:-3.6.3}"
Zelalem219df412020-05-17 19:21:20 -0500614
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500615# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000616mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200617
Harrison Mutai013f6332022-02-16 16:06:33 +0000618# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
619# LLVM archive public hosting available at github.com
620llvm_version="${llvm_version:-14.0.0}"
621llvm_dir="$workspace/llvm-$llvm_version"
622llvm_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}"
623
Mark Dykes30138ad2021-11-09 16:48:17 -0600624coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200625coverity_default_checkers=(
626"--all"
627"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200628"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500629"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200630"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200631"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500632"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200633)
634
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500635docker_registry="${docker_registry:-}"
636
Jayanth Dodderi Chidanand985bb2f2025-04-09 17:02:39 +0100637#GCC archive public hosting available at arm_website.
638gcc_version="14.2.rel1"
639gcc_archive="${gcc_archive:-https://developer.arm.com/-/media/Files/downloads/gnu/$gcc_version/binrel/arm-gnu-toolchain-$gcc_version-x86_64-aarch64-none-elf.tar.xz}"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500640
Jayanth Dodderi Chidanand985bb2f2025-04-09 17:02:39 +0100641if [ -n "$gcc_space" ]; then
642 gcc_dir="$gcc_space/gcc-$gcc_version"
643fi
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500644
Fathi Boudra422bf772019-12-02 11:10:16 +0200645path_list=(
Jayanth Dodderi Chidanand985bb2f2025-04-09 17:02:39 +0100646 "${gcc_dir:+${gcc_dir}/bin}"
Harrison Mutai013f6332022-02-16 16:06:33 +0000647 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500648 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200649)
650
651ld_library_path_list=(
652)
653
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200654license_path_list=${license_path_list-(
655)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200656
657# Setup various paths
658if upon "$retain_paths"; then
659 # If explicitly requested, retain local paths; apppend CI paths to the
660 # existing ones.
661 op="append" extend_path "PATH" "path_list"
662 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
663 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
664else
665 # Otherwise, prepend CI paths so that they take effect before local ones
Jayanth Dodderi Chidanand985bb2f2025-04-09 17:02:39 +0100666 # Check if the gcc_dir directory does NOT exist.
667 # If it doesn't, execute setup_gcc_toolchain to download and set up the
668 # GCC toolchain.
669 if [ ! -d "$gcc_dir" ]; then
670 setup_gcc_toolchain
671 fi
Fathi Boudra422bf772019-12-02 11:10:16 +0200672 extend_path "PATH" "path_list"
673 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
674 extend_path "LM_LICENSE_FILE" "license_path_list"
675fi
676
677export LD_LIBRARY_PATH
678export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200679export ARM_TOOL_VARIANT=ult
680
681# vim: set tw=80 sw=8 noet: