clone.sh: Parse tf-m-tests version from TF-M commit msg
With TF-M split build feature, tf-m-tests version is no more specified
in TF-M CMake settings. To support CI per-patch job to fetch the correct
tf-m-tests version to be tested together with TF-M patch, developers can
specify the tf-m-tests version to be used by adding a new line in TF-M
commit message in format:
Depend on tf-m-tests <commit ID>
With this patch, TF-M per-patch test will try to parse TF-M commit
message first. If there is tf-m-tests version specified in TF-M commit
message, CI will fetch the specified tf-m-tests version. Otherwise, if
no tf-m-tests version specified, CI will fetch the latest
"feature-build-split-v2" branch by default.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: Ib742849aec9d250bc37f56de3f7d1e001acbd7fb
diff --git a/clone.sh b/clone.sh
index 81536fb..32dba6d 100755
--- a/clone.sh
+++ b/clone.sh
@@ -59,6 +59,24 @@
echo "${VERSION}"
}
+# Parse dependency version specified in TF-M commit message
+function parse_version_from_commit_msg() {
+ DEPENDENCY_NAME=$1
+ TFM_PATH="${SHARE_FOLDER}/${TFM_NAME}"
+
+ cd ${SHARE_FOLDER}/${TFM_NAME}
+
+ VERSION="$(git log HEAD -n 1 | grep "Depend on ${DEPENDENCY_NAME}" | awk '{print $NF}')"
+
+ if [ -z "${VERSION}" ]; then
+ VERSION="refs/heads/feature-build-split-v2"
+ fi
+
+ cd $OLDPWD
+
+ echo "${VERSION}"
+}
+
# Must projects
if [ -n "${GERRIT_EVENT_HASH}" ]; then
# If triggered by Gerrit, use its variables
@@ -102,7 +120,7 @@
# Dependency projects
TFM_TESTS_PROJECT="${TFM_TESTS_URL:-}"
-TFM_TESTS_REFSPEC="${TFM_TESTS_REFSPEC:-"$(parse_version_from_cmake lib/ext/tf-m-tests/repo_config_default.cmake TFM_TEST_REPO_VERSION)"}"
+TFM_TESTS_REFSPEC="${TFM_TESTS_REFSPEC:-"$(parse_version_from_commit_msg tf-m-tests)"}"
TFM_TESTS_NAME="tf-m-tests"
MBEDTLS_PROJECT="${MBEDTLS_URL:-}"