Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Leonardo Sandoval | 196c8fe | 2020-07-26 18:02:10 -0500 | [diff] [blame] | 3 | set -ex |
| 4 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 5 | |
Fathi Boudra | 7975ca7 | 2020-01-28 16:48:40 +0200 | [diff] [blame] | 6 | # FIXME workaround clone_repos.sh script when using gerrit |
| 7 | unset GERRIT_PROJECT |
| 8 | unset GERRIT_BRANCH |
| 9 | unset GERRIT_REFSPEC |
| 10 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 11 | if [ -z "${WORKSPACE}" ]; then |
| 12 | ## Local build |
| 13 | export WORKSPACE=${PWD} |
| 14 | fi |
| 15 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 16 | cd ${WORKSPACE} |
| 17 | |
Leonardo Sandoval | dc2a03a | 2020-10-05 18:12:19 -0500 | [diff] [blame^] | 18 | # Several test descriptions are pending to be included in OpenCI, so for the moment |
| 19 | # blocklist these. |
| 20 | blocklist="blocklist.txt" |
| 21 | cat << EOF > "${blocklist}" |
| 22 | coverity-tf-misra |
| 23 | tf-l2-boot-tests-juno%juno-tbb-mbedtls-romlib,juno-default,nil,nil:juno-tftf-romlib |
| 24 | EOF |
| 25 | |
| 26 | if echo "${TEST_DESC}" | grep -f ${blocklist} - ; then |
| 27 | echo ${TEST_DESC} is blocklisted |
| 28 | exit 0 |
| 29 | fi |
| 30 | |
| 31 | mkdir -p ${WORKSPACE}/nfs/downloads/mbedtls |
| 32 | cd ${WORKSPACE}/nfs/downloads/mbedtls |
| 33 | curl --connect-timeout 5 --retry 5 --retry-delay 1 -sLSO -k -C - ${MBEDTLS_URL} |
| 34 | export mbedtls_archive=${WORKSPACE}/nfs/downloads/mbedtls/$(ls -1 mbedtls-*.tar.gz) |
| 35 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 36 | # Path to root of CI repository |
| 37 | ci_root="${WORKSPACE}/tf-a-ci-scripts" |
| 38 | |
Leonardo Sandoval | dc2a03a | 2020-10-05 18:12:19 -0500 | [diff] [blame^] | 39 | # FIXME: node bionic-amd64-tf-a-build does not set correctly PATH=$TOOLS_DIR/bin:$PATH |
| 40 | TOOLS_DIR=/home/buildslave/tools |
| 41 | export PATH=${TOOLS_DIR}/bin:${PATH} |
| 42 | |
| 43 | export tfa_downloads="https://downloads.trustedfirmware.org/tf-a" |
| 44 | |
| 45 | # Fetch required firmware/binaries and place it at proper location |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 46 | export nfs_volume="${WORKSPACE}/nfs" |
Leonardo Sandoval | dc2a03a | 2020-10-05 18:12:19 -0500 | [diff] [blame^] | 47 | project_filer="${nfs_volume}/projectscratch/ssg/trusted-fw" |
| 48 | for d in spm spm-10-23-2020; do |
| 49 | mkdir -p ${project_filer}/ci-files/$d |
| 50 | cd ${project_filer}/ci-files/$d |
| 51 | curl --connect-timeout 5 --retry 5 --retry-delay 1 -fsSLo \ |
| 52 | download.json \ |
| 53 | ${tfa_downloads}/$d/?export=json |
| 54 | for f in $(cat download.json | jq .files[].Url | sed s/\"//g); do |
| 55 | curl --connect-timeout 5 --retry 5 --retry-delay 1 -fsSLo $(basename $f) $f |
| 56 | done |
| 57 | done |
| 58 | |
| 59 | # FIXME: place below code in above loop |
| 60 | # fetch https://downloads.trustedfirmware.org/tf-a/dummy-crypto-lib.tar |
| 61 | cd ${project_filer} |
| 62 | curl --connect-timeout 5 --retry 5 --retry-delay 1 -fsSLo \ |
| 63 | dummy-crypto-lib.tar \ |
| 64 | https://downloads.trustedfirmware.org/tf-a/dummy-crypto-lib.tar |
| 65 | tar xf dummy-crypto-lib.tar |
| 66 | |
| 67 | # fetch Juno rootfs, required by fvp |
| 68 | linaro_2001_release="/nfs/downloads/linaro/20.01" |
| 69 | cd ${linaro_2001_release} |
| 70 | curl --connect-timeout 5 --retry 5 --retry-delay 1 -fsSLo \ |
| 71 | lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz \ |
| 72 | https://releases.linaro.org/openembedded/juno-lsk/latest/lt-vexpress64-openembedded_minimal-armv8-gcc-5.2_20170127-761.img.gz |
| 73 | |
| 74 | # FIXME: create temporal /arm softlinks. |
| 75 | # Reason behind is described at |
| 76 | # https://git.trustedfirmware.org/ci/dockerfiles.git/commit/?id=4e2c2c94e434bc8a9b25f5da7c6018a43db8cb2f |
| 77 | |
| 78 | # /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc |
| 79 | mkdir -p /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update |
| 80 | ln -s \ |
| 81 | ${TOOLS_DIR}/bin \ |
| 82 | /arm/pdsw/downloads/scp-models/tools/gcc-arm-none-eabi-9-2020-q2-update/bin |
| 83 | |
| 84 | # /arm/projectscratch/ssg/trusted-fw/dummy-crypto-lib |
| 85 | mkdir -p /arm/projectscratch/ssg/trusted-fw |
| 86 | ln -s \ |
| 87 | ${project_filer}/dummy-crypto-lib \ |
| 88 | /arm/projectscratch/ssg/trusted-fw/dummy-crypto-lib |
| 89 | |
| 90 | |
| 91 | # /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- |
| 92 | mkdir -p /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu |
| 93 | ln -s ${TOOLS_DIR}/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin \ |
| 94 | /arm/pdsw/tools/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin |
| 95 | |
| 96 | # CC=/arm/warehouse/Distributions/FA/ARMCompiler/6.8/25/standalone-linux-x86_64-rel/bin/armclang |
| 97 | mkdir -p /arm/warehouse/Distributions/FA/ARMCompiler/6.8/25/standalone-linux-x86_64-rel |
| 98 | ln -s ${TOOLS_DIR}/armclang-6.8/bin \ |
| 99 | /arm/warehouse/Distributions/FA/ARMCompiler/6.8/25/standalone-linux-x86_64-rel/bin |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 100 | |
| 101 | # Mandatory workspace |
| 102 | export workspace="${workspace:-${WORKSPACE}/workspace}" |
| 103 | |
| 104 | # During feature development, we need incremental build, so don't run |
| 105 | # 'distlcean' on every invocation. |
| 106 | export dont_clean="${dont_clean:-1}" |
| 107 | |
| 108 | # During feature development, we typically only build in debug mode. |
| 109 | export bin_mode="${bin_mode:-debug}" |
| 110 | |
| 111 | # Local paths to TF and TFTF repositories |
| 112 | export tf_root="${tf_root:-${WORKSPACE}/trusted-firmware-a}" |
| 113 | export tftf_root="${tftf_root:-${WORKSPACE}/tf-a-tests}" |
| 114 | |
| 115 | # We'd need to see the terminals during development runs, so no need for |
| 116 | # automation. |
| 117 | export test_run="${test_run:-1}" |
| 118 | |
Leonardo Sandoval | dc2a03a | 2020-10-05 18:12:19 -0500 | [diff] [blame^] | 119 | # By default, do not execute any run |
| 120 | export skip_runs="${skip_runs:-1}" |
| 121 | |
| 122 | # set linaro platform release folder |
| 123 | export linaro_2001_release="file://${linaro_2001_release}" |
| 124 | |
| 125 | export docker_registry="${DOCKER_REGISTRY}" |
| 126 | export armlmd_license_file="${ARMLMD_LICENSE_FILE}" |
| 127 | export juno_rootfs_url="${JUNO_ROOTFS_URL}" |
| 128 | |
| 129 | # Parse TEST_DESC and export test_group & tf_config and & run_config |
| 130 | test_desc="${test_desc:-$TEST_DESC}" |
| 131 | test_desc="${test_desc:?}" |
| 132 | |
| 133 | # Strip test suffix |
| 134 | test_desc="${test_desc%%.test}" |
| 135 | |
| 136 | lhs="$(echo "$test_desc" | awk -F: '{print $1}')" |
| 137 | rhs="$(echo "$test_desc" | awk -F: '{print $2}')" |
| 138 | |
| 139 | export test_group="$(echo "$lhs" | awk -F% '{print $2}')" |
| 140 | |
| 141 | # Test descriptors are always generated in the following order: |
| 142 | # tf_config, tftf_config, scp_config, scp_tools |
| 143 | build_config="$(echo "$lhs" | awk -F% '{print $3}')" |
| 144 | export tf_config="$(echo "${build_config}" | awk -F, '{print $1}')" |
| 145 | export tftf_config="$(echo "${build_config}" | awk -F, '{print $2}')" |
| 146 | export scp_config="$(echo "${build_config}" | awk -F, '{print $3}')" |
| 147 | export scp_tools="$(echo "${build_config}" | awk -F, '{print $4}')" |
| 148 | |
| 149 | export run_config="${rhs%.test}" |
| 150 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 151 | # Run this script bash -x, and it gets passed downstream for debugging |
| 152 | if echo "$-" | grep -q "x"; then |
| 153 | bash_opts="-x" |
| 154 | fi |
| 155 | |
| 156 | bash $bash_opts "$ci_root/script/run_local_ci.sh" |
| 157 | |
Leonardo Sandoval | dc2a03a | 2020-10-05 18:12:19 -0500 | [diff] [blame^] | 158 | # compress rootfs.bin file |
| 159 | for a in $(find ${workspace} -type d -name artefacts); do |
| 160 | for r in $(find $a -type f -name rootfs.bin); do |
| 161 | d=$(dirname $r); b=$(basename $r); cd "$d" && gzip "$b" |
| 162 | done |
| 163 | done |
| 164 | |
Fathi Boudra | 9e402bf | 2019-12-05 11:16:41 +0200 | [diff] [blame] | 165 | cp -a $(find ${workspace} -type d -name artefacts) ${WORKSPACE}/ |