mirror of
https://git.yoctoproject.org/poky
synced 2026-09-16 09:49:35 +02:00
build-perf-test-wrapper.sh: make it possible to specify Git branch name
Support <branch>:<commit> format for the -c argument. This makes it possible to test older commits of a certain branch (not just the tip of it) so that the branch name will still be correctly recorded in the test report data. (From OE-Core rev: be3d1718a99e59e636f349586e0a64eb8e2824a4) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
04e31f33c8
commit
d3d24ef2f2
@@ -29,7 +29,8 @@ Optional arguments:
|
|||||||
-h show this help and exit.
|
-h show this help and exit.
|
||||||
-a ARCHIVE_DIR archive results tarball here, give an empty string to
|
-a ARCHIVE_DIR archive results tarball here, give an empty string to
|
||||||
disable tarball archiving (default: $archive_dir)
|
disable tarball archiving (default: $archive_dir)
|
||||||
-c COMMITISH test (checkout) this commit
|
-c COMMITISH test (checkout) this commit, <branch>:<commit> can be
|
||||||
|
specified to test specific commit of certain branch
|
||||||
-C GIT_REPO commit results into Git
|
-C GIT_REPO commit results into Git
|
||||||
-w WORK_DIR work dir for this script
|
-w WORK_DIR work dir for this script
|
||||||
(default: GIT_TOP_DIR/build-perf-test)
|
(default: GIT_TOP_DIR/build-perf-test)
|
||||||
@@ -90,15 +91,33 @@ fi
|
|||||||
cd "$git_topdir"
|
cd "$git_topdir"
|
||||||
|
|
||||||
if [ -n "$commitish" ]; then
|
if [ -n "$commitish" ]; then
|
||||||
# Checkout correct revision
|
echo "Running git fetch"
|
||||||
echo "Checking out $commitish"
|
|
||||||
git fetch &> /dev/null
|
git fetch &> /dev/null
|
||||||
git checkout HEAD^0 &> /dev/null
|
git checkout HEAD^0 &> /dev/null
|
||||||
git branch -D $commitish &> /dev/null
|
|
||||||
if ! git checkout -f $commitish &> /dev/null; then
|
# Handle <branch>:<commit> format
|
||||||
echo "Git checkout failed"
|
if echo "$commitish" | grep -q ":"; then
|
||||||
|
commit=`echo "$commitish" | cut -d":" -f2`
|
||||||
|
branch=`echo "$commitish" | cut -d":" -f1`
|
||||||
|
else
|
||||||
|
commit="$commitish"
|
||||||
|
branch="$commitish"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Checking out $commitish"
|
||||||
|
git branch -D $branch &> /dev/null
|
||||||
|
if ! git checkout -f $branch &> /dev/null; then
|
||||||
|
echo "ERROR: Git checkout failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check that the specified branch really contains the commit
|
||||||
|
commit_hash=`git rev-parse --revs-only $commit --`
|
||||||
|
if [ -z "$commit_hash" -o "`git merge-base $branch $commit`" != "$commit_hash" ]; then
|
||||||
|
echo "ERROR: branch $branch does not contain commit $commit"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git reset --hard $commit > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup build environment
|
# Setup build environment
|
||||||
|
|||||||
Reference in New Issue
Block a user