summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-12 13:53:48 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-25 23:03:47 +0100
commit8335422b001713a7137e9cfdc0870138b120da8e (patch)
treeaf347a4d12f67b579a09f1b3d65039c8655aa6a1 /meta
parent66540ae5c102449ca7417750ce8cdff38e6c801c (diff)
downloadpoky-8335422b001713a7137e9cfdc0870138b120da8e.tar.gz
oe-build-perf-test: support committing results data to Git
Implement a new command line option '--commit-results' which commits the test results data into a Git repository. The given path must be an existing initialized local Git repository. (From OE-Core rev: b6f635513ca971402e7a970acc2168fb5d4a9476) 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 'meta')
-rw-r--r--meta/lib/oeqa/buildperf/base.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 0e77aae07b..8f7d88cd42 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -188,6 +188,41 @@ class BuildPerfTestResult(unittest.TextTestResult):
188 fobj.write(','.join(values) + '\n') 188 fobj.write(','.join(values) + '\n')
189 189
190 190
191 def git_commit_results(self, repo_path, branch=None):
192 """Commit results into a Git repository"""
193 repo = GitRepo(repo_path, is_topdir=True)
194 if not branch:
195 branch = self.git_branch
196 log.info("Committing test results into %s %s", repo_path, branch)
197 tmp_index = os.path.join(repo_path, '.git', 'index.oe-build-perf')
198 try:
199 # Create new commit object from the new results
200 env_update = {'GIT_INDEX_FILE': tmp_index,
201 'GIT_WORK_TREE': self.out_dir}
202 repo.run_cmd('add .', env_update)
203 tree = repo.run_cmd('write-tree', env_update)
204 parent = repo.rev_parse(branch)
205 msg = "Results of {}:{}\n".format(self.git_branch, self.git_commit)
206 git_cmd = ['commit-tree', tree, '-m', msg]
207 if parent:
208 git_cmd += ['-p', parent]
209 commit = repo.run_cmd(git_cmd, env_update)
210
211 # Update branch head
212 git_cmd = ['update-ref', 'refs/heads/' + branch, commit]
213 if parent:
214 git_cmd.append(parent)
215 repo.run_cmd(git_cmd)
216
217 # Update current HEAD, if we're on branch 'branch'
218 if repo.get_current_branch() == branch:
219 log.info("Updating %s HEAD to latest commit", repo_path)
220 repo.run_cmd('reset --hard')
221 finally:
222 if os.path.exists(tmp_index):
223 os.unlink(tmp_index)
224
225
191class BuildPerfTestCase(unittest.TestCase): 226class BuildPerfTestCase(unittest.TestCase):
192 """Base class for build performance tests""" 227 """Base class for build performance tests"""
193 SYSRES = 'sysres' 228 SYSRES = 'sysres'