summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/buildperf/base.py18
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"""