diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-08-23 16:48:46 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-25 23:03:47 +0100 |
commit | d0bac259bd4648b7a8e39e882049c892a9db9112 (patch) | |
tree | 7ba88c5d890b9644c545dd29dd67024d56555ecf /meta | |
parent | caf6ad889cc4db9d4af33ee15381d0148374dd12 (diff) | |
download | poky-d0bac259bd4648b7a8e39e882049c892a9db9112.tar.gz |
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>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/buildperf/base.py | 18 |
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): | |||
96 | self.repo = GitRepo('.') | 96 | self.repo = GitRepo('.') |
97 | except GitError: | 97 | except GitError: |
98 | self.repo = None | 98 | self.repo = None |
99 | self.git_commit, self.git_branch = self.get_git_revision() | 99 | self.git_commit, self.git_commit_count, self.git_branch = \ |
100 | self.get_git_revision() | ||
100 | self.hostname = socket.gethostname() | 101 | self.hostname = socket.gethostname() |
101 | self.start_time = self.elapsed_time = None | 102 | self.start_time = self.elapsed_time = None |
102 | self.successes = [] | 103 | self.successes = [] |
103 | log.info("Using Git branch:commit %s:%s", self.git_branch, | 104 | log.info("Using Git branch:commit %s:%s (%s)", self.git_branch, |
104 | self.git_commit) | 105 | self.git_commit, self.git_commit_count) |
105 | 106 | ||
106 | def get_git_revision(self): | 107 | def get_git_revision(self): |
107 | """Get git branch and commit under testing""" | 108 | """Get git branch and commit under testing""" |
108 | commit = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT') | 109 | commit = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT') |
110 | commit_cnt = os.getenv('OE_BUILDPERFTEST_GIT_COMMIT_COUNT') | ||
109 | branch = os.getenv('OE_BUILDPERFTEST_GIT_BRANCH') | 111 | branch = os.getenv('OE_BUILDPERFTEST_GIT_BRANCH') |
110 | if not self.repo and (not commit or not branch): | 112 | if not self.repo and (not commit or not commit_cnt or not branch): |
111 | log.info("The current working directory doesn't seem to be a Git " | 113 | log.info("The current working directory doesn't seem to be a Git " |
112 | "repository clone. You can specify branch and commit " | 114 | "repository clone. You can specify branch and commit " |
113 | "displayed in test results with OE_BUILDPERFTEST_GIT_BRANCH " | 115 | "displayed in test results with OE_BUILDPERFTEST_GIT_BRANCH, " |
114 | "and OE_BUILDPERFTEST_GIT_COMMIT environment variables") | 116 | "OE_BUILDPERFTEST_GIT_COMMIT and " |
117 | "OE_BUILDPERFTEST_GIT_COMMIT_COUNT environment variables") | ||
115 | else: | 118 | else: |
116 | if not commit: | 119 | if not commit: |
117 | commit = self.repo.rev_parse('HEAD^0') | 120 | commit = self.repo.rev_parse('HEAD^0') |
121 | commit_cnt = self.repo.run_cmd(['rev-list', '--count', 'HEAD^0']) | ||
118 | if not branch: | 122 | if not branch: |
119 | branch = self.repo.get_current_branch() | 123 | branch = self.repo.get_current_branch() |
120 | if not branch: | 124 | if not branch: |
121 | log.debug('Currently on detached HEAD') | 125 | log.debug('Currently on detached HEAD') |
122 | return str(commit), str(branch) | 126 | return str(commit), str(commit_cnt), str(branch) |
123 | 127 | ||
124 | def addSuccess(self, test): | 128 | def addSuccess(self, test): |
125 | """Record results from successful tests""" | 129 | """Record results from successful tests""" |