oeqa.buildperf: use term commit instead of revision

This is basically a internal change, at this point. Term 'commit' better
represents the data we actually have. Term 'revision' is more vague and
could be understood to point to a tag object, for example.

(From OE-Core rev: f49cf7959b8aaa52b79b22a5884c6aa580a50302)

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:
Markus Lehtonen 2016-08-23 16:11:21 +03:00 committed by Richard Purdie
parent 979c735678
commit 66540ae5c1

View File

@ -96,30 +96,30 @@ class BuildPerfTestResult(unittest.TextTestResult):
self.repo = GitRepo('.') self.repo = GitRepo('.')
except GitError: except GitError:
self.repo = None self.repo = None
self.git_revision, self.git_branch = self.get_git_revision() self.git_commit, self.git_branch = self.get_git_revision()
self.hostname = socket.gethostname() self.hostname = socket.gethostname()
self.start_time = self.elapsed_time = None self.start_time = self.elapsed_time = None
self.successes = [] self.successes = []
log.info("Using Git branch:revision %s:%s", self.git_branch, log.info("Using Git branch:commit %s:%s", self.git_branch,
self.git_revision) self.git_commit)
def get_git_revision(self): def get_git_revision(self):
"""Get git branch and revision under testing""" """Get git branch and commit under testing"""
rev = os.getenv('OE_BUILDPERFTEST_GIT_REVISION') commit = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT')
branch = os.getenv('OE_BUILDPERFTEST_GIT_BRANCH') branch = os.getenv('OE_BUILDPERFTEST_GIT_BRANCH')
if not self.repo and (not rev or not branch): if not self.repo and (not commit or not branch):
log.info("The current working directory doesn't seem to be a Git " log.info("The current working directory doesn't seem to be a Git "
"repository clone. You can specify branch and revision " "repository clone. You can specify branch and commit "
"used in test results with OE_BUILDPERFTEST_GIT_REVISION " "displayed in test results with OE_BUILDPERFTEST_GIT_BRANCH "
"and OE_BUILDPERFTEST_GIT_BRANCH environment variables") "and OE_BUILDPERFTEST_GIT_COMMIT environment variables")
else: else:
if not rev: if not commit:
rev = self.repo.rev_parse('HEAD') commit = self.repo.rev_parse('HEAD^0')
if not branch: if not branch:
branch = self.repo.get_current_branch() branch = self.repo.get_current_branch()
if not branch: if not branch:
log.debug('Currently on detached HEAD') log.debug('Currently on detached HEAD')
return str(rev), str(branch) return str(commit), str(branch)
def addSuccess(self, test): def addSuccess(self, test):
"""Record results from successful tests""" """Record results from successful tests"""
@ -165,9 +165,9 @@ class BuildPerfTestResult(unittest.TextTestResult):
'test4': ((7, 1), (10, 2))} 'test4': ((7, 1), (10, 2))}
if self.repo: if self.repo:
git_tag_rev = self.repo.run_cmd(['describe', self.git_revision]) git_tag_rev = self.repo.run_cmd(['describe', self.git_commit])
else: else:
git_tag_rev = self.git_revision git_tag_rev = self.git_commit
values = ['0'] * 12 values = ['0'] * 12
for status, (test, msg) in self.all_results(): for status, (test, msg) in self.all_results():
@ -183,7 +183,7 @@ class BuildPerfTestResult(unittest.TextTestResult):
with open(filename, 'a') as fobj: with open(filename, 'a') as fobj:
fobj.write('{},{}:{},{},'.format(self.hostname, fobj.write('{},{}:{},{},'.format(self.hostname,
self.git_branch, self.git_branch,
self.git_revision, self.git_commit,
git_tag_rev)) git_tag_rev))
fobj.write(','.join(values) + '\n') fobj.write(','.join(values) + '\n')