From 7fc804db5ca97f1a22c13e0a45fd1e76d33d8aa1 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Thu, 15 Feb 2018 15:23:29 +0000 Subject: [PATCH] Using branch names in wltest series Extend wltest with the capability of using, in addition to the SHA1, also univocal branch names to checkout to a given kernel commit. This allows to keep the tests updated with the HEAD commit of the given branch name, without the need to update the series file every time the HEAD of the branch changes. If the branch name is not univocal, then return an error message is returned and quit. --- tools/wltests/test_series | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/wltests/test_series b/tools/wltests/test_series index 2466f271d..e9bb9f9e4 100755 --- a/tools/wltests/test_series +++ b/tools/wltests/test_series @@ -943,8 +943,22 @@ COMMIT_ID=1 # Here we read from an arbitrary file descriptor 10 to avoid overlaps with # stdin generated by the adb commands in the loop body while read -u10 COMMITS; do - # Extract SHA1 from commit description - COMMIT_SHA1=${COMMITS%% *} + # Extract commit identifier from commit description + COMMIT=${COMMITS%% *} + + # Translate possible branch name to SHA1 + COMMITS=$(git -C $KERNEL_SRC show-ref -s $COMMIT) + if [ $? -ne 0 ]; then + COMMIT_SHA1=$COMMIT + elif [ $(echo $COMMITS | wc -w) -eq 1 ]; then + COMMIT_SHA1=$COMMITS + else + c_error "The branch name must be univocal, \"$COMMIT\" may refer to:" + for b in $(git -C $KERNEL_SRC show-ref $COMMIT | cut -f 2 -d " "); do + c_error " $b" + done + exit $EINVAL + fi box_out "PROGRESS : $COMMIT_ID/$COMMITS_COUNT" \ "COMMIT : $COMMITS" -- GitLab