Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: tools/release/test_mergeinfo.py

Issue 2733923002: [mergeinfo.py] Use remotes/origin/master instead of master (Closed)
Patch Set: Update tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/release/mergeinfo.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 23
24 fullCommand = ["git", "-C", self.base_dir] + git_args 24 fullCommand = ["git", "-C", self.base_dir] + git_args
25 p = Popen(args=fullCommand, stdin=PIPE, 25 p = Popen(args=fullCommand, stdin=PIPE,
26 stdout=PIPE, stderr=PIPE) 26 stdout=PIPE, stderr=PIPE)
27 output, err = p.communicate() 27 output, err = p.communicate()
28 rc = p.returncode 28 rc = p.returncode
29 if rc != 0: 29 if rc != 0:
30 raise Exception(err) 30 raise Exception(err)
31 return output 31 return output
32 32
33 def _update_origin(self):
34 # Fetch from origin to get/update the origin/master branch
35 self._execute_git(['fetch', 'origin'])
36
33 def setUp(self): 37 def setUp(self):
34 if path.exists(self.base_dir): 38 if path.exists(self.base_dir):
35 shutil.rmtree(self.base_dir) 39 shutil.rmtree(self.base_dir)
36 40
37 check_call(["git", "init", self.base_dir]) 41 check_call(["git", "init", self.base_dir])
38 42
43 # Add fake remote with name 'origin'
44 self._execute_git(['remote', 'add', 'origin', self.base_dir])
45
39 # Initial commit 46 # Initial commit
40 message = '''Initial commit''' 47 message = '''Initial commit'''
41 48
42 self._make_empty_commit(message) 49 self._make_empty_commit(message)
43 50
44 def tearDown(self): 51 def tearDown(self):
45 if path.exists(self.base_dir): 52 if path.exists(self.base_dir):
46 shutil.rmtree(self.base_dir) 53 shutil.rmtree(self.base_dir)
47 54
48 def _assert_correct_standard_result( 55 def _assert_correct_standard_result(
(...skipping 12 matching lines...) Expand all
61 result[hash_of_first_commit][0], 68 result[hash_of_first_commit][0],
62 "Child commit wrong") 69 "Child commit wrong")
63 70
64 def _get_commits(self): 71 def _get_commits(self):
65 commits = self._execute_git( 72 commits = self._execute_git(
66 ["log", "--format=%H", "--reverse"]).splitlines() 73 ["log", "--format=%H", "--reverse"]).splitlines()
67 return commits 74 return commits
68 75
69 def _make_empty_commit(self, message): 76 def _make_empty_commit(self, message):
70 self._execute_git(["commit", "--allow-empty", "-m", message]) 77 self._execute_git(["commit", "--allow-empty", "-m", message])
78 self._update_origin()
71 return self._get_commits()[-1] 79 return self._get_commits()[-1]
72 80
73 def testCanDescribeCommit(self): 81 def testCanDescribeCommit(self):
74 commits = self._get_commits() 82 commits = self._get_commits()
75 hash_of_first_commit = commits[0] 83 hash_of_first_commit = commits[0]
76 84
77 result = mergeinfo.describe_commit( 85 result = mergeinfo.describe_commit(
78 self.base_dir, 86 self.base_dir,
79 hash_of_first_commit).splitlines() 87 hash_of_first_commit).splitlines()
80 88
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 self.base_dir, hash_of_first_commit), 'No Canary coverage') 179 self.base_dir, hash_of_first_commit), 'No Canary coverage')
172 180
173 self._execute_git(['branch', 'remotes/origin/chromium/2345']) 181 self._execute_git(['branch', 'remotes/origin/chromium/2345'])
174 self._execute_git(['branch', 'remotes/origin/chromium/2346']) 182 self._execute_git(['branch', 'remotes/origin/chromium/2346'])
175 183
176 self.assertEqual(mergeinfo.get_first_canary( 184 self.assertEqual(mergeinfo.get_first_canary(
177 self.base_dir, hash_of_first_commit), '2345') 185 self.base_dir, hash_of_first_commit), '2345')
178 186
179 if __name__ == "__main__": 187 if __name__ == "__main__":
180 unittest.main() 188 unittest.main()
OLDNEW
« no previous file with comments | « tools/release/mergeinfo.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698