summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-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'