Merge pull request #9764 from eleuzi01/issue-39-backport
[Backport 3.6] Add project and branch detection in shell
diff --git a/framework b/framework
index 50d074d..c3cee62 160000
--- a/framework
+++ b/framework
@@ -1 +1 @@
-Subproject commit 50d074d09d899263ca76213ca4de2cc3ccb4cfd3
+Subproject commit c3cee628f52aab5b9b2a617f2e594683122014f3
diff --git a/scripts/lcov.sh b/scripts/lcov.sh
index 2d2f42b..5c17a5b 100755
--- a/scripts/lcov.sh
+++ b/scripts/lcov.sh
@@ -28,18 +28,11 @@
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+# This script must be invoked from the project's root.
+
set -eu
-# 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"
-}
+. framework/scripts/project_detection.sh
# Collect stats and build a HTML report.
lcov_library_report () {
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index ded238f..51df1f2 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -10,6 +10,7 @@
# This script must be invoked from the project's root.
-source framework/scripts/all-core.sh
+FRAMEWORK="$PWD/framework"
+source $FRAMEWORK/scripts/all-core.sh
main "$@"
diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh
index 9dd98df..d796cc0 100755
--- a/tests/scripts/check-generated-files.sh
+++ b/tests/scripts/check-generated-files.sh
@@ -22,13 +22,7 @@
exit
fi
-in_mbedtls_repo () {
- test -d include -a -d library -a -d programs -a -d tests
-}
-
-in_tf_psa_crypto_repo () {
- test -d include -a -d core -a -d drivers -a -d programs -a -d tests
-}
+. framework/scripts/project_detection.sh
if in_mbedtls_repo; then
library_dir='library'