From 2f556400c320e6ef3fc9fe95e46ae8d9ec942c20 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Tue, 30 Jul 2024 15:52:58 +0100 Subject: [PATCH] Add functions to detect project Signed-off-by: Thomas Daubney --- scripts/lcov.sh | 12 +++++++++--- tests/scripts/all.sh | 11 +++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/lcov.sh b/scripts/lcov.sh index 9a0c58243f..516d9e372f 100755 --- a/scripts/lcov.sh +++ b/scripts/lcov.sh @@ -30,9 +30,15 @@ EOF set -eu -# Repository detection -in_mbedtls_build_dir () { - test -d library +# Project detection +PROJECT_NAME_FILE='./scripts/project_name.txt' +if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else + echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2 + exit 1 +fi + +in_mbedtls_repo () { + test "$PROJECT_NAME" = "Mbed TLS" } # Collect stats and build a HTML report. diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index d13456de7c..5cf8e606cd 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -115,12 +115,19 @@ set -e -o pipefail -u # Enable ksh/bash extended file matching patterns shopt -s extglob +# For project detection +PROJECT_NAME_FILE='./scripts/project_name.txt' +if read -r PROJECT_NAME < "$PROJECT_NAME_FILE"; then :; else + echo "$PROJECT_NAME_FILE does not exist... Exiting..." >&2 + exit 1 +fi + in_mbedtls_repo () { - test -d include -a -d library -a -d programs -a -d tests + test "$PROJECT_NAME" = "Mbed TLS" } in_tf_psa_crypto_repo () { - test -d include -a -d core -a -d drivers -a -d programs -a -d tests + test "$PROJECT_NAME" = "TF-PSA-Crypto" } pre_check_environment () {