diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-04-03 18:58:36 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-05 23:22:13 +0100 |
commit | d3d24ef2f2c390c235198ae10f3890eb42186aa1 (patch) | |
tree | ef496605e8a49f4682d02bfccd25e98382426b7d /scripts/contrib | |
parent | 04e31f33c82b79f23f5ff6128cf0ab78fccfc95e (diff) | |
download | poky-d3d24ef2f2c390c235198ae10f3890eb42186aa1.tar.gz |
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>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index 234652d7ef..7b7e4dddc6 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -29,7 +29,8 @@ Optional arguments: | |||
29 | -h show this help and exit. | 29 | -h show this help and exit. |
30 | -a ARCHIVE_DIR archive results tarball here, give an empty string to | 30 | -a ARCHIVE_DIR archive results tarball here, give an empty string to |
31 | disable tarball archiving (default: $archive_dir) | 31 | disable tarball archiving (default: $archive_dir) |
32 | -c COMMITISH test (checkout) this commit | 32 | -c COMMITISH test (checkout) this commit, <branch>:<commit> can be |
33 | specified to test specific commit of certain branch | ||
33 | -C GIT_REPO commit results into Git | 34 | -C GIT_REPO commit results into Git |
34 | -w WORK_DIR work dir for this script | 35 | -w WORK_DIR work dir for this script |
35 | (default: GIT_TOP_DIR/build-perf-test) | 36 | (default: GIT_TOP_DIR/build-perf-test) |
@@ -90,15 +91,33 @@ fi | |||
90 | cd "$git_topdir" | 91 | cd "$git_topdir" |
91 | 92 | ||
92 | if [ -n "$commitish" ]; then | 93 | if [ -n "$commitish" ]; then |
93 | # Checkout correct revision | 94 | echo "Running git fetch" |
94 | echo "Checking out $commitish" | ||
95 | git fetch &> /dev/null | 95 | git fetch &> /dev/null |
96 | git checkout HEAD^0 &> /dev/null | 96 | git checkout HEAD^0 &> /dev/null |
97 | git branch -D $commitish &> /dev/null | 97 | |
98 | if ! git checkout -f $commitish &> /dev/null; then | 98 | # Handle <branch>:<commit> format |
99 | echo "Git checkout failed" | 99 | if echo "$commitish" | grep -q ":"; then |
100 | commit=`echo "$commitish" | cut -d":" -f2` | ||
101 | branch=`echo "$commitish" | cut -d":" -f1` | ||
102 | else | ||
103 | commit="$commitish" | ||
104 | branch="$commitish" | ||
105 | fi | ||
106 | |||
107 | echo "Checking out $commitish" | ||
108 | git branch -D $branch &> /dev/null | ||
109 | if ! git checkout -f $branch &> /dev/null; then | ||
110 | echo "ERROR: Git checkout failed" | ||
111 | exit 1 | ||
112 | fi | ||
113 | |||
114 | # Check that the specified branch really contains the commit | ||
115 | commit_hash=`git rev-parse --revs-only $commit --` | ||
116 | if [ -z "$commit_hash" -o "`git merge-base $branch $commit`" != "$commit_hash" ]; then | ||
117 | echo "ERROR: branch $branch does not contain commit $commit" | ||
100 | exit 1 | 118 | exit 1 |
101 | fi | 119 | fi |
120 | git reset --hard $commit > /dev/null | ||
102 | fi | 121 | fi |
103 | 122 | ||
104 | # Setup build environment | 123 | # Setup build environment |