aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/buildperf/base.py
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 22:59:58 +0100
commitb6f635513ca971402e7a970acc2168fb5d4a9476 (patch)
treeffffde66fc9c051c4e65703f5d0cba50e444d8fa /meta/lib/oeqa/buildperf/base.py
parentf49cf7959b8aaa52b79b22a5884c6aa580a50302 (diff)
downloadopenembedded-core-contrib-b6f635513ca971402e7a970acc2168fb5d4a9476.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. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib/oeqa/buildperf/base.py')
-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):
fobj.write(','.join(values) + '\n')
+ def git_commit_results(self, repo_path, branch=None):
+ """Commit results into a Git repository"""
+ repo = GitRepo(repo_path, is_topdir=True)
+ if not branch:
+ branch = self.git_branch
+ log.info("Committing test results into %s %s", repo_path, branch)
+ tmp_index = os.path.join(repo_path, '.git', 'index.oe-build-perf')
+ try:
+ # Create new commit object from the new results
+ env_update = {'GIT_INDEX_FILE': tmp_index,
+ 'GIT_WORK_TREE': self.out_dir}
+ repo.run_cmd('add .', env_update)
+ tree = repo.run_cmd('write-tree', env_update)
+ parent = repo.rev_parse(branch)
+ msg = "Results of {}:{}\n".format(self.git_branch, self.git_commit)
+ git_cmd = ['commit-tree', tree, '-m', msg]
+ if parent:
+ git_cmd += ['-p', parent]
+ commit = repo.run_cmd(git_cmd, env_update)
+
+ # Update branch head
+ git_cmd = ['update-ref', 'refs/heads/' + branch, commit]
+ if parent:
+ git_cmd.append(parent)
+ repo.run_cmd(git_cmd)
+
+ # Update current HEAD, if we're on branch 'branch'
+ if repo.get_current_branch() == branch:
+ log.info("Updating %s HEAD to latest commit", repo_path)
+ repo.run_cmd('reset --hard')
+ finally:
+ if os.path.exists(tmp_index):
+ os.unlink(tmp_index)
+
+
class BuildPerfTestCase(unittest.TestCase):
"""Base class for build performance tests"""
SYSRES = 'sysres'