blob: dcdbae0486ba80e9d75daf099c96042ec2b82998 [file] [log] [blame]
Fathi Boudra9e402bf2019-12-05 11:16:41 +02001#!/bin/bash
2
Leonardo Sandoval196c8fe2020-07-26 18:02:10 -05003set -ex
4
Leonardo Sandoval3a931b92021-02-05 11:20:09 -06005# Run the given command passed through parameters, if fails, try
6# at most more N-times with a pause of M-seconds until success.
7resilient_cmd() {
8 local cmd="$*"
9 local max_wait=10
10 local sleep_body=2
11 local iter=0
12
13 echo "Waiting for $cmd to complete"
14 while true; do
15 if ${cmd}; then
16 echo "$cmd job finished"
17 break
18 fi
19
20 sleep ${sleep_body}
21
22 iter=$(( iter + 1 ))
23 if [ ${iter} -ge ${max_wait} ]; then
24 return 1
25 fi
26 done
27 return 0
28}
Fathi Boudra9e402bf2019-12-05 11:16:41 +020029
Fathi Boudra7975ca72020-01-28 16:48:40 +020030# FIXME workaround clone_repos.sh script when using gerrit
31unset GERRIT_PROJECT
32unset GERRIT_BRANCH
33unset GERRIT_REFSPEC
34
Fathi Boudra9e402bf2019-12-05 11:16:41 +020035if [ -z "${WORKSPACE}" ]; then
36 ## Local build
37 export WORKSPACE=${PWD}
38fi
39
Fathi Boudra9e402bf2019-12-05 11:16:41 +020040cd ${WORKSPACE}
41
Manish V Badarkhe6f6dab82022-09-29 08:15:13 +010042# coverity-tf-misra: https://projects.linaro.org/browse/TFC-10 pending to
43# be included in OpenCI, hence it is blocklisted for now.
Leonardo Sandoval63fd38f2021-03-26 14:05:03 -060044
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050045blocklist="blocklist.txt"
46cat << EOF > "${blocklist}"
47coverity-tf-misra
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050048EOF
49
Leonardo Sandovalf9a362f2021-03-04 12:02:57 -060050if echo "${TEST_DESC}" | grep -F -f ${blocklist} - ; then
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050051 echo ${TEST_DESC} is blocklisted
52 exit 0
53fi
54
55mkdir -p ${WORKSPACE}/nfs/downloads/mbedtls
56cd ${WORKSPACE}/nfs/downloads/mbedtls
57curl --connect-timeout 5 --retry 5 --retry-delay 1 -sLSO -k -C - ${MBEDTLS_URL}
58export mbedtls_archive=${WORKSPACE}/nfs/downloads/mbedtls/$(ls -1 mbedtls-*.tar.gz)
59
Fathi Boudra9e402bf2019-12-05 11:16:41 +020060# Path to root of CI repository
61ci_root="${WORKSPACE}/tf-a-ci-scripts"
62
Leonardo Sandoval6631c432021-04-14 12:15:38 -050063export tf_downloads="https://downloads.trustedfirmware.org"
64export tfa_downloads="${tf_downloads}/tf-a"
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050065
66# Fetch required firmware/binaries and place it at proper location
Fathi Boudra9e402bf2019-12-05 11:16:41 +020067export nfs_volume="${WORKSPACE}/nfs"
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050068project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw"
Leonardo Sandovalb2e54a92021-11-11 13:53:09 -060069mkdir -p ${project_filer}
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050070
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050071# fetch Juno rootfs, required by fvp
72linaro_2001_release="/nfs/downloads/linaro/20.01"
73cd ${linaro_2001_release}
Leonardo Sandoval3a931b92021-02-05 11:20:09 -060074resilient_cmd curl --connect-timeout 5 --retry 5 --retry-delay 1 -fsSLo \
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050075 lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz \
76 https://releases.linaro.org/openembedded/juno-lsk/latest/lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz
77
Leonardo Sandoval6631c432021-04-14 12:15:38 -050078# export trace code coverage variable
79export coverage_trace_plugin="${tf_downloads}/coverage-plugin/qa-tools/coverage-tool/coverage-plugin/coverage_trace.so"
80
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050081# FIXME: create temporal /arm softlinks.
82# Reason behind is described at
83# https://git.trustedfirmware.org/ci/dockerfiles.git/commit/?id=4e2c2c94e434bc8a9b25f5da7c6018a43db8cb2f
84
85# /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc
86mkdir -p /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update
87ln -s \
88 ${TOOLS_DIR}/bin \
89 /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update/bin
90
Leonardo Sandovale2123b12021-06-11 15:25:08 -050091# /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
92mkdir -p /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-10-2020-q4-major
93ln -s \
94 ${TOOLS_DIR}/gnu-rm/bin \
95 /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-10-2020-q4-major/bin
96
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -050097# /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
98mkdir -p /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu
99ln -s ${TOOLS_DIR}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin \
100 /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin
101
Harrison Mutaidc174472022-02-16 15:05:44 +0000102# CC=/arm/warehouse/Distributions/FA/ARMCompiler/6.18/19/standalone-linux-x86_64-rel/bin/armclang
103# FIXME: link to ARMCompiler 6.17 until 6.18 is available on Open-CI.
104mkdir -p /arm/warehouse/Distributions/FA/ARMCompiler/6.18/19/standalone-linux-x86_64-rel
105ln -s ${TOOLS_DIR}/armclang-6.17/bin \
106 /arm/warehouse/Distributions/FA/ARMCompiler/6.18/19/standalone-linux-x86_64-rel/bin
Fathi Boudra9e402bf2019-12-05 11:16:41 +0200107
108# Mandatory workspace
109export workspace="${workspace:-${WORKSPACE}/workspace}"
110
111# During feature development, we need incremental build, so don't run
112# 'distlcean' on every invocation.
113export dont_clean="${dont_clean:-1}"
114
Fathi Boudra9e402bf2019-12-05 11:16:41 +0200115# Local paths to TF and TFTF repositories
116export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}"
117export tftf_root="${tftf_root:-${WORKSPACE}/tf-a-tests}"
118
119# We'd need to see the terminals during development runs, so no need for
120# automation.
121export test_run="${test_run:-1}"
122
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500123# By default, do not execute any run
124export skip_runs="${skip_runs:-1}"
125
126# set linaro platform release folder
127export linaro_2001_release="file://${linaro_2001_release}"
128
129export docker_registry="${DOCKER_REGISTRY}"
130export armlmd_license_file="${ARMLMD_LICENSE_FILE}"
131export juno_rootfs_url="${JUNO_ROOTFS_URL}"
132
133# Parse TEST_DESC and export test_group & tf_config and & run_config
134test_desc="${test_desc:-$TEST_DESC}"
135test_desc="${test_desc:?}"
136
137# Strip test suffix
138test_desc="${test_desc%%.test}"
139
140lhs="$(echo "$test_desc" | awk -F: '{print $1}')"
141rhs="$(echo "$test_desc" | awk -F: '{print $2}')"
142
Leonardo Sandoval601d8822021-03-17 10:40:06 -0600143test_group="$(echo "$lhs" | awk -F% '{print $2}')"
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500144build_config="$(echo "$lhs" | awk -F% '{print $3}')"
Leonardo Sandoval601d8822021-03-17 10:40:06 -0600145run_config="${rhs%.test}"
Paul Sokolovsky7be2e052021-11-08 14:45:01 +0300146test_config="${TEST_CONFIG}"
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500147
Leonardo Sandoval601d8822021-03-17 10:40:06 -0600148export BUILD_CONFIG="$build_config"
149export RUN_CONFIG="$run_config"
150export TEST_CONFIG="$test_config"
151export TEST_GROUP="$test_group"
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500152
Fathi Boudra9e402bf2019-12-05 11:16:41 +0200153# Run this script bash -x, and it gets passed downstream for debugging
154if echo "$-" | grep -q "x"; then
155 bash_opts="-x"
156fi
157
Leonardo Sandoval601d8822021-03-17 10:40:06 -0600158mkdir -p "${workspace}"
159bash $bash_opts "$ci_root/script/build_package.sh"
Fathi Boudra9e402bf2019-12-05 11:16:41 +0200160
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500161# compress rootfs.bin file
162for a in $(find ${workspace} -type d -name artefacts); do
Leonardo Sandoval60afea52021-03-16 10:48:03 -0600163 for r in $(find $a -type f -name rootfs.bin -or -name busybox.bin); do
Leonardo Sandovaldc2a03a2020-10-05 18:12:19 -0500164 d=$(dirname $r); b=$(basename $r); cd "$d" && gzip "$b"
165 done
166done
167
Fathi Boudra9e402bf2019-12-05 11:16:41 +0200168cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/