| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 the V8 project authors. All rights reserved. | 2 # Copyright 2015 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import mergeinfo | 6 import mergeinfo |
| 7 import shutil | 7 import shutil |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from collections import namedtuple | 10 from collections import namedtuple |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 hash_of_followup = self._make_empty_commit(message) | 144 hash_of_followup = self._make_empty_commit(message) |
| 145 | 145 |
| 146 merges = mergeinfo.get_merge_commits(self.base_dir, hash_of_first_commit) | 146 merges = mergeinfo.get_merge_commits(self.base_dir, hash_of_first_commit) |
| 147 # Check if follow up is ignored | 147 # Check if follow up is ignored |
| 148 self.assertTrue(hash_of_followup not in merges) | 148 self.assertTrue(hash_of_followup not in merges) |
| 149 | 149 |
| 150 # Check for proper return of merges | 150 # Check for proper return of merges |
| 151 self.assertTrue(hash_of_hit in merges) | 151 self.assertTrue(hash_of_hit in merges) |
| 152 self.assertTrue(hash_of_ignored not in merges) | 152 self.assertTrue(hash_of_ignored not in merges) |
| 153 | 153 |
| 154 def testIsRolling(self): | |
| 155 commits = self._get_commits() | |
| 156 hash_of_first_commit = commits[0] | |
| 157 self._make_empty_commit('This one is the roll head') | |
| 158 self._execute_git(['branch', 'remotes/origin/roll']) | |
| 159 hash_of_not_rolled = self._make_empty_commit('This one is not yet rolled') | |
| 160 | |
| 161 self.assertTrue(mergeinfo.is_rolling( | |
| 162 self.base_dir, hash_of_first_commit)) | |
| 163 self.assertFalse(mergeinfo.is_rolling( | |
| 164 self.base_dir, hash_of_not_rolled)) | |
| 165 | |
| 166 def testIsLkgr(self): | 154 def testIsLkgr(self): |
| 167 commits = self._get_commits() | 155 commits = self._get_commits() |
| 168 hash_of_first_commit = commits[0] | 156 hash_of_first_commit = commits[0] |
| 169 self._make_empty_commit('This one is the lkgr head') | 157 self._make_empty_commit('This one is the lkgr head') |
| 170 self._execute_git(['branch', 'remotes/origin/lkgr']) | 158 self._execute_git(['branch', 'remotes/origin/lkgr']) |
| 171 hash_of_not_lkgr = self._make_empty_commit('This one is not yet lkgr') | 159 hash_of_not_lkgr = self._make_empty_commit('This one is not yet lkgr') |
| 172 | 160 |
| 173 self.assertTrue(mergeinfo.is_lkgr( | 161 self.assertTrue(mergeinfo.is_lkgr( |
| 174 self.base_dir, hash_of_first_commit)) | 162 self.base_dir, hash_of_first_commit)) |
| 175 self.assertFalse(mergeinfo.is_lkgr( | 163 self.assertFalse(mergeinfo.is_lkgr( |
| 176 self.base_dir, hash_of_not_lkgr)) | 164 self.base_dir, hash_of_not_lkgr)) |
| 177 | 165 |
| 178 def testShowFirstCanary(self): | 166 def testShowFirstCanary(self): |
| 179 commits = self._get_commits() | 167 commits = self._get_commits() |
| 180 hash_of_first_commit = commits[0] | 168 hash_of_first_commit = commits[0] |
| 181 | 169 |
| 182 self.assertEqual(mergeinfo.get_first_canary( | 170 self.assertEqual(mergeinfo.get_first_canary( |
| 183 self.base_dir, hash_of_first_commit), 'No Canary coverage') | 171 self.base_dir, hash_of_first_commit), 'No Canary coverage') |
| 184 | 172 |
| 185 self._execute_git(['branch', 'remotes/origin/chromium/2345']) | 173 self._execute_git(['branch', 'remotes/origin/chromium/2345']) |
| 186 self._execute_git(['branch', 'remotes/origin/chromium/2346']) | 174 self._execute_git(['branch', 'remotes/origin/chromium/2346']) |
| 187 | 175 |
| 188 self.assertEqual(mergeinfo.get_first_canary( | 176 self.assertEqual(mergeinfo.get_first_canary( |
| 189 self.base_dir, hash_of_first_commit), '2345') | 177 self.base_dir, hash_of_first_commit), '2345') |
| 190 | 178 |
| 191 if __name__ == "__main__": | 179 if __name__ == "__main__": |
| 192 unittest.main() | 180 unittest.main() |
| OLD | NEW |