| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 VERSION_FILE: None, | 46 VERSION_FILE: None, |
| 47 CHANGELOG_FILE: None, | 47 CHANGELOG_FILE: None, |
| 48 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", | 48 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", |
| 49 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", | 49 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", |
| 50 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", | 50 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", |
| 51 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", | 51 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", |
| 52 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", | 52 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None): |
| 57 """Convenience wrapper.""" |
| 58 class Options(object): |
| 59 pass |
| 60 options = Options() |
| 61 options.s = s |
| 62 options.l = l |
| 63 options.f = f |
| 64 options.m = m |
| 65 options.r = r |
| 66 options.c = c |
| 67 return options |
| 68 |
| 69 |
| 56 class ToplevelTest(unittest.TestCase): | 70 class ToplevelTest(unittest.TestCase): |
| 57 def testMakeComment(self): | 71 def testMakeComment(self): |
| 58 self.assertEquals("# Line 1\n# Line 2\n#", | 72 self.assertEquals("# Line 1\n# Line 2\n#", |
| 59 MakeComment(" Line 1\n Line 2\n")) | 73 MakeComment(" Line 1\n Line 2\n")) |
| 60 self.assertEquals("#Line 1\n#Line 2", | 74 self.assertEquals("#Line 1\n#Line 2", |
| 61 MakeComment("Line 1\n Line 2")) | 75 MakeComment("Line 1\n Line 2")) |
| 62 | 76 |
| 63 def testStripComments(self): | 77 def testStripComments(self): |
| 64 self.assertEquals(" Line 1\n Line 3\n", | 78 self.assertEquals(" Line 1\n Line 3\n", |
| 65 StripComments(" Line 1\n# Line 2\n Line 3\n#\n")) | 79 StripComments(" Line 1\n# Line 2\n Line 3\n#\n")) |
| 66 self.assertEquals("\nLine 2 ### Test\n #", | 80 self.assertEquals("\nLine 2 ### Test\n #", |
| 67 StripComments("###\n# \n\n# Line 1\nLine 2 ### Test\n #")) | 81 StripComments("###\n# \n\n# Line 1\nLine 2 ### Test\n #")) |
| 68 | 82 |
| 69 def testMakeChangeLogBodySimple(self): | 83 def testMakeChangeLogBodySimple(self): |
| 70 commits = [ | 84 commits = [ |
| 71 ["Title text 1", | 85 ["Title text 1", |
| 72 "Title text 1\n\nBUG=\n", | 86 "Title text 1\n\nBUG=\n", |
| 73 "author1@chromium.org"], | 87 "author1@chromium.org"], |
| 74 ["Title text 2", | 88 ["Title text 2.", |
| 75 "Title text 2\n\nBUG=1234\n", | 89 "Title text 2\n\nBUG=1234\n", |
| 76 "author2@chromium.org"], | 90 "author2@chromium.org"], |
| 77 ] | 91 ] |
| 78 self.assertEquals(" Title text 1\n" | 92 self.assertEquals(" Title text 1.\n" |
| 79 " (author1@chromium.org)\n\n" | 93 " (author1@chromium.org)\n\n" |
| 80 " Title text 2\n" | 94 " Title text 2 (Chromium issue 1234).\n" |
| 81 " (Chromium issue 1234)\n" | |
| 82 " (author2@chromium.org)\n\n", | 95 " (author2@chromium.org)\n\n", |
| 83 MakeChangeLogBody(commits)) | 96 MakeChangeLogBody(commits)) |
| 84 | 97 |
| 85 def testMakeChangeLogBodyEmpty(self): | 98 def testMakeChangeLogBodyEmpty(self): |
| 86 self.assertEquals("", MakeChangeLogBody([])) | 99 self.assertEquals("", MakeChangeLogBody([])) |
| 87 | 100 |
| 88 def testMakeChangeLogBodyAutoFormat(self): | 101 def testMakeChangeLogBodyAutoFormat(self): |
| 89 commits = [ | 102 commits = [ |
| 90 ["Title text 1", | 103 ["Title text 1!", |
| 91 "Title text 1\nLOG=y\nBUG=\n", | 104 "Title text 1\nLOG=y\nBUG=\n", |
| 92 "author1@chromium.org"], | 105 "author1@chromium.org"], |
| 93 ["Title text 2", | 106 ["Title text 2", |
| 94 "Title text 2\n\nBUG=1234\n", | 107 "Title text 2\n\nBUG=1234\n", |
| 95 "author2@chromium.org"], | 108 "author2@chromium.org"], |
| 96 ["Title text 3", | 109 ["Title text 3", |
| 97 "Title text 3\n\nBUG=1234\nLOG = Yes\n", | 110 "Title text 3\n\nBUG=1234\nLOG = Yes\n", |
| 98 "author3@chromium.org"], | 111 "author3@chromium.org"], |
| 99 ["Title text 3", | 112 ["Title text 3", |
| 100 "Title text 4\n\nBUG=1234\nLOG=\n", | 113 "Title text 4\n\nBUG=1234\nLOG=\n", |
| 101 "author4@chromium.org"], | 114 "author4@chromium.org"], |
| 102 ] | 115 ] |
| 103 self.assertEquals(" Title text 1\n\n" | 116 self.assertEquals(" Title text 1.\n\n" |
| 104 " Title text 3\n" | 117 " Title text 3 (Chromium issue 1234).\n\n", |
| 105 " (Chromium issue 1234)\n\n", | |
| 106 MakeChangeLogBody(commits, True)) | 118 MakeChangeLogBody(commits, True)) |
| 107 | 119 |
| 120 def testRegressWrongLogEntryOnTrue(self): |
| 121 body = """ |
| 122 Check elimination: Learn from if(CompareMap(x)) on true branch. |
| 123 |
| 124 BUG= |
| 125 R=verwaest@chromium.org |
| 126 |
| 127 Committed: https://code.google.com/p/v8/source/detail?r=18210 |
| 128 """ |
| 129 self.assertEquals("", MakeChangeLogBody([["title", body, "author"]], True)) |
| 130 |
| 108 def testMakeChangeLogBugReferenceEmpty(self): | 131 def testMakeChangeLogBugReferenceEmpty(self): |
| 109 self.assertEquals("", MakeChangeLogBugReference("")) | 132 self.assertEquals("", MakeChangeLogBugReference("")) |
| 110 self.assertEquals("", MakeChangeLogBugReference("LOG=")) | 133 self.assertEquals("", MakeChangeLogBugReference("LOG=")) |
| 111 self.assertEquals("", MakeChangeLogBugReference(" BUG =")) | 134 self.assertEquals("", MakeChangeLogBugReference(" BUG =")) |
| 112 self.assertEquals("", MakeChangeLogBugReference("BUG=none\t")) | 135 self.assertEquals("", MakeChangeLogBugReference("BUG=none\t")) |
| 113 | 136 |
| 114 def testMakeChangeLogBugReferenceSimple(self): | 137 def testMakeChangeLogBugReferenceSimple(self): |
| 115 self.assertEquals(" (issue 987654)\n", | 138 self.assertEquals("(issue 987654)", |
| 116 MakeChangeLogBugReference("BUG = v8:987654")) | 139 MakeChangeLogBugReference("BUG = v8:987654")) |
| 117 self.assertEquals(" (Chromium issue 987654)\n", | 140 self.assertEquals("(Chromium issue 987654)", |
| 118 MakeChangeLogBugReference("BUG=987654 ")) | 141 MakeChangeLogBugReference("BUG=987654 ")) |
| 119 | 142 |
| 120 def testMakeChangeLogBugReferenceFromBody(self): | 143 def testMakeChangeLogBugReferenceFromBody(self): |
| 121 self.assertEquals(" (Chromium issue 1234567)\n", | 144 self.assertEquals("(Chromium issue 1234567)", |
| 122 MakeChangeLogBugReference("Title\n\nTBR=\nBUG=\n" | 145 MakeChangeLogBugReference("Title\n\nTBR=\nBUG=\n" |
| 123 " BUG=\tchromium:1234567\t\n" | 146 " BUG=\tchromium:1234567\t\n" |
| 124 "R=somebody\n")) | 147 "R=somebody\n")) |
| 125 | 148 |
| 126 def testMakeChangeLogBugReferenceMultiple(self): | 149 def testMakeChangeLogBugReferenceMultiple(self): |
| 127 # All issues should be sorted and grouped. Multiple references to the same | 150 # All issues should be sorted and grouped. Multiple references to the same |
| 128 # issue should be filtered. | 151 # issue should be filtered. |
| 129 self.assertEquals(" (issues 123, 234, Chromium issue 345)\n", | 152 self.assertEquals("(issues 123, 234, Chromium issue 345)", |
| 130 MakeChangeLogBugReference("Title\n\n" | 153 MakeChangeLogBugReference("Title\n\n" |
| 131 "BUG=v8:234\n" | 154 "BUG=v8:234\n" |
| 132 " BUG\t= 345, \tv8:234,\n" | 155 " BUG\t= 345, \tv8:234,\n" |
| 133 "BUG=v8:123\n" | 156 "BUG=v8:123\n" |
| 134 "R=somebody\n")) | 157 "R=somebody\n")) |
| 135 self.assertEquals(" (Chromium issues 123, 234)\n", | 158 self.assertEquals("(Chromium issues 123, 234)", |
| 136 MakeChangeLogBugReference("Title\n\n" | 159 MakeChangeLogBugReference("Title\n\n" |
| 137 "BUG=234,,chromium:123 \n" | 160 "BUG=234,,chromium:123 \n" |
| 138 "R=somebody\n")) | 161 "R=somebody\n")) |
| 139 self.assertEquals(" (Chromium issues 123, 234)\n", | 162 self.assertEquals("(Chromium issues 123, 234)", |
| 140 MakeChangeLogBugReference("Title\n\n" | 163 MakeChangeLogBugReference("Title\n\n" |
| 141 "BUG=chromium:234, , 123\n" | 164 "BUG=chromium:234, , 123\n" |
| 142 "R=somebody\n")) | 165 "R=somebody\n")) |
| 143 self.assertEquals(" (issues 345, 456)\n", | 166 self.assertEquals("(issues 345, 456)", |
| 144 MakeChangeLogBugReference("Title\n\n" | 167 MakeChangeLogBugReference("Title\n\n" |
| 145 "\t\tBUG=v8:345,v8:456\n" | 168 "\t\tBUG=v8:345,v8:456\n" |
| 146 "R=somebody\n")) | 169 "R=somebody\n")) |
| 147 self.assertEquals(" (issue 123, Chromium issues 345, 456)\n", | 170 self.assertEquals("(issue 123, Chromium issues 345, 456)", |
| 148 MakeChangeLogBugReference("Title\n\n" | 171 MakeChangeLogBugReference("Title\n\n" |
| 149 "BUG=chromium:456\n" | 172 "BUG=chromium:456\n" |
| 150 "BUG = none\n" | 173 "BUG = none\n" |
| 151 "R=somebody\n" | 174 "R=somebody\n" |
| 152 "BUG=456,v8:123, 345")) | 175 "BUG=456,v8:123, 345")) |
| 153 | 176 |
| 177 # TODO(machenbach): These test don't make much sense when the formatting is |
| 178 # done later. |
| 154 def testMakeChangeLogBugReferenceLong(self): | 179 def testMakeChangeLogBugReferenceLong(self): |
| 155 # -----------------00--------10--------20--------30-------- | 180 # -----------------00--------10--------20--------30-------- |
| 156 self.assertEquals(" (issues 234, 1234567890, 1234567" | 181 self.assertEquals("(issues 234, 1234567890, 1234567" |
| 157 "8901234567890, Chromium issues 12345678,\n" | 182 "8901234567890, Chromium issues 12345678," |
| 158 " 123456789)\n", | 183 " 123456789)", |
| 159 MakeChangeLogBugReference("BUG=v8:234\n" | 184 MakeChangeLogBugReference("BUG=v8:234\n" |
| 160 "BUG=v8:1234567890\n" | 185 "BUG=v8:1234567890\n" |
| 161 "BUG=v8:12345678901234567890\n" | 186 "BUG=v8:12345678901234567890\n" |
| 162 "BUG=123456789\n" | 187 "BUG=123456789\n" |
| 163 "BUG=12345678\n")) | 188 "BUG=12345678\n")) |
| 164 # -----------------00--------10--------20--------30-------- | 189 # -----------------00--------10--------20--------30-------- |
| 165 self.assertEquals(" (issues 234, 1234567890, 1234567" | 190 self.assertEquals("(issues 234, 1234567890, 1234567" |
| 166 "8901234567890, Chromium issues\n" | 191 "8901234567890, Chromium issues" |
| 167 " 123456789, 1234567890)\n", | 192 " 123456789, 1234567890)", |
| 168 MakeChangeLogBugReference("BUG=v8:234\n" | 193 MakeChangeLogBugReference("BUG=v8:234\n" |
| 169 "BUG=v8:12345678901234567890\n" | 194 "BUG=v8:12345678901234567890\n" |
| 170 "BUG=v8:1234567890\n" | 195 "BUG=v8:1234567890\n" |
| 171 "BUG=123456789\n" | 196 "BUG=123456789\n" |
| 172 "BUG=1234567890\n")) | 197 "BUG=1234567890\n")) |
| 173 # -----------------00--------10--------20--------30-------- | 198 # -----------------00--------10--------20--------30-------- |
| 174 self.assertEquals(" (Chromium issues 234, 1234567890" | 199 self.assertEquals("(Chromium issues 234, 1234567890" |
| 175 ", 12345678901234567,\n" | 200 ", 12345678901234567, " |
| 176 " 1234567890123456789)\n", | 201 "1234567890123456789)", |
| 177 MakeChangeLogBugReference("BUG=234\n" | 202 MakeChangeLogBugReference("BUG=234\n" |
| 178 "BUG=12345678901234567\n" | 203 "BUG=12345678901234567\n" |
| 179 "BUG=1234567890123456789\n" | 204 "BUG=1234567890123456789\n" |
| 180 "BUG=1234567890\n")) | 205 "BUG=1234567890\n")) |
| 181 | 206 |
| 182 | 207 |
| 183 class SimpleMock(object): | 208 class SimpleMock(object): |
| 184 def __init__(self, name): | 209 def __init__(self, name): |
| 185 self._name = name | 210 self._name = name |
| 186 self._recipe = [] | 211 self._recipe = [] |
| 187 self._index = -1 | 212 self._index = -1 |
| 188 | 213 |
| 189 def Expect(self, recipe): | 214 def Expect(self, recipe): |
| 190 self._recipe = recipe | 215 self._recipe = recipe |
| 191 | 216 |
| 192 def Call(self, *args): | 217 def Call(self, *args): |
| 193 self._index += 1 | 218 self._index += 1 |
| 194 try: | 219 try: |
| 195 expected_call = self._recipe[self._index] | 220 expected_call = self._recipe[self._index] |
| 196 except IndexError: | 221 except IndexError: |
| 197 raise Exception("Calling %s %s" % (name, " ".join(args))) | 222 raise Exception("Calling %s %s" % (self._name, " ".join(args))) |
| 198 | 223 |
| 199 # Pack expectations without arguments into a list. | 224 # Pack expectations without arguments into a list. |
| 200 if not isinstance(expected_call, list): | 225 if not isinstance(expected_call, list): |
| 201 expected_call = [expected_call] | 226 expected_call = [expected_call] |
| 202 | 227 |
| 203 # The number of arguments in the expectation must match the actual | 228 # The number of arguments in the expectation must match the actual |
| 204 # arguments. | 229 # arguments. |
| 205 if len(args) > len(expected_call): | 230 if len(args) > len(expected_call): |
| 206 raise Exception("When calling %s with arguments, the expectations " | 231 raise Exception("When calling %s with arguments, the expectations " |
| 207 "must consist of at least as many arguments.") | 232 "must consist of at least as many arguments.") |
| 208 | 233 |
| 209 # Compare expected and actual arguments. | 234 # Compare expected and actual arguments. |
| 210 for (expected_arg, actual_arg) in zip(expected_call, args): | 235 for (expected_arg, actual_arg) in zip(expected_call, args): |
| 211 if expected_arg != actual_arg: | 236 if expected_arg != actual_arg: |
| 212 raise Exception("Expected: %s - Actual: %s" | 237 raise Exception("Expected: %s - Actual: %s" |
| 213 % (expected_arg, actual_arg)) | 238 % (expected_arg, actual_arg)) |
| 214 | 239 |
| 215 # The expectation list contains a mandatory return value and an optional | 240 # The expectation list contains a mandatory return value and an optional |
| 216 # callback for checking the context at the time of the call. | 241 # callback for checking the context at the time of the call. |
| 217 if len(expected_call) == len(args) + 2: | 242 if len(expected_call) == len(args) + 2: |
| 218 expected_call[len(args) + 1]() | 243 expected_call[len(args) + 1]() |
| 219 return expected_call[len(args)] | 244 return_value = expected_call[len(args)] |
| 245 |
| 246 # If the return value is an exception, raise it instead of returning. |
| 247 if isinstance(return_value, Exception): |
| 248 raise return_value |
| 249 return return_value |
| 220 | 250 |
| 221 def AssertFinished(self): | 251 def AssertFinished(self): |
| 222 if self._index < len(self._recipe) -1: | 252 if self._index < len(self._recipe) -1: |
| 223 raise Exception("Called %s too seldom: %d vs. %d" | 253 raise Exception("Called %s too seldom: %d vs. %d" |
| 224 % (self._name, self._index, len(self._recipe))) | 254 % (self._name, self._index, len(self._recipe))) |
| 225 | 255 |
| 226 | 256 |
| 227 class ScriptTest(unittest.TestCase): | 257 class ScriptTest(unittest.TestCase): |
| 228 def MakeEmptyTempFile(self): | 258 def MakeEmptyTempFile(self): |
| 229 handle, name = tempfile.mkstemp() | 259 handle, name = tempfile.mkstemp() |
| 230 os.close(handle) | 260 os.close(handle) |
| 231 self._tmp_files.append(name) | 261 self._tmp_files.append(name) |
| 232 return name | 262 return name |
| 233 | 263 |
| 234 def MakeTempVersionFile(self): | 264 def MakeTempVersionFile(self): |
| 235 name = self.MakeEmptyTempFile() | 265 name = self.MakeEmptyTempFile() |
| 236 with open(name, "w") as f: | 266 with open(name, "w") as f: |
| 237 f.write(" // Some line...\n") | 267 f.write(" // Some line...\n") |
| 238 f.write("\n") | 268 f.write("\n") |
| 239 f.write("#define MAJOR_VERSION 3\n") | 269 f.write("#define MAJOR_VERSION 3\n") |
| 240 f.write("#define MINOR_VERSION 22\n") | 270 f.write("#define MINOR_VERSION 22\n") |
| 241 f.write("#define BUILD_NUMBER 5\n") | 271 f.write("#define BUILD_NUMBER 5\n") |
| 242 f.write("#define PATCH_LEVEL 0\n") | 272 f.write("#define PATCH_LEVEL 0\n") |
| 243 f.write(" // Some line...\n") | 273 f.write(" // Some line...\n") |
| 244 f.write("#define IS_CANDIDATE_VERSION 0\n") | 274 f.write("#define IS_CANDIDATE_VERSION 0\n") |
| 245 return name | 275 return name |
| 246 | 276 |
| 247 def MakeStep(self, step_class=Step, state=None): | 277 def MakeStep(self, step_class=Step, state=None, options=None): |
| 248 """Convenience wrapper.""" | 278 """Convenience wrapper.""" |
| 279 options = options or MakeOptions() |
| 249 return MakeStep(step_class=step_class, number=0, state=state, | 280 return MakeStep(step_class=step_class, number=0, state=state, |
| 250 config=TEST_CONFIG, options=None, side_effect_handler=self) | 281 config=TEST_CONFIG, options=options, |
| 282 side_effect_handler=self) |
| 251 | 283 |
| 252 def GitMock(self, cmd, args="", pipe=True): | 284 def GitMock(self, cmd, args="", pipe=True): |
| 285 print "%s %s" % (cmd, args) |
| 253 return self._git_mock.Call(args) | 286 return self._git_mock.Call(args) |
| 254 | 287 |
| 255 def LogMock(self, cmd, args=""): | 288 def LogMock(self, cmd, args=""): |
| 256 print "Log: %s %s" % (cmd, args) | 289 print "Log: %s %s" % (cmd, args) |
| 257 | 290 |
| 258 MOCKS = { | 291 MOCKS = { |
| 259 "git": GitMock, | 292 "git": GitMock, |
| 260 "vi": LogMock, | 293 "vi": LogMock, |
| 261 } | 294 } |
| 262 | 295 |
| 263 def Command(self, cmd, args="", prefix="", pipe=True): | 296 def Command(self, cmd, args="", prefix="", pipe=True): |
| 264 return ScriptTest.MOCKS[cmd](self, cmd, args) | 297 return ScriptTest.MOCKS[cmd](self, cmd, args) |
| 265 | 298 |
| 266 def ReadLine(self): | 299 def ReadLine(self): |
| 267 return self._rl_mock.Call() | 300 return self._rl_mock.Call() |
| 268 | 301 |
| 269 def ReadURL(self, url): | 302 def ReadURL(self, url): |
| 270 return self._url_mock.Call(url) | 303 return self._url_mock.Call(url) |
| 271 | 304 |
| 305 def Sleep(self, seconds): |
| 306 pass |
| 307 |
| 308 def GetDate(self): |
| 309 return "1999-07-31" |
| 310 |
| 272 def ExpectGit(self, *args): | 311 def ExpectGit(self, *args): |
| 273 """Convenience wrapper.""" | 312 """Convenience wrapper.""" |
| 274 self._git_mock.Expect(*args) | 313 self._git_mock.Expect(*args) |
| 275 | 314 |
| 276 def ExpectReadline(self, *args): | 315 def ExpectReadline(self, *args): |
| 277 """Convenience wrapper.""" | 316 """Convenience wrapper.""" |
| 278 self._rl_mock.Expect(*args) | 317 self._rl_mock.Expect(*args) |
| 279 | 318 |
| 280 def ExpectReadURL(self, *args): | 319 def ExpectReadURL(self, *args): |
| 281 """Convenience wrapper.""" | 320 """Convenience wrapper.""" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 self.assertEqual("//\n#define BUILD_NUMBER 3\n", | 429 self.assertEqual("//\n#define BUILD_NUMBER 3\n", |
| 391 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", | 430 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", |
| 392 r"\g<space>3", | 431 r"\g<space>3", |
| 393 "//\n#define BUILD_NUMBER 321\n")) | 432 "//\n#define BUILD_NUMBER 321\n")) |
| 394 | 433 |
| 395 def testPrepareChangeLog(self): | 434 def testPrepareChangeLog(self): |
| 396 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 435 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 397 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 436 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 398 | 437 |
| 399 self.ExpectGit([ | 438 self.ExpectGit([ |
| 400 ["log 1234..HEAD --format=%H", "rev1\nrev2\nrev3"], | 439 ["log 1234..HEAD --format=%H", "rev1\nrev2\nrev3\nrev4"], |
| 401 ["log -1 rev1 --format=\"%s\"", "Title text 1"], | 440 ["log -1 rev1 --format=\"%s\"", "Title text 1"], |
| 402 ["log -1 rev1 --format=\"%B\"", "Title\n\nBUG=\nLOG=y\n"], | 441 ["log -1 rev1 --format=\"%B\"", "Title\n\nBUG=\nLOG=y\n"], |
| 403 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org"], | 442 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org"], |
| 404 ["log -1 rev2 --format=\"%s\"", "Title text 2"], | 443 ["log -1 rev2 --format=\"%s\"", "Title text 2."], |
| 405 ["log -1 rev2 --format=\"%B\"", "Title\n\nBUG=123\nLOG= \n"], | 444 ["log -1 rev2 --format=\"%B\"", "Title\n\nBUG=123\nLOG= \n"], |
| 406 ["log -1 rev2 --format=\"%an\"", "author2@chromium.org"], | 445 ["log -1 rev2 --format=\"%an\"", "author2@chromium.org"], |
| 407 ["log -1 rev3 --format=\"%s\"", "Title text 3"], | 446 ["log -1 rev3 --format=\"%s\"", "Title text 3"], |
| 408 ["log -1 rev3 --format=\"%B\"", "Title\n\nBUG=321\nLOG=true\n"], | 447 ["log -1 rev3 --format=\"%B\"", "Title\n\nBUG=321\nLOG=true\n"], |
| 409 ["log -1 rev3 --format=\"%an\"", "author3@chromium.org"], | 448 ["log -1 rev3 --format=\"%an\"", "author3@chromium.org"], |
| 449 ["log -1 rev4 --format=\"%s\"", "Title text 4"], |
| 450 ["log -1 rev4 --format=\"%B\"", |
| 451 ("Title\n\nBUG=456\nLOG=Y\n\n" |
| 452 "Review URL: https://codereview.chromium.org/9876543210\n")], |
| 453 ["log -1 rev4 --format=\"%an\"", "author4@chromium.org"], |
| 454 ]) |
| 455 |
| 456 # The cl for rev4 on rietveld has an updated LOG flag. |
| 457 self.ExpectReadURL([ |
| 458 ["https://codereview.chromium.org/9876543210/description", |
| 459 "Title\n\nBUG=456\nLOG=N\n\n"], |
| 410 ]) | 460 ]) |
| 411 | 461 |
| 412 self.MakeStep().Persist("last_push", "1234") | 462 self.MakeStep().Persist("last_push", "1234") |
| 413 self.MakeStep(PrepareChangeLog).Run() | 463 self.MakeStep(PrepareChangeLog).Run() |
| 414 | 464 |
| 415 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 465 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
| 416 | 466 |
| 417 # TODO(machenbach): Mock out call to date() in order to make a fixed | 467 expected_cl = """1999-07-31: Version 3.22.5 |
| 418 # comparison here instead of a regexp match. | |
| 419 expected_cl = """\\d+\\-\\d+\\-\\d+: Version 3\\.22\\.5 | |
| 420 | 468 |
| 421 Title text 1 | 469 Title text 1. |
| 422 | 470 |
| 423 Title text 3 | 471 Title text 3 (Chromium issue 321). |
| 424 \\(Chromium issue 321\\) | |
| 425 | 472 |
| 426 Performance and stability improvements on all platforms\\. | 473 Performance and stability improvements on all platforms. |
| 427 # | 474 # |
| 428 # The change log above is auto-generated\\. Please review if all relevant | 475 # The change log above is auto-generated. Please review if all relevant |
| 429 # commit messages from the list below are included\\. | 476 # commit messages from the list below are included. |
| 430 # All lines starting with # will be stripped\\. | 477 # All lines starting with # will be stripped. |
| 431 # | 478 # |
| 432 # Title text 1 | 479 # Title text 1. |
| 433 # \\(author1@chromium\\.org\\) | 480 # (author1@chromium.org) |
| 434 # | 481 # |
| 435 # Title text 2 | 482 # Title text 2 (Chromium issue 123). |
| 436 # \\(Chromium issue 123\\) | 483 # (author2@chromium.org) |
| 437 # \\(author2@chromium\\.org\\) | |
| 438 # | 484 # |
| 439 # Title text 3 | 485 # Title text 3 (Chromium issue 321). |
| 440 # \\(Chromium issue 321\\) | 486 # (author3@chromium.org) |
| 441 # \\(author3@chromium\\.org\\) | 487 # |
| 488 # Title text 4 (Chromium issue 456). |
| 489 # (author4@chromium.org) |
| 442 # | 490 # |
| 443 #""" | 491 #""" |
| 444 | 492 |
| 445 self.assertTrue(re.match(expected_cl, actual_cl)) | 493 self.assertEquals(expected_cl, actual_cl) |
| 446 self.assertEquals("3", self.MakeStep().Restore("major")) | 494 self.assertEquals("3", self.MakeStep().Restore("major")) |
| 447 self.assertEquals("22", self.MakeStep().Restore("minor")) | 495 self.assertEquals("22", self.MakeStep().Restore("minor")) |
| 448 self.assertEquals("5", self.MakeStep().Restore("build")) | 496 self.assertEquals("5", self.MakeStep().Restore("build")) |
| 449 self.assertEquals("0", self.MakeStep().Restore("patch")) | 497 self.assertEquals("0", self.MakeStep().Restore("patch")) |
| 450 | 498 |
| 451 def testEditChangeLog(self): | 499 def testEditChangeLog(self): |
| 452 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 500 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 453 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 501 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
| 454 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) | 502 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) |
| 455 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 503 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
| 456 os.environ["EDITOR"] = "vi" | 504 os.environ["EDITOR"] = "vi" |
| 457 | 505 |
| 458 self.ExpectReadline([ | 506 self.ExpectReadline([ |
| 459 "", # Open editor. | 507 "", # Open editor. |
| 460 ]) | 508 ]) |
| 461 | 509 |
| 462 self.MakeStep(EditChangeLog).Run() | 510 self.MakeStep(EditChangeLog).Run() |
| 463 | 511 |
| 464 self.assertEquals(" New\n Lines\n\n\n Original CL", | 512 self.assertEquals("New\n Lines\n\n\n Original CL", |
| 465 FileToText(TEST_CONFIG[CHANGELOG_FILE])) | 513 FileToText(TEST_CONFIG[CHANGELOG_FILE])) |
| 466 | 514 |
| 467 def testIncrementVersion(self): | 515 def testIncrementVersion(self): |
| 468 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 516 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 469 self.MakeStep().Persist("build", "5") | 517 self.MakeStep().Persist("build", "5") |
| 470 | 518 |
| 471 self.ExpectReadline([ | 519 self.ExpectReadline([ |
| 472 "Y", # Increment build number. | 520 "Y", # Increment build number. |
| 473 ]) | 521 ]) |
| 474 | 522 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 565 |
| 518 msg = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 566 msg = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
| 519 self.assertTrue(re.search(r"Version 3\.22\.5", msg)) | 567 self.assertTrue(re.search(r"Version 3\.22\.5", msg)) |
| 520 self.assertTrue(re.search(r"Performance and stability", msg)) | 568 self.assertTrue(re.search(r"Performance and stability", msg)) |
| 521 self.assertTrue(re.search(r"Log text 1\. Chromium issue 12345", msg)) | 569 self.assertTrue(re.search(r"Log text 1\. Chromium issue 12345", msg)) |
| 522 self.assertFalse(re.search(r"\d+\-\d+\-\d+", msg)) | 570 self.assertFalse(re.search(r"\d+\-\d+\-\d+", msg)) |
| 523 | 571 |
| 524 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) | 572 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) |
| 525 self.assertTrue(re.search(r"patch content", patch)) | 573 self.assertTrue(re.search(r"patch content", patch)) |
| 526 | 574 |
| 527 def _PushToTrunk(self, force=False): | 575 def _PushToTrunk(self, force=False, manual=False): |
| 528 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 576 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
| 529 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 577 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 530 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 578 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 531 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 579 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
| 532 if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 580 if not os.path.exists(TEST_CONFIG[CHROMIUM]): |
| 533 os.makedirs(TEST_CONFIG[CHROMIUM]) | 581 os.makedirs(TEST_CONFIG[CHROMIUM]) |
| 534 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) | 582 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) |
| 535 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 583 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
| 536 TEST_CONFIG[DEPS_FILE]) | 584 TEST_CONFIG[DEPS_FILE]) |
| 537 os.environ["EDITOR"] = "vi" | 585 os.environ["EDITOR"] = "vi" |
| 538 | 586 |
| 539 def CheckPreparePush(): | 587 def CheckPreparePush(): |
| 540 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 588 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 541 self.assertTrue(re.search(r"Version 3.22.5", cl)) | 589 self.assertTrue(re.search(r"Version 3.22.5", cl)) |
| 542 self.assertTrue(re.search(r" Log text 1", cl)) | 590 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| 543 self.assertTrue(re.search(r" \(issue 321\)", cl)) | |
| 544 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) | 591 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) |
| 545 | 592 |
| 546 # Make sure all comments got stripped. | 593 # Make sure all comments got stripped. |
| 547 self.assertFalse(re.search(r"^#", cl, flags=re.M)) | 594 self.assertFalse(re.search(r"^#", cl, flags=re.M)) |
| 548 | 595 |
| 549 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 596 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 550 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) | 597 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 551 | 598 |
| 552 def CheckUpload(): | 599 def CheckUpload(): |
| 553 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 600 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 554 | 601 |
| 555 def CheckSVNCommit(): | 602 def CheckSVNCommit(): |
| 556 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 603 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
| 557 self.assertTrue(re.search(r"Version 3.22.5", commit)) | 604 self.assertTrue(re.search(r"Version 3.22.5", commit)) |
| 558 self.assertTrue(re.search(r"Log text 1. \(issue 321\)", commit)) | 605 self.assertTrue(re.search(r"Log text 1 \(issue 321\).", commit)) |
| 559 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 606 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 560 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 607 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
| 561 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 608 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
| 562 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) | 609 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 563 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) | 610 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) |
| 564 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 611 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
| 565 | 612 |
| 566 force_flag = " -f" if force else "" | 613 force_flag = " -f" if not manual else "" |
| 614 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" |
| 567 self.ExpectGit([ | 615 self.ExpectGit([ |
| 568 ["status -s -uno", ""], | 616 ["status -s -uno", ""], |
| 569 ["status -s -b -uno", "## some_branch\n"], | 617 ["status -s -b -uno", "## some_branch\n"], |
| 570 ["svn fetch", ""], | 618 ["svn fetch", ""], |
| 571 ["branch", " branch1\n* branch2\n"], | 619 ["branch", " branch1\n* branch2\n"], |
| 572 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 620 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
| 573 ["branch", " branch1\n* branch2\n"], | 621 ["branch", " branch1\n* branch2\n"], |
| 574 ["branch", " branch1\n* branch2\n"], | 622 ["branch", " branch1\n* branch2\n"], |
| 575 ["checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""], | 623 ["checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""], |
| 576 ["log -1 --format=%H ChangeLog", "1234\n"], | 624 ["log -1 --format=%H ChangeLog", "1234\n"], |
| 577 ["log -1 1234", "Last push ouput\n"], | 625 ["log -1 1234", "Last push ouput\n"], |
| 578 ["log 1234..HEAD --format=%H", "rev1\n"], | 626 ["log 1234..HEAD --format=%H", "rev1\n"], |
| 579 ["log -1 rev1 --format=\"%s\"", "Log text 1.\n"], | 627 ["log -1 rev1 --format=\"%s\"", "Log text 1.\n"], |
| 580 ["log -1 rev1 --format=\"%B\"", "Text\nLOG=YES\nBUG=v8:321\nText\n"], | 628 ["log -1 rev1 --format=\"%B\"", "Text\nLOG=YES\nBUG=v8:321\nText\n"], |
| 581 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org\n"], | 629 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org\n"], |
| 582 [("commit -a -m \"Prepare push to trunk. " | 630 [("commit -a -m \"Prepare push to trunk. " |
| 583 "Now working on version 3.22.6.\""), | 631 "Now working on version 3.22.6.%s\"" % review_suffix), |
| 584 " 2 files changed\n", | 632 " 2 files changed\n", |
| 585 CheckPreparePush], | 633 CheckPreparePush], |
| 586 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, | 634 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, |
| 587 "done\n"], | 635 "done\n"], |
| 588 ["cl dcommit -f", "Closing issue\n"], | 636 ["cl dcommit -f", "Closing issue\n"], |
| 589 ["svn fetch", "fetch result\n"], | 637 ["svn fetch", "fetch result\n"], |
| 590 ["checkout svn/bleeding_edge", ""], | 638 ["checkout svn/bleeding_edge", ""], |
| 591 [("log -1 --format=%H --grep=\"Prepare push to trunk. " | 639 [("log -1 --format=%H --grep=\"Prepare push to trunk. " |
| 592 "Now working on version 3.22.6.\""), | 640 "Now working on version 3.22.6.\""), |
| 593 "hash1\n"], | 641 "hash1\n"], |
| (...skipping 10 matching lines...) Expand all Loading... |
| 604 ["checkout -b v8-roll-123456", ""], | 652 ["checkout -b v8-roll-123456", ""], |
| 605 [("commit -am \"Update V8 to version 3.22.5.\n\n" | 653 [("commit -am \"Update V8 to version 3.22.5.\n\n" |
| 606 "TBR=reviewer@chromium.org\""), | 654 "TBR=reviewer@chromium.org\""), |
| 607 ""], | 655 ""], |
| 608 ["cl upload --send-mail%s" % force_flag, ""], | 656 ["cl upload --send-mail%s" % force_flag, ""], |
| 609 ["checkout -f some_branch", ""], | 657 ["checkout -f some_branch", ""], |
| 610 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 658 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
| 611 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], | 659 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], |
| 612 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""], | 660 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""], |
| 613 ]) | 661 ]) |
| 614 self.ExpectReadline([ | 662 |
| 615 "Y", # Confirm last push. | 663 # Expected keyboard input in manual mode: |
| 616 "", # Open editor. | 664 if manual: |
| 617 "Y", # Increment build number. | 665 self.ExpectReadline([ |
| 618 "reviewer@chromium.org", # V8 reviewer. | 666 "Y", # Confirm last push. |
| 619 "LGTX", # Enter LGTM for V8 CL (wrong). | 667 "", # Open editor. |
| 620 "LGTM", # Enter LGTM for V8 CL. | 668 "Y", # Increment build number. |
| 621 "Y", # Sanity check. | 669 "reviewer@chromium.org", # V8 reviewer. |
| 622 "reviewer@chromium.org", # Chromium reviewer. | 670 "LGTX", # Enter LGTM for V8 CL (wrong). |
| 623 ]) | 671 "LGTM", # Enter LGTM for V8 CL. |
| 624 if force: | 672 "Y", # Sanity check. |
| 625 # TODO(machenbach): The lgtm for the prepare push is just temporary. | 673 "reviewer@chromium.org", # Chromium reviewer. |
| 626 # There should be no user input in "force" mode. | 674 ]) |
| 675 |
| 676 # Expected keyboard input in semi-automatic mode: |
| 677 if not manual and not force: |
| 627 self.ExpectReadline([ | 678 self.ExpectReadline([ |
| 628 "LGTM", # Enter LGTM for V8 CL. | 679 "LGTM", # Enter LGTM for V8 CL. |
| 629 ]) | 680 ]) |
| 630 | 681 |
| 631 class Options( object ): | 682 # No keyboard input in forced mode: |
| 632 pass | 683 if force: |
| 684 self.ExpectReadline([]) |
| 633 | 685 |
| 634 options = Options() | 686 options = MakeOptions(f=force, m=manual, |
| 635 options.s = 0 | 687 r="reviewer@chromium.org" if not manual else None, |
| 636 options.l = None | 688 c = TEST_CONFIG[CHROMIUM]) |
| 637 options.f = force | |
| 638 options.r = "reviewer@chromium.org" if force else None | |
| 639 options.c = TEST_CONFIG[CHROMIUM] | |
| 640 RunPushToTrunk(TEST_CONFIG, options, self) | 689 RunPushToTrunk(TEST_CONFIG, options, self) |
| 641 | 690 |
| 642 deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 691 deps = FileToText(TEST_CONFIG[DEPS_FILE]) |
| 643 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 692 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |
| 644 | 693 |
| 645 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 694 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 646 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 695 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
| 647 self.assertTrue(re.search(r" Log text 1", cl)) | 696 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| 648 self.assertTrue(re.search(r" \(issue 321\)", cl)) | |
| 649 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 697 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
| 650 | 698 |
| 651 # Note: The version file is on build number 5 again in the end of this test | 699 # Note: The version file is on build number 5 again in the end of this test |
| 652 # since the git command that merges to the bleeding edge branch is mocked | 700 # since the git command that merges to the bleeding edge branch is mocked |
| 653 # out. | 701 # out. |
| 654 | 702 |
| 655 def testPushToTrunk(self): | 703 def testPushToTrunkManual(self): |
| 704 self._PushToTrunk(manual=True) |
| 705 |
| 706 def testPushToTrunkSemiAutomatic(self): |
| 656 self._PushToTrunk() | 707 self._PushToTrunk() |
| 657 | 708 |
| 658 def testPushToTrunkForced(self): | 709 def testPushToTrunkForced(self): |
| 659 self._PushToTrunk(force=True) | 710 self._PushToTrunk(force=True) |
| 660 | 711 |
| 661 def testAutoRoll(self): | 712 def testAutoRoll(self): |
| 662 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 713 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
| 663 | 714 |
| 664 # TODO(machenbach): Get rid of the editor check in automatic mode. | |
| 665 os.environ["EDITOR"] = "vi" | |
| 666 | |
| 667 self.ExpectReadURL([ | 715 self.ExpectReadURL([ |
| 716 ["https://v8-status.appspot.com/lkgr", Exception("Network problem")], |
| 668 ["https://v8-status.appspot.com/lkgr", "100"], | 717 ["https://v8-status.appspot.com/lkgr", "100"], |
| 669 ]) | 718 ]) |
| 670 | 719 |
| 671 self.ExpectGit([ | 720 self.ExpectGit([ |
| 672 ["status -s -uno", ""], | 721 ["status -s -uno", ""], |
| 673 ["status -s -b -uno", "## some_branch\n"], | 722 ["status -s -b -uno", "## some_branch\n"], |
| 674 ["svn fetch", ""], | 723 ["svn fetch", ""], |
| 675 ["svn log -1 --oneline", "r101 | Text"], | 724 ["svn log -1 --oneline", "r101 | Text"], |
| 676 ]) | 725 ]) |
| 677 | 726 |
| 678 # TODO(machenbach): Make a convenience wrapper for this. | 727 auto_roll.RunAutoRoll(TEST_CONFIG, MakeOptions(m=False, f=True), self) |
| 679 class Options( object ): | |
| 680 pass | |
| 681 | |
| 682 options = Options() | |
| 683 options.s = 0 | |
| 684 | |
| 685 auto_roll.RunAutoRoll(TEST_CONFIG, options, self) | |
| 686 | 728 |
| 687 self.assertEquals("100", self.MakeStep().Restore("lkgr")) | 729 self.assertEquals("100", self.MakeStep().Restore("lkgr")) |
| 688 self.assertEquals("101", self.MakeStep().Restore("latest")) | 730 self.assertEquals("101", self.MakeStep().Restore("latest")) |
| 731 |
| 732 |
| 733 class SystemTest(unittest.TestCase): |
| 734 def testReload(self): |
| 735 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, |
| 736 options=None, |
| 737 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) |
| 738 body = step.Reload( |
| 739 """------------------------------------------------------------------------ |
| 740 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines |
| 741 |
| 742 Prepare push to trunk. Now working on version 3.23.11. |
| 743 |
| 744 R=danno@chromium.org |
| 745 |
| 746 Review URL: https://codereview.chromium.org/83173002 |
| 747 |
| 748 ------------------------------------------------------------------------""") |
| 749 self.assertEquals( |
| 750 """Prepare push to trunk. Now working on version 3.23.11. |
| 751 |
| 752 R=danno@chromium.org |
| 753 |
| 754 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |