blob: 1113d9cb59538258a4f9651c320a09e353803ae8 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
laurenw-arme78b1292024-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
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
Paul Sokolovskyc90cb772023-07-31 14:28:41 +030029 if echo "$TF_GERRIT_BRANCH" | grep -q "lts-v2.8"; then
laurenw-arm8f595d02023-07-10 15:05:43 -050030 source "$ci_root/openci-lts-v2.8-env.sh"
laurenw-arme78b1292024-03-28 12:57:42 -050031 elif echo "$TF_GERRIT_BRANCH" | grep -q "lts-v2.10"; then
32 source "$ci_root/openci-lts-v2.10-env.sh"
laurenw-arm8f595d02023-07-10 15:05:43 -050033 else
34 source "$ci_root/openci-env.sh"
35 fi
Chris Kay73a91b02022-12-19 16:56:51 +000036 elif echo "$JENKINS_URL" | grep -q "ci.staging.trustedfirmware.org"; then
37 source "$ci_root/openci-staging-env.sh"
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020038 fi
39fi
40
Fathi Boudra422bf772019-12-02 11:10:16 +020041# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
42nfs_volume="${nfs_volume:-$NFS_VOLUME}"
43nfs_volume="${nfs_volume:?}"
44
45# Override workspace for local runs
46workspace="${workspace:-$WORKSPACE}"
47workspace="${workspace:?}"
48workspace="$(readlink -f "$workspace")"
49artefacts="$workspace/artefacts"
50
51# pushd and popd outputs the directory stack every time, which could be
52# confusing when shown on the log. Suppress its output.
53pushd() {
54 builtin pushd "$1" &>/dev/null
55}
56popd() {
57 builtin popd &>/dev/null
58}
59
60# Copy a file to the $archive directory
61archive_file() {
62 local f out target md5
63 f="${1:?}"
64
65 out="${archive:?}"
66 [ ! -d "$out" ] && die "$out is not a directory"
67
68 target="$out/$(basename $f)"
69 if [ -f "$target" ]; then
70 # Prevent same file error
71 if [ "$(stat --format=%i "$target")" = \
72 "$(stat --format=%i "$f")" ]; then
73 return
74 fi
75 fi
76
77 md5="$(md5sum "$f" | awk '{print $1}')"
78 cp -t "$out" "$f"
79 echo "Archived: $f (md5: $md5)"
80}
81
82die() {
83 [ "$1" ] && echo "$1" >&2
84 exit 1
85}
86
87# Emit environment variables for the purpose of sourcing from shells and as
88# Jenkins property files. Whether the RHS is quoted depends on "$quote".
89emit_env() {
90 local env_file="${env_file:?}"
91 local var="${1:?}"
92
93 # Value parameter is mandatory, but allow for it to be empty
94 local val="${2?}"
95
96 if upon "$quote"; then
97 val="\"$val\""
98 else
99 # If RHS is not required to be quoted, any white space in it
100 # won't go well with a shell sourcing this file.
101 if echo "$var" | grep -q '\s'; then
102 die "$var: value '$val' has white space"
103 fi
104 fi
105
106 echo "$var=$val" >> "$env_file"
107}
108
Fathi Boudra422bf772019-12-02 11:10:16 +0200109fetch_directory() {
110 local base="$(basename "${url:?}")"
111 local sa
112
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200113 case "${url}" in
114 http*://*)
115 # Have exactly one trailing /
116 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200117
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200118 # Figure out the number of components between hostname and the
119 # final one
120 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
121 sa="${saveas:-$base}"
122 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500123 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200124 --reject="index.html*" "$modified_url"
125 if [ "$sa" != "$base" ]; then
126 mv "$base" "$sa"
127 fi
128 ;;
129 file://*)
130 sa="${saveas:-.}"
131 echo "Fetch: ${url} -> $sa"
132 cp -r "${url#file://}" "$sa"
133 ;;
134 *)
135 sa="${saveas:-.}"
136 echo "Fetch: ${url} -> $sa"
137 cp -r "${url}" "$sa"
138 ;;
139 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200140}
141
142fetch_file() {
143 local url="${url:?}"
144 local sa
145 local saveas
146
147 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200148 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200149 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200150 echo "Fetch: $url -> $saveas"
151 # Use curl to support file protocol
Paul Sokolovsky532a4882023-05-22 15:50:04 +0300152 curl --fail --no-progress-meter --connect-timeout 10 --retry 6 -LS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200153 else
154 sa="${saveas-.}"
155 echo "Fetch: $url -> $sa"
156 cp "$url" "$sa"
157 fi
158}
159
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100160fetch_and_archive() {
161 url=${url:?}
162 filename=${filename:-basename $url}
163
164 url="$url" saveas="$filename" fetch_file
165 archive_file "$filename"
166}
167
168filter_artefacts(){
169 local model_param_file="${model_param_file-$archive/model_params}"
170
171 # Bash doesn't have array values, we have to create references to the
172 # array of artefacts and the artefact filters.
173 declare -ga "$1"
174 declare -n artefacts="$1"
175 declare -n filters="$2"
176
177 for artefact in "${!filters[@]}"; do
178 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
179 artefacts+=("${artefact}")
180 fi
181 done
182}
183
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100184# Generate link to an archived binary.
185gen_bin_url() {
186 local bin_mode="${bin_mode:?}"
187 local bin="${1:?}"
188
189 if upon "$jenkins_run"; then
190 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
191 else
192 echo "file://$workspace/artefacts/$bin_mode/$bin"
193 fi
194}
195
Harrison Mutaid993ce12023-03-27 13:21:28 +0100196get_boot_image() {
197 local image=${image:?}
198 local type=${type:?}
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100199
Harrison Mutaid993ce12023-03-27 13:21:28 +0100200 declare -n image_list=${image_list-${image}_list}
201
202 local url="${image_list[${type}]}"
203
204 url="${url:?}" filename="${image}.bin" fetch_and_archive
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100205}
206
Harrison Mutaid993ce12023-03-27 13:21:28 +0100207get_boot_image_from_fip() {(
208 local url="${url:?}"
209 local image="${image:?}"
210 local output_name="${output_name-bl32.bin}"
211
212 cd "$(mktempdir)"
213
214 extract_fip "$url"
215 mv "$image" "$output_name"
216 archive_file "$output_name"
217)}
218
Chris Kay03ffbe72022-11-17 18:53:50 +0000219# Get the path to the run environment variables file.
220#
221# Run environment variables are the test-specific environment variables
222# configured by the CI's test configuration.
223#
224# Usage: get_run_env_path <archive>
225get_run_env_path() {
226 echo "${1:?}/run/env"
227}
228
229# Get a run environment variable.
230#
231# Run environment variables are the test-specific environment variables
232# configured by the CI's test configuration.
233#
234# Usage: get_run_env <archive> <variable> [default]
235get_run_env() {
236 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
237 . "$(get_run_env_path "${1:?}")"
238 fi
239
240 echo "${!2:-${3}}"
241}
242
243# Get the number of UARTs configured by the current test configuration. This
244# defaults to `4`.
245#
246# Usage: get_num_uarts <archive> [default]
247get_num_uarts() {
248 local default=4
249
250 get_run_env "${1:?}" num_uarts "${2-${default}}"
251}
252
253# Get the ports script configured by the current test configuration. This
254# defaults to `script/default-ports-script.awk`.
255#
256# Usage: get_ports_script <archive> [default]
257get_ports_script() {
258 local default="${ci_root}/script/default-ports-script.awk"
259
260 get_run_env "${1:?}" ports_script "${2-${default}}"
261}
262
263# Get the primary UART configured by the current test configuration. This
264# defaults to `0`.
265#
266# Usage: get_primary_uart <archive> [default]
267get_primary_uart() {
268 local default=0
269
270 get_run_env "${1:?}" primary_uart "${2-${default}}"
271}
272
273# Get the payload UART configured by the current test configuration. This
274# defaults to the primary UART.
275#
276# Usage: get_payload_uart <archive> [default]
277get_payload_uart() {
278 local default="$(get_primary_uart "${1:?}")"
279
280 get_run_env "${1:?}" payload_uart "${2-${default}}"
281}
282
283# Get the path to a UART's environment variable directory.
284#
285# UART environment variables are the UART-specific environment variables
286# configured by the CI's test configuration.
287#
288# Usage: get_uart_env_path <archive> <uart>
289get_uart_env_path() {
290 echo "${1:?}/run/uart${2:?}"
291}
292
293# Get a UART environment variable.
294#
295# UART environment variables are the UART-specific environment variables
296# configured by the CI's test configuration.
297#
298# Usage: get_uart_env <archive> <uart> <variable> [default]
299get_uart_env() {
300 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
301 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
302 else
Chris Kayfab6edc2022-11-17 19:18:32 +0000303 echo "${!3-${4}}"
Chris Kay03ffbe72022-11-17 18:53:50 +0000304 fi
305}
306
307# Get the path to the Expect script for a given UART. This defaults to nothing.
308#
309# Usage: get_uart_expect_script <archive> <uart> [default]
310get_uart_expect_script() {
311 local default=
312
313 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
314}
315
316# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
317#
318# Usage: get_uart_port <archive> <uart> [default]
319get_uart_port() {
320 local default="$(( 5000 + "${2:?}" ))"
321
322 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
323}
324
Chris Kay24d039f2022-11-23 12:53:30 +0000325# Set a UART environment variable.
326#
327# UART environment variables are the UART-specific environment variables
328# configured by the CI's test configuration.
329#
330# Usage: set_uart_env <archive> <uart> <variable> <value>
331set_uart_env() {
332 local path="$(get_uart_env_path "${1:?}" "${2:?}")"
333
334 mkdir -p "${path}" && \
335 echo "${4:?}" > "${path}/${3:?}"
336}
337
338# Set the FVP port for a given UART.
339#
340# Usage: set_uart_port <archive> <uart> <port>
341set_uart_port() {
342 set_uart_env "${1:?}" "${2:?}" port "${3:?}"
343}
344
Fathi Boudra422bf772019-12-02 11:10:16 +0200345# Make a temporary directory/file insdie workspace, so that it doesn't need to
346# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
347mktempdir() {
348 local ws="${workspace:?}"
349
350 mktemp -d --tmpdir="$ws"
351}
352mktempfile() {
353 local ws="${workspace:?}"
354
355 mktemp --tmpdir="$ws"
356}
357
358not_upon() {
359 ! upon "$1"
360}
361
362# Use "$1" as a boolean
363upon() {
364 case "$1" in
365 "" | "0" | "false") return 1;;
366 *) return 0;;
367 esac
368}
369
370# Check if the argument is a URL
371is_url() {
372 echo "$1" | grep -q "://"
373}
374
375# Check if a path is absolute
376is_abs() {
377 [ "${1:0:1}" = "/" ]
378}
379
380# Unset a variable based on its boolean value
381# If foo=, foo will be unset
382# If foo=blah, then leave it as is
383reset_var() {
384 local var="$1"
385 local val="${!var}"
386
387 if [ -z "$val" ]; then
388 unset "$var"
389 else
390 var="$val"
391 fi
392}
393
394default_var() {
395 local var="$1"
396 local val="${!var}"
397 local default="$2"
398
399 if [ -z "$val" ]; then
400 eval "$var=$default"
401 fi
402}
403
404# String various items joined by ":" to form a path. Items are prepended by
405# default; or 'op' can be set to 'append' to have them appended.
406# For example, to set: PATH=foo:bar:baz:$PATH
407extend_path() {
408 local path_var="$1"
409 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500410 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200411 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500412 local sep=':'
413 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200414
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500415 eval "array_val=\"\${$array_var[@]}\""
416 array_val="$(echo ${array_val// /:})"
417
418 [ -z "$path_val" ] && sep=''
419
420 if [ "$op" = "prepend" ]; then
421 array_val="${array_val}${sep}${path_val}"
422 elif [ "$op" = "append" ]; then
423 array_val="${path_val}${sep}${array_val}"
424 fi
425
426 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200427}
428
Chris Kay3d807882022-08-31 16:00:02 +0100429# Expand and evaluate Bash variables and expressions in a file, whose path is
430# given by the first parameter.
431#
432# For example, to expand a file containing the following:
433#
434# My name is ${name}!
435#
436# You might use:
437#
438# name="Chris" expand_template "path-to-my-file.txt"
439#
440# This would yield:
441#
442# My name is Chris!
443#
444# If you need to run multiple expansions on a file (e.g. to fill out information
445# incrementally), then you can escape expansion of a variable with a backslash,
446# e.g. `\${name}`.
447#
448# The expanded output is printed to the standard output stream.
449expand_template() {
450 local path="$1"
451
452 eval "cat <<-EOF
453 $(<${path})
454 EOF"
455}
456
Harrison Mutai013f6332022-02-16 16:06:33 +0000457# Fetch and extract the latest supported version of the LLVM toolchain from
458# a compressed archive file to a target directory, if it is required.
459setup_llvm_toolchain() {
460 link="${1:-$llvm_archive}"
461 archive="${2:-"$workspace/llvm.tar.xz"}"
462 target_dir="${3:-$llvm_dir}"
463
464 if is_arm_jenkins_env || upon "$local_ci"; then
465 url="$link" saveas="$archive" fetch_file
466 mkdir -p $target_dir
467 extract_tarball $archive $target_dir --strip-components=1 -k
468 fi
469}
470
471# Extract files from compressed archive to target directory. Supports .zip,
472# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500473extract_tarball() {
474 local archive="$1"
475 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500476 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500477
478 pushd "$target_dir"
479 case $(file --mime-type -b "$archive") in
480 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500481 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500482 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500483 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500484 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500485 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000486 application/x-xz)
487 tar -x $extra_params -f $archive
488 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500489 esac
Zelalem219df412020-05-17 19:21:20 -0500490 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500491}
492
Gary Morrison999a9d72022-03-14 18:29:06 -0500493# See if execution is done by Jenkins. If called with a parameter,
494# representing a 'domain', e.g. arm.com, it will also check if
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500495# JENKINS_URL contains the latter.
496is_jenkins_env () {
497 local domain="${1-}"
498
499 # check if running under Jenkins, if not, return non-zero
500 # the checks assumes Jenkins executing if JENKINS_HOME is set
501 [ -z "$JENKINS_HOME" ] && return 1
502
503 # if no parameter passed, no more checks, quit
504 [ -z "$domain" ] && return 0
505
506 if echo "$JENKINS_URL" | grep -q "$domain"; then
507 return 0
508 fi
509
510 return 1
511}
512
513
514# Check if execution is under ARM's jenkins
515is_arm_jenkins_env() {
516 local arm_domain="arm.com"
517 return $(is_jenkins_env "$arm_domain")
518}
519
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600520
521# Provide correct linaro cross toolchain based on environment
522set_cross_compile_gcc_linaro_toolchain() {
523 local cross_compile_path="/home/buildslave/tools"
524
525 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600526 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600527
528 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
529}
530
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500531if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200532 jenkins_run=1
533 umask 0002
534else
535 unset jenkins_run
536fi
537
538# Project scratch location for Trusted Firmware CI
539project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
540project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
541warehouse="${nfs_volume}/warehouse"
542jenkins_url="${JENKINS_URL%/*}"
543jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
544
545# Model revisions
Govindraj Raja72fceec2024-06-18 13:34:17 -0500546model_version_11_24="${model_version:-11.24}"
547model_build_11_24="${model_build:-24}"
548
Govindraj Raja5adcd7d2024-06-04 14:50:28 -0500549model_version="${model_version:-11.26}"
550model_build="${model_build:-11}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100551model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200552
553# Model snapshots from filer are not normally not accessible from developer
554# systems. Ignore failures from picking real path for local runs.
555pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
556pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
557
Fathi Boudra422bf772019-12-02 11:10:16 +0200558tforg_gerrit_url="review.trustedfirmware.org"
559
560# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
561# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200562tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
563tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200564tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
565tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500566ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
567ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500568tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200569scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100570scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100571spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
572spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Jimmy Brisson0d5e12c2023-05-16 14:51:51 -0500573tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-$TF_M_TESTS_REPO_URL}"
574tf_m_tests_src_repo_url="${tf_m_tests_src_repo_url:-https://$tforg_gerrit_url/TF-M/tf-m-tests}"
575tf_m_extras_src_repo_url="${tf_m_extras_src_repo_url:-$TF_M_EXTRAS_REPO_URL}"
576tf_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 +0200577
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500578tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200579tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
580css_downloads="${css_downloads:-$tfa_downloads/css}"
581
Chris Kay52b8d432023-04-27 16:10:57 +0100582# SCP/MCP release binaries.
583scp_mcp_2_11_0_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Chris Kay45b46552023-04-20 13:40:06 +0100584scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.12.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000585
Leonardo Sandoval15676062020-11-19 11:58:09 -0600586linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100587linaro_release="${linaro_release:-$linaro_2001_release}"
Jimmy Brissonae9c4f12024-04-16 11:19:56 -0500588mbedtls_version="${mbedtls_version:-3.6.0}"
Zelalem219df412020-05-17 19:21:20 -0500589
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500590# mbedTLS archive public hosting available at github.com
Govindraj Raja827823f2023-02-28 14:19:00 +0000591mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/mbedtls-${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200592
Harrison Mutai013f6332022-02-16 16:06:33 +0000593# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
594# LLVM archive public hosting available at github.com
595llvm_version="${llvm_version:-14.0.0}"
596llvm_dir="$workspace/llvm-$llvm_version"
597llvm_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}"
598
Mark Dykes30138ad2021-11-09 16:48:17 -0600599coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200600coverity_default_checkers=(
601"--all"
602"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200603"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500604"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200605"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200606"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500607"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200608)
609
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500610docker_registry="${docker_registry:-}"
611
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500612# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanand07cec232023-09-07 11:34:44 +0100613toolchain_version="12.3.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500614
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100615aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500616aarch64_none_elf_prefix="aarch64-none-elf-"
617
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100618arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500619arm_none_eabi_prefix="arm-none-eabi-"
620
Fathi Boudra422bf772019-12-02 11:10:16 +0200621path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500622 "${aarch64_none_elf_dir}/bin"
623 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000624 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500625 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
626 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200627)
628
629ld_library_path_list=(
630)
631
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200632license_path_list=${license_path_list-(
633)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200634
635# Setup various paths
636if upon "$retain_paths"; then
637 # If explicitly requested, retain local paths; apppend CI paths to the
638 # existing ones.
639 op="append" extend_path "PATH" "path_list"
640 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
641 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
642else
643 # Otherwise, prepend CI paths so that they take effect before local ones
644 extend_path "PATH" "path_list"
645 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
646 extend_path "LM_LICENSE_FILE" "license_path_list"
647fi
648
649export LD_LIBRARY_PATH
650export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200651export ARM_TOOL_VARIANT=ult
652
653# vim: set tw=80 sw=8 noet: