blob: b6dda4d994f7319775d175b5a35958f90ccc61cc [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Govindraj Raja5e709b22023-02-09 10:21:24 +00003# Copyright (c) 2019-2023, 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
Harrison Mutai9b099892023-01-13 11:34:36 +000019source "${ci_root}/lava_utils.sh"
20
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020021# Optionally source a file containing environmental settings.
22if [ -n "$host_env" ]; then
23 source "$host_env"
24else
25 # Are we running on Arm infrastructure?
Gary Morrison999a9d72022-03-14 18:29:06 -050026 if echo "$JENKINS_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020027 source "$ci_root/arm-env.sh"
Chris Kay7c542f22022-11-18 11:42:59 +000028 elif echo "$JENKINS_URL" | grep -q "ci.trustedfirmware.org"; then
laurenw-arm8f595d02023-07-10 15:05:43 -050029 if echo "$GERRIT_BRANCH" | grep -q "lts-v2.8"; then
30 source "$ci_root/openci-lts-v2.8-env.sh"
31 else
32 source "$ci_root/openci-env.sh"
33 fi
Chris Kay73a91b02022-12-19 16:56:51 +000034 elif echo "$JENKINS_URL" | grep -q "ci.staging.trustedfirmware.org"; then
35 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020036 fi
37fi
38
Fathi Boudra422bf772019-12-02 11:10:16 +020039# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
40nfs_volume="${nfs_volume:-$NFS_VOLUME}"
41nfs_volume="${nfs_volume:?}"
42
43# Override workspace for local runs
44workspace="${workspace:-$WORKSPACE}"
45workspace="${workspace:?}"
46workspace="$(readlink -f "$workspace")"
47artefacts="$workspace/artefacts"
48
49# pushd and popd outputs the directory stack every time, which could be
50# confusing when shown on the log. Suppress its output.
51pushd() {
52 builtin pushd "$1" &>/dev/null
53}
54popd() {
55 builtin popd &>/dev/null
56}
57
58# Copy a file to the $archive directory
59archive_file() {
60 local f out target md5
61 f="${1:?}"
62
63 out="${archive:?}"
64 [ ! -d "$out" ] && die "$out is not a directory"
65
66 target="$out/$(basename $f)"
67 if [ -f "$target" ]; then
68 # Prevent same file error
69 if [ "$(stat --format=%i "$target")" = \
70 "$(stat --format=%i "$f")" ]; then
71 return
72 fi
73 fi
74
75 md5="$(md5sum "$f" | awk '{print $1}')"
76 cp -t "$out" "$f"
77 echo "Archived: $f (md5: $md5)"
78}
79
80die() {
81 [ "$1" ] && echo "$1" >&2
82 exit 1
83}
84
85# Emit environment variables for the purpose of sourcing from shells and as
86# Jenkins property files. Whether the RHS is quoted depends on "$quote".
87emit_env() {
88 local env_file="${env_file:?}"
89 local var="${1:?}"
90
91 # Value parameter is mandatory, but allow for it to be empty
92 local val="${2?}"
93
94 if upon "$quote"; then
95 val="\"$val\""
96 else
97 # If RHS is not required to be quoted, any white space in it
98 # won't go well with a shell sourcing this file.
99 if echo "$var" | grep -q '\s'; then
100 die "$var: value '$val' has white space"
101 fi
102 fi
103
104 echo "$var=$val" >> "$env_file"
105}
106
Fathi Boudra422bf772019-12-02 11:10:16 +0200107fetch_directory() {
108 local base="$(basename "${url:?}")"
109 local sa
110
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200111 case "${url}" in
112 http*://*)
113 # Have exactly one trailing /
114 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200115
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200116 # Figure out the number of components between hostname and the
117 # final one
118 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
119 sa="${saveas:-$base}"
120 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500121 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200122 --reject="index.html*" "$modified_url"
123 if [ "$sa" != "$base" ]; then
124 mv "$base" "$sa"
125 fi
126 ;;
127 file://*)
128 sa="${saveas:-.}"
129 echo "Fetch: ${url} -> $sa"
130 cp -r "${url#file://}" "$sa"
131 ;;
132 *)
133 sa="${saveas:-.}"
134 echo "Fetch: ${url} -> $sa"
135 cp -r "${url}" "$sa"
136 ;;
137 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200138}
139
140fetch_file() {
141 local url="${url:?}"
142 local sa
143 local saveas
144
145 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200146 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200147 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200148 echo "Fetch: $url -> $saveas"
149 # Use curl to support file protocol
Paul Sokolovsky532a4882023-05-22 15:50:04 +0300150 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200151 else
152 sa="${saveas-.}"
153 echo "Fetch: $url -> $sa"
154 cp "$url" "$sa"
155 fi
156}
157
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100158fetch_and_archive() {
159 url=${url:?}
160 filename=${filename:-basename $url}
161
162 url="$url" saveas="$filename" fetch_file
163 archive_file "$filename"
164}
165
166filter_artefacts(){
167 local model_param_file="${model_param_file-$archive/model_params}"
168
169 # Bash doesn't have array values, we have to create references to the
170 # array of artefacts and the artefact filters.
171 declare -ga "$1"
172 declare -n artefacts="$1"
173 declare -n filters="$2"
174
175 for artefact in "${!filters[@]}"; do
176 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
177 artefacts+=("${artefact}")
178 fi
179 done
180}
181
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100182# Generate link to an archived binary.
183gen_bin_url() {
184 local bin_mode="${bin_mode:?}"
185 local bin="${1:?}"
186
187 if upon "$jenkins_run"; then
188 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
189 else
190 echo "file://$workspace/artefacts/$bin_mode/$bin"
191 fi
192}
193
Harrison Mutaid993ce12023-03-27 13:21:28 +0100194get_boot_image() {
195 local image=${image:?}
196 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100197
Harrison Mutaid993ce12023-03-27 13:21:28 +0100198 declare -n image_list=${image_list-${image}_list}
199
200 local url="${image_list[${type}]}"
201
202 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100203}
204
Harrison Mutaid993ce12023-03-27 13:21:28 +0100205get_boot_image_from_fip() {(
206 local url="${url:?}"
207 local image="${image:?}"
208 local output_name="${output_name-bl32.bin}"
209
210 cd "$(mktempdir)"
211
212 extract_fip "$url"
213 mv "$image" "$output_name"
214 archive_file "$output_name"
215)}
216
Chris Kay03ffbe72022-11-17 18:53:50 +0000217# Get the path to the run environment variables file.
218#
219# Run environment variables are the test-specific environment variables
220# configured by the CI's test configuration.
221#
222# Usage: get_run_env_path <archive>
223get_run_env_path() {
224 echo "${1:?}/run/env"
225}
226
227# Get a run environment variable.
228#
229# Run environment variables are the test-specific environment variables
230# configured by the CI's test configuration.
231#
232# Usage: get_run_env <archive> <variable> [default]
233get_run_env() {
234 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
235 . "$(get_run_env_path "${1:?}")"
236 fi
237
238 echo "${!2:-${3}}"
239}
240
241# Get the number of UARTs configured by the current test configuration. This
242# defaults to `4`.
243#
244# Usage: get_num_uarts <archive> [default]
245get_num_uarts() {
246 local default=4
247
248 get_run_env "${1:?}" num_uarts "${2-${default}}"
249}
250
251# Get the ports script configured by the current test configuration. This
252# defaults to `script/default-ports-script.awk`.
253#
254# Usage: get_ports_script <archive> [default]
255get_ports_script() {
256 local default="${ci_root}/script/default-ports-script.awk"
257
258 get_run_env "${1:?}" ports_script "${2-${default}}"
259}
260
261# Get the primary UART configured by the current test configuration. This
262# defaults to `0`.
263#
264# Usage: get_primary_uart <archive> [default]
265get_primary_uart() {
266 local default=0
267
268 get_run_env "${1:?}" primary_uart "${2-${default}}"
269}
270
271# Get the payload UART configured by the current test configuration. This
272# defaults to the primary UART.
273#
274# Usage: get_payload_uart <archive> [default]
275get_payload_uart() {
276 local default="$(get_primary_uart "${1:?}")"
277
278 get_run_env "${1:?}" payload_uart "${2-${default}}"
279}
280
281# Get the path to a UART's environment variable directory.
282#
283# UART environment variables are the UART-specific environment variables
284# configured by the CI's test configuration.
285#
286# Usage: get_uart_env_path <archive> <uart>
287get_uart_env_path() {
288 echo "${1:?}/run/uart${2:?}"
289}
290
291# Get a UART environment variable.
292#
293# UART environment variables are the UART-specific environment variables
294# configured by the CI's test configuration.
295#
296# Usage: get_uart_env <archive> <uart> <variable> [default]
297get_uart_env() {
298 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
299 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
300 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000301 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000302 fi
303}
304
305# Get the path to the Expect script for a given UART. This defaults to nothing.
306#
307# Usage: get_uart_expect_script <archive> <uart> [default]
308get_uart_expect_script() {
309 local default=
310
311 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
312}
313
314# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
315#
316# Usage: get_uart_port <archive> <uart> [default]
317get_uart_port() {
318 local default="$(( 5000 + "${2:?}" ))"
319
320 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
321}
322
Chris Kay24d039f2022-11-23 12:53:30 +0000323# Set a UART environment variable.
324#
325# UART environment variables are the UART-specific environment variables
326# configured by the CI's test configuration.
327#
328# Usage: set_uart_env <archive> <uart> <variable> <value>
329set_uart_env() {
330 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
331
332 mkdir -p "${path}" && \
333 echo "${4:?}" > "${path}/${3:?}"
334}
335
336# Set the FVP port for a given UART.
337#
338# Usage: set_uart_port <archive> <uart> <port>
339set_uart_port() {
340 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
341}
342
Fathi Boudra422bf772019-12-02 11:10:16 +0200343# Make a temporary directory/file insdie workspace, so that it doesn't need to
344# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
345mktempdir() {
346 local ws="${workspace:?}"
347
348 mktemp -d --tmpdir="$ws"
349}
350mktempfile() {
351 local ws="${workspace:?}"
352
353 mktemp --tmpdir="$ws"
354}
355
356not_upon() {
357 ! upon "$1"
358}
359
360# Use "$1" as a boolean
361upon() {
362 case "$1" in
363 "" | "0" | "false") return 1;;
364 *) return 0;;
365 esac
366}
367
368# Check if the argument is a URL
369is_url() {
370 echo "$1" | grep -q "://"
371}
372
373# Check if a path is absolute
374is_abs() {
375 [ "${1:0:1}" = "/" ]
376}
377
378# Unset a variable based on its boolean value
379# If foo=, foo will be unset
380# If foo=blah, then leave it as is
381reset_var() {
382 local var="$1"
383 local val="${!var}"
384
385 if [ -z "$val" ]; then
386 unset "$var"
387 else
388 var="$val"
389 fi
390}
391
392default_var() {
393 local var="$1"
394 local val="${!var}"
395 local default="$2"
396
397 if [ -z "$val" ]; then
398 eval "$var=$default"
399 fi
400}
401
402# String various items joined by ":" to form a path. Items are prepended by
403# default; or 'op' can be set to 'append' to have them appended.
404# For example, to set: PATH=foo:bar:baz:$PATH
405extend_path() {
406 local path_var="$1"
407 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500408 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200409 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500410 local sep=':'
411 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200412
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500413 eval "array_val=\"\${$array_var[@]}\""
414 array_val="$(echo ${array_val// /:})"
415
416 [ -z "$path_val" ] && sep=''
417
418 if [ "$op" = "prepend" ]; then
419 array_val="${array_val}${sep}${path_val}"
420 elif [ "$op" = "append" ]; then
421 array_val="${path_val}${sep}${array_val}"
422 fi
423
424 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200425}
426
Chris Kay3d807882022-08-31 16:00:02 +0100427# Expand and evaluate Bash variables and expressions in a file, whose path is
428# given by the first parameter.
429#
430# For example, to expand a file containing the following:
431#
432# My name is ${name}!
433#
434# You might use:
435#
436# name="Chris" expand_template "path-to-my-file.txt"
437#
438# This would yield:
439#
440# My name is Chris!
441#
442# If you need to run multiple expansions on a file (e.g. to fill out information
443# incrementally), then you can escape expansion of a variable with a backslash,
444# e.g. `\${name}`.
445#
446# The expanded output is printed to the standard output stream.
447expand_template() {
448 local path="$1"
449
450 eval "cat <<-EOF
451 $(<${path})
452 EOF"
453}
454
Harrison Mutai013f6332022-02-16 16:06:33 +0000455# Fetch and extract the latest supported version of the LLVM toolchain from
456# a compressed archive file to a target directory, if it is required.
457setup_llvm_toolchain() {
458 link="${1:-$llvm_archive}"
459 archive="${2:-"$workspace/llvm.tar.xz"}"
460 target_dir="${3:-$llvm_dir}"
461
462 if is_arm_jenkins_env || upon "$local_ci"; then
463 url="$link" saveas="$archive" fetch_file
464 mkdir -p $target_dir
465 extract_tarball $archive $target_dir --strip-components=1 -k
466 fi
467}
468
469# Extract files from compressed archive to target directory. Supports .zip,
470# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500471extract_tarball() {
472 local archive="$1"
473 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500474 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500475
476 pushd "$target_dir"
477 case $(file --mime-type -b "$archive") in
478 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500479 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500480 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500481 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500482 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500483 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000484 application/x-xz)
485 tar -x $extra_params -f $archive
486 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500487 esac
Zelalem219df412020-05-17 19:21:20 -0500488 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500489}
490
Gary Morrison999a9d72022-03-14 18:29:06 -0500491# See if execution is done by Jenkins. If called with a parameter,
492# representing a 'domain', e.g. arm.com, it will also check if
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500493# JENKINS_URL contains the latter.
494is_jenkins_env () {
495 local domain="${1-}"
496
497 # check if running under Jenkins, if not, return non-zero
498 # the checks assumes Jenkins executing if JENKINS_HOME is set
499 [ -z "$JENKINS_HOME" ] && return 1
500
501 # if no parameter passed, no more checks, quit
502 [ -z "$domain" ] && return 0
503
504 if echo "$JENKINS_URL" | grep -q "$domain"; then
505 return 0
506 fi
507
508 return 1
509}
510
511
512# Check if execution is under ARM's jenkins
513is_arm_jenkins_env() {
514 local arm_domain="arm.com"
515 return $(is_jenkins_env "$arm_domain")
516}
517
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600518
519# Provide correct linaro cross toolchain based on environment
520set_cross_compile_gcc_linaro_toolchain() {
521 local cross_compile_path="/home/buildslave/tools"
522
523 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600524 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600525
526 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
527}
528
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500529if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200530 jenkins_run=1
531 umask 0002
532else
533 unset jenkins_run
534fi
535
536# Project scratch location for Trusted Firmware CI
537project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
538project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
539warehouse="${nfs_volume}/warehouse"
540jenkins_url="${JENKINS_URL%/*}"
541jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
542
laurenw-arm35faeaa2021-05-03 14:28:17 -0500543# 11.12 Model revisions
544model_version_11_12="11.12"
545model_build_11_12="38"
546model_flavour_11_12="Linux64_GCC-6.4"
547
laurenw-armafdc3bc2022-09-14 15:31:42 -0500548# 11.16 Model revisions
549model_version_11_16="11.16"
550model_build_11_16="16"
551model_flavour_11_16="Linux64_GCC-6.4"
552
553# 11.17 Model revisions
554model_version_11_17="11.17"
555model_build_11_17="21"
556model_flavour_11_17="Linux64_GCC-9.3"
557
Fathi Boudra422bf772019-12-02 11:10:16 +0200558# Model revisions
laurenw-armafdc3bc2022-09-14 15:31:42 -0500559model_version="${model_version:-11.19}"
560model_build="${model_build:-14}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100561model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200562
563# Model snapshots from filer are not normally not accessible from developer
564# systems. Ignore failures from picking real path for local runs.
565pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
566pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
567
Fathi Boudra422bf772019-12-02 11:10:16 +0200568tforg_gerrit_url="review.trustedfirmware.org"
569
570# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
571# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200572tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
573tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200574tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
575tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500576ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
577ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500578tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200579scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100580scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100581spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
582spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Jimmy Brisson0d5e12c2023-05-16 14:51:51 -0500583tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
584tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
585tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"
586tf_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 +0200587
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500588tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200589tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
590css_downloads="${css_downloads:-$tfa_downloads/css}"
591
Chris Kay52b8d432023-04-27 16:10:57 +0100592# SCP/MCP release binaries.
593scp_mcp_2_11_0_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Chris Kay45b46552023-04-20 13:40:06 +0100594scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.12.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000595
Leonardo Sandoval15676062020-11-19 11:58:09 -0600596linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100597linaro_release="${linaro_release:-$linaro_2001_release}"
Maksims Svecovs94928582023-05-10 15:22:59 +0100598mbedtls_version="${mbedtls_version:-3.4.0}"
Zelalem219df412020-05-17 19:21:20 -0500599
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500600# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000601mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200602
Harrison Mutai013f6332022-02-16 16:06:33 +0000603# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
604# LLVM archive public hosting available at github.com
605llvm_version="${llvm_version:-14.0.0}"
606llvm_dir="$workspace/llvm-$llvm_version"
607llvm_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}"
608
Mark Dykes30138ad2021-11-09 16:48:17 -0600609coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200610coverity_default_checkers=(
611"--all"
612"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200613"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500614"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200615"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200616"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500617"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200618)
619
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500620docker_registry="${docker_registry:-}"
621
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500622# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanand6d0e4ab2023-04-18 11:18:54 +0100623toolchain_version="12.2.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500624
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100625aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500626aarch64_none_elf_prefix="aarch64-none-elf-"
627
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100628arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500629arm_none_eabi_prefix="arm-none-eabi-"
630
Fathi Boudra422bf772019-12-02 11:10:16 +0200631path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500632 "${aarch64_none_elf_dir}/bin"
633 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000634 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500635 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
636 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200637)
638
639ld_library_path_list=(
640)
641
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200642license_path_list=${license_path_list-(
643)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200644
645# Setup various paths
646if upon "$retain_paths"; then
647 # If explicitly requested, retain local paths; apppend CI paths to the
648 # existing ones.
649 op="append" extend_path "PATH" "path_list"
650 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
651 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
652else
653 # Otherwise, prepend CI paths so that they take effect before local ones
654 extend_path "PATH" "path_list"
655 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
656 extend_path "LM_LICENSE_FILE" "license_path_list"
657fi
658
659export LD_LIBRARY_PATH
660export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200661export ARM_TOOL_VARIANT=ult
662
663# vim: set tw=80 sw=8 noet: