summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-23 16:48:46 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-25 23:03:47 +0100
commitd0bac259bd4648b7a8e39e882049c892a9db9112 (patch)
tree7ba88c5d890b9644c545dd29dd67024d56555ecf
parentcaf6ad889cc4db9d4af33ee15381d0148374dd12 (diff)
downloadopenembedded-core-contrib-d0bac259bd4648b7a8e39e882049c892a9db9112.tar.gz
openembedded-core-contrib-d0bac259bd4648b7a8e39e882049c892a9db9112.tar.bz2
openembedded-core-contrib-d0bac259bd4648b7a8e39e882049c892a9db9112.zip
oeqa.buildperf: add git commit count to result data
This number represents the number of commits since the beginning of git history until the tested revision. This helps e.g. in ordering results. (From OE-Core rev: b52070dd057ff5b410cd193f9be2f25bc4c506cc) 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>
-rw-r--r--meta/lib/oeqa/buildperf/base.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index faa30c72ec..f29c167307 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -96,30 +96,34 @@ class BuildPerfTestResult(unittest.TextTestResult):
self.repo = GitRepo('.')
except GitError:
self.repo = None
- self.git_commit, self.git_branch = self.get_git_revision()
+ self.git_commit, self.git_commit_count, self.git_branch = \
+ self.get_git_revision()
self.hostname = socket.gethostname()
self.start_time = self.elapsed_time = None
self.successes = []
- log.info("Using Git branch:commit %s:%s", self.git_branch,
- self.git_commit)
+ log.info("Using Git branch:commit %s:%s (%s)", self.git_branch,
+ self.git_commit, self.git_commit_count)
def get_git_revision(self):
"""Get git branch and commit under testing"""
commit = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT')
+ commit_cnt = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT_COUNT')
branch = os.getenv('OE_BUILDPERFTEST_GIT_BRANCH')
- if not self.repo and (not commit or not branch):
+ if not self.repo and (not commit or not commit_cnt or not branch):
log.info("The current working directory doesn't seem to be a Git "
"repository clone. You can specify branch and commit "
- "displayed in test results with OE_BUILDPERFTEST_GIT_BRANCH "
- "and OE_BUILDPERFTEST_GIT_COMMIT environment variables")
+ "displayed in test results with OE_BUILDPERFTEST_GIT_BRANCH, "
+ "OE_BUILDPERFTEST_GIT_COMMIT and "
+ "OE_BUILDPERFTEST_GIT_COMMIT_COUNT environment variables")
else:
if not commit:
commit = self.repo.rev_parse('HEAD^0')
+ commit_cnt = self.repo.run_cmd(['rev-list', '--count', 'HEAD^0'])
if not branch:
branch = self.repo.get_current_branch()
if not branch:
log.debug('Currently on detached HEAD')
- return str(commit), str(branch)
+ return str(commit), str(commit_cnt), str(branch)
def addSuccess(self, test):
"""Record results from successful tests"""