blob: 8a7c350189d6933422b755fa609feeef14c918aa [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Jayanth Dodderi Chidanandbf7369d2022-04-06 10:59:14 +01003# Copyright (c) 2019-2022, 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
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020019# Optionally source a file containing environmental settings.
20if [ -n "$host_env" ]; then
21 source "$host_env"
22else
23 # Are we running on Arm infrastructure?
Gary Morrison999a9d72022-03-14 18:29:06 -050024 if echo "$JENKINS_URL" | grep -q "oss.arm.com"; then
Sandrine Bailleuxaaaffe02020-08-07 11:15:55 +020025 source "$ci_root/arm-env.sh"
26 fi
27fi
28
Fathi Boudra422bf772019-12-02 11:10:16 +020029# Storage area to host toolchains, rootfs, tools, models, binaries, etc...
30nfs_volume="${nfs_volume:-$NFS_VOLUME}"
31nfs_volume="${nfs_volume:?}"
32
33# Override workspace for local runs
34workspace="${workspace:-$WORKSPACE}"
35workspace="${workspace:?}"
36workspace="$(readlink -f "$workspace")"
37artefacts="$workspace/artefacts"
38
39# pushd and popd outputs the directory stack every time, which could be
40# confusing when shown on the log. Suppress its output.
41pushd() {
42 builtin pushd "$1" &>/dev/null
43}
44popd() {
45 builtin popd &>/dev/null
46}
47
48# Copy a file to the $archive directory
49archive_file() {
50 local f out target md5
51 f="${1:?}"
52
53 out="${archive:?}"
54 [ ! -d "$out" ] && die "$out is not a directory"
55
56 target="$out/$(basename $f)"
57 if [ -f "$target" ]; then
58 # Prevent same file error
59 if [ "$(stat --format=%i "$target")" = \
60 "$(stat --format=%i "$f")" ]; then
61 return
62 fi
63 fi
64
65 md5="$(md5sum "$f" | awk '{print $1}')"
66 cp -t "$out" "$f"
67 echo "Archived: $f (md5: $md5)"
68}
69
70die() {
71 [ "$1" ] && echo "$1" >&2
72 exit 1
73}
74
75# Emit environment variables for the purpose of sourcing from shells and as
76# Jenkins property files. Whether the RHS is quoted depends on "$quote".
77emit_env() {
78 local env_file="${env_file:?}"
79 local var="${1:?}"
80
81 # Value parameter is mandatory, but allow for it to be empty
82 local val="${2?}"
83
84 if upon "$quote"; then
85 val="\"$val\""
86 else
87 # If RHS is not required to be quoted, any white space in it
88 # won't go well with a shell sourcing this file.
89 if echo "$var" | grep -q '\s'; then
90 die "$var: value '$val' has white space"
91 fi
92 fi
93
94 echo "$var=$val" >> "$env_file"
95}
96
Fathi Boudra422bf772019-12-02 11:10:16 +020097fetch_directory() {
98 local base="$(basename "${url:?}")"
99 local sa
100
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200101 case "${url}" in
102 http*://*)
103 # Have exactly one trailing /
104 local modified_url="$(echo "${url}" | sed 's#/*$##')/"
Fathi Boudra422bf772019-12-02 11:10:16 +0200105
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200106 # Figure out the number of components between hostname and the
107 # final one
108 local cut_dirs="$(echo "$modified_url" | awk -F/ '{print NF - 5}')"
109 sa="${saveas:-$base}"
110 echo "Fetch: $modified_url -> $sa"
laurenw-arm2d62c712022-09-13 14:27:15 -0500111 wget -rq -nH --cut-dirs="$cut_dirs" --no-parent -e robots=off \
Fathi Boudradd31e7b2020-01-29 15:44:42 +0200112 --reject="index.html*" "$modified_url"
113 if [ "$sa" != "$base" ]; then
114 mv "$base" "$sa"
115 fi
116 ;;
117 file://*)
118 sa="${saveas:-.}"
119 echo "Fetch: ${url} -> $sa"
120 cp -r "${url#file://}" "$sa"
121 ;;
122 *)
123 sa="${saveas:-.}"
124 echo "Fetch: ${url} -> $sa"
125 cp -r "${url}" "$sa"
126 ;;
127 esac
Fathi Boudra422bf772019-12-02 11:10:16 +0200128}
129
130fetch_file() {
131 local url="${url:?}"
132 local sa
133 local saveas
134
135 if is_url "$url"; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200136 saveas="${saveas-"$(basename "$url")"}"
Sandrine Bailleux3da4bd12020-08-06 16:18:36 +0200137 sa="${saveas+-o $saveas}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200138 echo "Fetch: $url -> $saveas"
139 # Use curl to support file protocol
Sandrine Bailleux2a05b9c2021-02-25 13:52:21 +0100140 curl --fail -sLS $sa "$url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200141 else
142 sa="${saveas-.}"
143 echo "Fetch: $url -> $sa"
144 cp "$url" "$sa"
145 fi
146}
147
Harrison Mutaia197d5d2022-09-15 13:45:21 +0100148fetch_and_archive() {
149 url=${url:?}
150 filename=${filename:-basename $url}
151
152 url="$url" saveas="$filename" fetch_file
153 archive_file "$filename"
154}
155
156filter_artefacts(){
157 local model_param_file="${model_param_file-$archive/model_params}"
158
159 # Bash doesn't have array values, we have to create references to the
160 # array of artefacts and the artefact filters.
161 declare -ga "$1"
162 declare -n artefacts="$1"
163 declare -n filters="$2"
164
165 for artefact in "${!filters[@]}"; do
166 if grep -E -q "${filters[${artefact}]}" "$model_param_file"; then
167 artefacts+=("${artefact}")
168 fi
169 done
170}
171
172gen_lava_job_def() {
173 local yaml_template_file="${yaml_template_file:?}"
174 local yaml_file="${yaml_file:?}"
175 local yaml_job_file="${yaml_job_file}"
176
177 # Bash doesn't have array values, we have to create references to the
178 # array of artefacts and their urls.
179 declare -n artefacts="$1"
180 declare -n artefact_urls="$2"
181
182 readarray -t boot_arguments < "${lava_model_params}"
183
184 # Generate the LAVA job definition, minus the test expectations
185 expand_template "${yaml_template_file}" > "${yaml_file}"
186
187 if [[ ! $model =~ "qemu" ]]; then
188 # Append expect commands into the job definition through
189 # test-interactive commands
190 gen_fvp_yaml_expect >> "$yaml_file"
191 fi
192
193 # create job.yaml
194 cp "$yaml_file" "$yaml_job_file"
195
196 # archive both yamls
197 archive_file "$yaml_file"
198 archive_file "$yaml_job_file"
199}
200
201gen_lava_model_params() {
202 local lava_model_params="${lava_model_params:?}"
203 declare -n macros="$1"
204
205 # Derive LAVA model parameters from the non-LAVA ones
206 cp "${archive}/model_params" "${lava_model_params}"
207
208 if [[ $model =~ "qemu" ]]; then
209 # Strip the model parameters of parameters already specified in the deploy
210 # overlay and job context.
211 sed -i '/-M/d;/kernel/d;/initrd/d;/bios/d;/cpu/d;/^[[:space:]]*$/d' \
212 $lava_model_params
213 elif [[ ! $model =~ "qemu" ]]; then
214 # FIXME find a way to properly match FVP configurations.
215 # Ensure braces in the FVP model parameters are not accidentally
216 # interpreted as LAVA macros.
217 sed -i -e 's/{/{{/g' "${lava_model_params}"
218 sed -i -e 's/}/}}/g' "${lava_model_params}"
219 else
220 echo "Unsupported emulated platform $model."
221 fi
222
223 # LAVA expects binary paths as macros, i.e. `{X}` instead of `x.bin`, so
224 # replace the file paths in our pre-generated model parameters.
225 for regex in "${!macros[@]}"; do
226 sed -i -e "s!${regex}!${macros[${regex}]}!" "${lava_model_params}"
227 done
228}
229
230gen_yaml_template() {
231 local target="${target-fvp}"
232 local yaml_template_file="${yaml_template_file-$workspace/${target}_template.yaml}"
233
234 local payload_type="${payload_type:?}"
235
236 cp "${ci_root}/script/lava-templates/${target}-${payload_type:?}.yaml" \
237 "${yaml_template_file}"
238
239 archive_file "$yaml_template_file"
240}
241
242# Generate link to an archived binary.
243gen_bin_url() {
244 local bin_mode="${bin_mode:?}"
245 local bin="${1:?}"
246
247 if upon "$jenkins_run"; then
248 echo "$jenkins_url/job/$JOB_NAME/$BUILD_NUMBER/artifact/artefacts/$bin_mode/$bin"
249 else
250 echo "file://$workspace/artefacts/$bin_mode/$bin"
251 fi
252}
253
254get_kernel() {
255 local kernel_type="${kernel_type:?}"
256 local url="${plat_kernel_list[$kernel_type]}"
257
258 url="${url:?}" filename="kernel.bin" fetch_and_archive
259}
260
Chris Kay03ffbe72022-11-17 18:53:50 +0000261# Get the path to the run environment variables file.
262#
263# Run environment variables are the test-specific environment variables
264# configured by the CI's test configuration.
265#
266# Usage: get_run_env_path <archive>
267get_run_env_path() {
268 echo "${1:?}/run/env"
269}
270
271# Get a run environment variable.
272#
273# Run environment variables are the test-specific environment variables
274# configured by the CI's test configuration.
275#
276# Usage: get_run_env <archive> <variable> [default]
277get_run_env() {
278 if [ -f "$(get_run_env_path "${1:?}")" ] && [ ! -v "${2:?}" ]; then
279 . "$(get_run_env_path "${1:?}")"
280 fi
281
282 echo "${!2:-${3}}"
283}
284
285# Get the number of UARTs configured by the current test configuration. This
286# defaults to `4`.
287#
288# Usage: get_num_uarts <archive> [default]
289get_num_uarts() {
290 local default=4
291
292 get_run_env "${1:?}" num_uarts "${2-${default}}"
293}
294
295# Get the ports script configured by the current test configuration. This
296# defaults to `script/default-ports-script.awk`.
297#
298# Usage: get_ports_script <archive> [default]
299get_ports_script() {
300 local default="${ci_root}/script/default-ports-script.awk"
301
302 get_run_env "${1:?}" ports_script "${2-${default}}"
303}
304
305# Get the primary UART configured by the current test configuration. This
306# defaults to `0`.
307#
308# Usage: get_primary_uart <archive> [default]
309get_primary_uart() {
310 local default=0
311
312 get_run_env "${1:?}" primary_uart "${2-${default}}"
313}
314
315# Get the payload UART configured by the current test configuration. This
316# defaults to the primary UART.
317#
318# Usage: get_payload_uart <archive> [default]
319get_payload_uart() {
320 local default="$(get_primary_uart "${1:?}")"
321
322 get_run_env "${1:?}" payload_uart "${2-${default}}"
323}
324
325# Get the path to a UART's environment variable directory.
326#
327# UART environment variables are the UART-specific environment variables
328# configured by the CI's test configuration.
329#
330# Usage: get_uart_env_path <archive> <uart>
331get_uart_env_path() {
332 echo "${1:?}/run/uart${2:?}"
333}
334
335# Get a UART environment variable.
336#
337# UART environment variables are the UART-specific environment variables
338# configured by the CI's test configuration.
339#
340# Usage: get_uart_env <archive> <uart> <variable> [default]
341get_uart_env() {
342 if [ ! -v "${3:?}" ] && [ -f "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}" ]; then
343 cat "$(get_uart_env_path "${1:?}" "${2:?}")/${3:?}"
344 else
345 echo "${!3:?-${4}}"
346 fi
347}
348
349# Get the path to the Expect script for a given UART. This defaults to nothing.
350#
351# Usage: get_uart_expect_script <archive> <uart> [default]
352get_uart_expect_script() {
353 local default=
354
355 get_uart_env "${1:?}" "${2:?}" expect "${3-${default}}"
356}
357
358# Get the FVP port for a given UART. This defaults to `5000 + ${uart}`.
359#
360# Usage: get_uart_port <archive> <uart> [default]
361get_uart_port() {
362 local default="$(( 5000 + "${2:?}" ))"
363
364 get_uart_env "${1:?}" "${2:?}" port "${3-${default}}"
365}
366
Fathi Boudra422bf772019-12-02 11:10:16 +0200367# Make a temporary directory/file insdie workspace, so that it doesn't need to
368# be cleaned up. Jenkins is setup to clean up workspace before a job runs.
369mktempdir() {
370 local ws="${workspace:?}"
371
372 mktemp -d --tmpdir="$ws"
373}
374mktempfile() {
375 local ws="${workspace:?}"
376
377 mktemp --tmpdir="$ws"
378}
379
380not_upon() {
381 ! upon "$1"
382}
383
384# Use "$1" as a boolean
385upon() {
386 case "$1" in
387 "" | "0" | "false") return 1;;
388 *) return 0;;
389 esac
390}
391
392# Check if the argument is a URL
393is_url() {
394 echo "$1" | grep -q "://"
395}
396
397# Check if a path is absolute
398is_abs() {
399 [ "${1:0:1}" = "/" ]
400}
401
402# Unset a variable based on its boolean value
403# If foo=, foo will be unset
404# If foo=blah, then leave it as is
405reset_var() {
406 local var="$1"
407 local val="${!var}"
408
409 if [ -z "$val" ]; then
410 unset "$var"
411 else
412 var="$val"
413 fi
414}
415
416default_var() {
417 local var="$1"
418 local val="${!var}"
419 local default="$2"
420
421 if [ -z "$val" ]; then
422 eval "$var=$default"
423 fi
424}
425
426# String various items joined by ":" to form a path. Items are prepended by
427# default; or 'op' can be set to 'append' to have them appended.
428# For example, to set: PATH=foo:bar:baz:$PATH
429extend_path() {
430 local path_var="$1"
431 local array_var="$2"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500432 local path_val="${!path_var}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200433 local op="${op:-prepend}"
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500434 local sep=':'
435 local array_val
Fathi Boudra422bf772019-12-02 11:10:16 +0200436
Leonardo Sandoval2af93202020-07-16 17:29:18 -0500437 eval "array_val=\"\${$array_var[@]}\""
438 array_val="$(echo ${array_val// /:})"
439
440 [ -z "$path_val" ] && sep=''
441
442 if [ "$op" = "prepend" ]; then
443 array_val="${array_val}${sep}${path_val}"
444 elif [ "$op" = "append" ]; then
445 array_val="${path_val}${sep}${array_val}"
446 fi
447
448 eval "$path_var=\"$array_val\""
Fathi Boudra422bf772019-12-02 11:10:16 +0200449}
450
Chris Kay3d807882022-08-31 16:00:02 +0100451# Expand and evaluate Bash variables and expressions in a file, whose path is
452# given by the first parameter.
453#
454# For example, to expand a file containing the following:
455#
456# My name is ${name}!
457#
458# You might use:
459#
460# name="Chris" expand_template "path-to-my-file.txt"
461#
462# This would yield:
463#
464# My name is Chris!
465#
466# If you need to run multiple expansions on a file (e.g. to fill out information
467# incrementally), then you can escape expansion of a variable with a backslash,
468# e.g. `\${name}`.
469#
470# The expanded output is printed to the standard output stream.
471expand_template() {
472 local path="$1"
473
474 eval "cat <<-EOF
475 $(<${path})
476 EOF"
477}
478
Harrison Mutai013f6332022-02-16 16:06:33 +0000479# Fetch and extract the latest supported version of the LLVM toolchain from
480# a compressed archive file to a target directory, if it is required.
481setup_llvm_toolchain() {
482 link="${1:-$llvm_archive}"
483 archive="${2:-"$workspace/llvm.tar.xz"}"
484 target_dir="${3:-$llvm_dir}"
485
486 if is_arm_jenkins_env || upon "$local_ci"; then
487 url="$link" saveas="$archive" fetch_file
488 mkdir -p $target_dir
489 extract_tarball $archive $target_dir --strip-components=1 -k
490 fi
491}
492
493# Extract files from compressed archive to target directory. Supports .zip,
494# .tar.gz, and tar.xf format
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500495extract_tarball() {
496 local archive="$1"
497 local target_dir="$2"
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500498 local extra_params="${3:-}"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500499
500 pushd "$target_dir"
501 case $(file --mime-type -b "$archive") in
502 application/gzip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500503 tar -xz $extra_params -f $archive
Zelalem219df412020-05-17 19:21:20 -0500504 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500505 application/zip)
Leonardo Sandovalec9e16c2020-09-09 14:32:40 -0500506 unzip -q $extra_params $archive
Zelalem219df412020-05-17 19:21:20 -0500507 ;;
Harrison Mutai013f6332022-02-16 16:06:33 +0000508 application/x-xz)
509 tar -x $extra_params -f $archive
510 ;;
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500511 esac
Zelalem219df412020-05-17 19:21:20 -0500512 popd "$target_dir"
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500513}
514
Gary Morrison999a9d72022-03-14 18:29:06 -0500515# See if execution is done by Jenkins. If called with a parameter,
516# representing a 'domain', e.g. arm.com, it will also check if
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500517# JENKINS_URL contains the latter.
518is_jenkins_env () {
519 local domain="${1-}"
520
521 # check if running under Jenkins, if not, return non-zero
522 # the checks assumes Jenkins executing if JENKINS_HOME is set
523 [ -z "$JENKINS_HOME" ] && return 1
524
525 # if no parameter passed, no more checks, quit
526 [ -z "$domain" ] && return 0
527
528 if echo "$JENKINS_URL" | grep -q "$domain"; then
529 return 0
530 fi
531
532 return 1
533}
534
535
536# Check if execution is under ARM's jenkins
537is_arm_jenkins_env() {
538 local arm_domain="arm.com"
539 return $(is_jenkins_env "$arm_domain")
540}
541
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600542
543# Provide correct linaro cross toolchain based on environment
544set_cross_compile_gcc_linaro_toolchain() {
545 local cross_compile_path="/home/buildslave/tools"
546
547 # if under arm enviroment, overide cross-compilation path
Madhukar Pappireddy21a5e672021-03-08 17:49:45 -0600548 is_arm_jenkins_env || upon "$local_ci" && cross_compile_path="/arm/pdsw/tools"
Leonardo Sandovalfeae3a22020-11-17 16:53:59 -0600549
550 echo "${cross_compile_path}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
551}
552
Leonardo Sandoval795b6212020-08-14 16:20:00 -0500553if is_jenkins_env; then
Fathi Boudra422bf772019-12-02 11:10:16 +0200554 jenkins_run=1
555 umask 0002
556else
557 unset jenkins_run
558fi
559
560# Project scratch location for Trusted Firmware CI
561project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
562project_scratch="${PROJECT_SCRATCH:-$project_filer/ci-workspace}"
563warehouse="${nfs_volume}/warehouse"
564jenkins_url="${JENKINS_URL%/*}"
565jenkins_url="${jenkins_url:-https://ci.trustedfirmware.org/}"
566
laurenw-arm35faeaa2021-05-03 14:28:17 -0500567# 11.12 Model revisions
568model_version_11_12="11.12"
569model_build_11_12="38"
570model_flavour_11_12="Linux64_GCC-6.4"
571
laurenw-armafdc3bc2022-09-14 15:31:42 -0500572# 11.16 Model revisions
573model_version_11_16="11.16"
574model_build_11_16="16"
575model_flavour_11_16="Linux64_GCC-6.4"
576
577# 11.17 Model revisions
578model_version_11_17="11.17"
579model_build_11_17="21"
580model_flavour_11_17="Linux64_GCC-9.3"
581
Fathi Boudra422bf772019-12-02 11:10:16 +0200582# Model revisions
laurenw-armafdc3bc2022-09-14 15:31:42 -0500583model_version="${model_version:-11.19}"
584model_build="${model_build:-14}"
Maksims Svecovs5c542512022-03-29 10:13:05 +0100585model_flavour="${model_flavour:-Linux64_GCC-9.3}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200586
587# Model snapshots from filer are not normally not accessible from developer
588# systems. Ignore failures from picking real path for local runs.
589pinned_cortex="$(readlink -f ${pinned_cortex:-$project_filer/models/cortex})" || true
590pinned_css="$(readlink -f ${pinned_css:-$project_filer/models/css})" || true
591
Fathi Boudra422bf772019-12-02 11:10:16 +0200592tforg_gerrit_url="review.trustedfirmware.org"
593
594# Repository URLs. We're using anonymous HTTP as they appear to be faster rather
595# than any scheme with authentication.
Fathi Boudra422bf772019-12-02 11:10:16 +0200596tf_src_repo_url="${tf_src_repo_url:-$TF_SRC_REPO_URL}"
597tf_src_repo_url="${tf_src_repo_url:-https://$tforg_gerrit_url/TF-A/trusted-firmware-a}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200598tftf_src_repo_url="${tftf_src_repo_url:-$TFTF_SRC_REPO_URL}"
599tftf_src_repo_url="${tftf_src_repo_url:-https://$tforg_gerrit_url/TF-A/tf-a-tests}"
Jimmy Brisson29ca0a02020-09-22 16:15:35 -0500600ci_src_repo_url="${ci_src_repo_url:-$CI_SRC_REPO_URL}"
601ci_src_repo_url="${ci_src_repo_url:-https://$tforg_gerrit_url/ci/tf-a-ci-scripts}"
Zelalemdd655272020-10-06 16:29:05 -0500602tf_ci_repo_url="$ci_src_repo_url"
Fathi Boudra422bf772019-12-02 11:10:16 +0200603scp_src_repo_url="${scp_src_repo_url:-$SCP_SRC_REPO_URL}"
Girish Pathak97f7ad42020-08-27 11:38:15 +0100604scp_src_repo_url="${scp_src_repo_url:-$scp_src_repo_default}"
Olivier Deprez965a7792019-12-16 14:09:03 +0100605spm_src_repo_url="${spm_src_repo_url:-$SPM_SRC_REPO_URL}"
606spm_src_repo_url="${spm_src_repo_url:-https://$tforg_gerrit_url/hafnium/hafnium}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200607
Leonardo Sandovald98f8332021-04-13 16:46:38 -0500608tf_downloads="${tf_downloads:-file:///downloads/}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200609tfa_downloads="${tfa_downloads:-file:///downloads/tf-a}"
610css_downloads="${css_downloads:-$tfa_downloads/css}"
611
Jayanth Dodderi Chidanandbf7369d2022-04-06 10:59:14 +0100612# SCP/MCP v2.10.0 release binaries.
Manish V Badarkhe83e4b8d2022-10-26 12:02:41 +0100613scp_mcp_downloads="${scp_mcp_downloads:-$tfa_downloads/css_scp_2.11.0}"
Alexei Fedorov9e4473d2020-11-04 10:13:07 +0000614
Leonardo Sandoval15676062020-11-19 11:58:09 -0600615linaro_2001_release="${linaro_2001_release:-$tfa_downloads/linaro/20.01}"
Alexei Fedorove405cc32020-09-30 18:13:55 +0100616linaro_release="${linaro_release:-$linaro_2001_release}"
Daniel Boulbyb63dd8c2022-09-23 11:55:20 +0100617mbedtls_version="${mbedtls_version:-2.28.1}"
Zelalem219df412020-05-17 19:21:20 -0500618
Madhukar Pappireddy4b686cf2020-03-31 13:05:14 -0500619# mbedTLS archive public hosting available at github.com
Sandrine Bailleuxdf823892022-04-22 13:27:45 +0200620mbedtls_archive="${mbedtls_archive:-https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v${mbedtls_version}.tar.gz}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200621
Harrison Mutai013f6332022-02-16 16:06:33 +0000622# FIXME: workaround to allow all on-prem host machines to access the latest LLVM
623# LLVM archive public hosting available at github.com
624llvm_version="${llvm_version:-14.0.0}"
625llvm_dir="$workspace/llvm-$llvm_version"
626llvm_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}"
627
Mark Dykes30138ad2021-11-09 16:48:17 -0600628coverity_path="${coverity_path:-${nfs_volume}/tools/coverity/static-analysis/2020.12}"
Fathi Boudra422bf772019-12-02 11:10:16 +0200629coverity_default_checkers=(
630"--all"
631"--checker-option DEADCODE:no_dead_default:true"
Fathi Boudra422bf772019-12-02 11:10:16 +0200632"--enable AUDIT.SPECULATIVE_EXECUTION_DATA_LEAK"
Zelalem219df412020-05-17 19:21:20 -0500633"--enable ENUM_AS_BOOLEAN"
Fathi Boudra422bf772019-12-02 11:10:16 +0200634"--enable-constraint-fpp"
Fathi Boudra422bf772019-12-02 11:10:16 +0200635"--ticker-mode none"
Zelalem219df412020-05-17 19:21:20 -0500636"--hfa"
Fathi Boudra422bf772019-12-02 11:10:16 +0200637)
638
Leonardo Sandovald76d1e22020-10-06 16:02:52 -0500639docker_registry="${docker_registry:-}"
640
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500641# Define toolchain version and toolchain binary paths
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100642toolchain_version="11.3.rel1"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500643
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100644aarch64_none_elf_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-aarch64-none-elf"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500645aarch64_none_elf_prefix="aarch64-none-elf-"
646
Jayanth Dodderi Chidanandcc4d2342022-09-12 14:44:21 +0100647arm_none_eabi_dir="${nfs_volume}/pdsw/tools/arm-gnu-toolchain-${toolchain_version}-x86_64-arm-none-eabi"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500648arm_none_eabi_prefix="arm-none-eabi-"
649
Fathi Boudra422bf772019-12-02 11:10:16 +0200650path_list=(
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500651 "${aarch64_none_elf_dir}/bin"
652 "${arm_none_eabi_dir}/bin"
Harrison Mutai013f6332022-02-16 16:06:33 +0000653 "${llvm_dir}/bin"
Leonardo Sandoval1c24ae52020-07-08 11:47:23 -0500654 "${nfs_volume}/pdsw/tools/gcc-arm-none-eabi-5_4-2016q3/bin"
655 "$coverity_path/bin"
Fathi Boudra422bf772019-12-02 11:10:16 +0200656)
657
658ld_library_path_list=(
659)
660
Sandrine Bailleuxa6a1d6e2020-08-07 10:24:17 +0200661license_path_list=${license_path_list-(
662)}
Fathi Boudra422bf772019-12-02 11:10:16 +0200663
664# Setup various paths
665if upon "$retain_paths"; then
666 # If explicitly requested, retain local paths; apppend CI paths to the
667 # existing ones.
668 op="append" extend_path "PATH" "path_list"
669 op="append" extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
670 op="append" extend_path "LM_LICENSE_FILE" "license_path_list"
671else
672 # Otherwise, prepend CI paths so that they take effect before local ones
673 extend_path "PATH" "path_list"
674 extend_path "LD_LIBRARY_PATH" "ld_library_path_list"
675 extend_path "LM_LICENSE_FILE" "license_path_list"
676fi
677
678export LD_LIBRARY_PATH
679export LM_LICENSE_FILE
Fathi Boudra422bf772019-12-02 11:10:16 +0200680export ARM_TOOL_VARIANT=ult
681
682# vim: set tw=80 sw=8 noet: