1#!/bin/bash -x 2 3# Copyright (c) 2020-2023 Arm Limited 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -e 18 19source $(dirname "$0")/paths.sh 20 21SKIP_SIZE=$1 22BUILD_TYPE=$2 23DAMAGE_TYPE=$3 24FIH_LEVEL=$4 25 26if test -z "$FIH_LEVEL"; then 27 # Use the default level 28 CMAKE_FIH_LEVEL="" 29else 30 CMAKE_FIH_LEVEL="-DMCUBOOT_FIH_PROFILE=\"$FIH_LEVEL\"" 31fi 32 33# build TF-M with MCUBoot 34mkdir -p $TFM_BUILD_PATH $TFM_SPE_BUILD_PATH 35 36cmake -S $TFM_TESTS_PATH/tests_reg/spe \ 37 -B $TFM_SPE_BUILD_PATH \ 38 -DTFM_PLATFORM=arm/mps2/an521 \ 39 -DCONFIG_TFM_SOURCE_PATH=$TFM_PATH \ 40 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 41 -DTFM_TOOLCHAIN_FILE=$TFM_PATH/toolchain_GNUARM.cmake \ 42 -DTEST_S=ON \ 43 -DTEST_NS=ON \ 44 -DTFM_PSA_API=ON \ 45 -DMCUBOOT_PATH=$MCUBOOT_PATH \ 46 -DMCUBOOT_LOG_LEVEL=INFO \ 47 $CMAKE_FIH_LEVEL 48cmake --build $TFM_SPE_BUILD_PATH -- install 49 50cmake -S $TFM_TESTS_PATH/tests_reg \ 51 -B $TFM_BUILD_PATH \ 52 -DCONFIG_SPE_PATH=$TFM_SPE_BUILD_PATH/api_ns \ 53 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 54 -DTFM_TOOLCHAIN_FILE=$TFM_SPE_BUILD_PATH/api_ns/cmake/toolchain_ns_GNUARM.cmake 55cmake --build $TFM_BUILD_PATH 56 57cd $TFM_BUILD_PATH 58$MCUBOOT_PATH/ci/fih_test_docker/run_fi_test.sh $BOOTLOADER_AXF_PATH $SKIP_SIZE $DAMAGE_TYPE> fih_test_output.yaml 59 60echo "" 61echo "test finished with" 62echo " - BUILD_TYPE: $BUILD_TYPE" 63echo " - FIH_LEVEL: $FIH_LEVEL" 64echo " - SKIP_SIZE: $SKIP_SIZE" 65echo " - DAMAGE_TYPE: $DAMAGE_TYPE" 66 67python3 $MCUBOOT_PATH/ci/fih_test_docker/generate_test_report.py fih_test_output.yaml 68python3 $MCUBOOT_PATH/ci/fih_test_docker/validate_output.py fih_test_output.yaml $SKIP_SIZE $FIH_LEVEL 69