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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 # -----------------00--------10--------20--------30-------- | 245 # -----------------00--------10--------20--------30-------- |
246 self.assertEquals("(Chromium issues 234, 1234567890" | 246 self.assertEquals("(Chromium issues 234, 1234567890" |
247 ", 12345678901234567, " | 247 ", 12345678901234567, " |
248 "1234567890123456789)", | 248 "1234567890123456789)", |
249 MakeChangeLogBugReference("BUG=234\n" | 249 MakeChangeLogBugReference("BUG=234\n" |
250 "BUG=12345678901234567\n" | 250 "BUG=12345678901234567\n" |
251 "BUG=1234567890123456789\n" | 251 "BUG=1234567890123456789\n" |
252 "BUG=1234567890\n")) | 252 "BUG=1234567890\n")) |
253 | 253 |
254 | 254 |
255 def Git(*args, **kwargs): | 255 def Cmd(*args, **kwargs): |
256 """Convenience function returning a git test expectation.""" | 256 """Convenience function returning a git test expectation.""" |
257 return { | 257 return { |
258 "name": "git", | 258 "name": "git", |
259 "args": args[:-1], | 259 "args": args, |
260 "ret": args[-1], | 260 "ret": args[-1], |
261 "cb": kwargs.get("cb"), | 261 "cb": kwargs.get("cb"), |
262 } | 262 } |
263 | 263 |
264 | 264 |
265 def RL(text, cb=None): | 265 def RL(text, cb=None): |
266 """Convenience function returning a readline test expectation.""" | 266 """Convenience function returning a readline test expectation.""" |
267 return {"name": "readline", "args": [], "ret": text, "cb": cb} | 267 return {"name": "readline", "args": [], "ret": text, "cb": cb} |
268 | 268 |
269 | 269 |
270 def URL(*args, **kwargs): | 270 def URL(*args, **kwargs): |
271 """Convenience function returning a readurl test expectation.""" | 271 """Convenience function returning a readurl test expectation.""" |
272 return { | 272 return { |
273 "name": "readurl", | 273 "name": "readurl", |
274 "args": args[:-1], | 274 "args": args[:-1], |
275 "ret": args[-1], | 275 "ret": args[-1], |
276 "cb": kwargs.get("cb"), | 276 "cb": kwargs.get("cb"), |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 class SimpleMock(object): | 280 class SimpleMock(object): |
281 def __init__(self, name): | 281 def __init__(self, name): |
282 self._name = name | 282 self._name = name |
283 self._recipe = [] | 283 self._recipe = [] |
284 self._index = -1 | 284 self._index = -1 |
285 | 285 |
286 def Expect(self, recipe): | 286 def Expect(self, recipe): |
287 self._recipe = recipe | 287 self._recipe = recipe |
288 | 288 |
289 def Call(self, name, *args): # pragma: no cover | 289 def Call(self, *args): # pragma: no cover |
290 self._index += 1 | 290 self._index += 1 |
291 try: | 291 try: |
292 expected_call = self._recipe[self._index] | 292 expected_call = self._recipe[self._index] |
293 except IndexError: | 293 except IndexError: |
294 raise NoRetryException("Calling %s %s" % (name, " ".join(args))) | 294 raise NoRetryException("Calling %s %s" % (self._name, " ".join(args))) |
295 | 295 |
296 if not isinstance(expected_call, dict): | 296 if not isinstance(expected_call, dict): |
297 raise NoRetryException("Found wrong expectation type for %s %s" | 297 raise NoRetryException("Found wrong expectation type for %s %s" |
298 % (name, " ".join(args))) | 298 % (self._name, " ".join(args))) |
299 | 299 |
300 | 300 |
301 # The number of arguments in the expectation must match the actual | 301 # The number of arguments in the expectation must match the actual |
302 # arguments. | 302 # arguments. |
303 if len(args) > len(expected_call['args']): | 303 if len(args) > len(expected_call['args']): |
304 raise NoRetryException("When calling %s with arguments, the " | 304 raise NoRetryException("When calling %s with arguments, the " |
305 "expectations must consist of at least as many arguments." % name) | 305 "expectations must consist of at least as many arguments." % |
| 306 self._name) |
306 | 307 |
307 # Compare expected and actual arguments. | 308 # Compare expected and actual arguments. |
308 for (expected_arg, actual_arg) in zip(expected_call['args'], args): | 309 for (expected_arg, actual_arg) in zip(expected_call['args'], args): |
309 if expected_arg != actual_arg: | 310 if expected_arg != actual_arg: |
310 raise NoRetryException("Expected: %s - Actual: %s" | 311 raise NoRetryException("Expected: %s - Actual: %s" |
311 % (expected_arg, actual_arg)) | 312 % (expected_arg, actual_arg)) |
312 | 313 |
313 # The expected call contains an optional callback for checking the context | 314 # The expected call contains an optional callback for checking the context |
314 # at the time of the call. | 315 # at the time of the call. |
315 if expected_call['cb']: | 316 if expected_call['cb']: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 options = ScriptsBase(TEST_CONFIG, self, self._state).MakeOptions([]) | 354 options = ScriptsBase(TEST_CONFIG, self, self._state).MakeOptions([]) |
354 return MakeStep(step_class=Step, state=self._state, | 355 return MakeStep(step_class=Step, state=self._state, |
355 config=TEST_CONFIG, side_effect_handler=self, | 356 config=TEST_CONFIG, side_effect_handler=self, |
356 options=options) | 357 options=options) |
357 | 358 |
358 def RunStep(self, script=PushToTrunk, step_class=Step, args=None): | 359 def RunStep(self, script=PushToTrunk, step_class=Step, args=None): |
359 """Convenience wrapper.""" | 360 """Convenience wrapper.""" |
360 args = args if args is not None else ["-m"] | 361 args = args if args is not None else ["-m"] |
361 return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args) | 362 return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args) |
362 | 363 |
363 def GitMock(self, cmd, args="", pipe=True): | 364 def CmdMock(self, cmd, args="", pipe=True): |
364 print "%s %s" % (cmd, args) | 365 print "%s %s" % (cmd, args) |
365 return self._git_mock.Call("git", args) | 366 return self._cmd_mock.Call(cmd + " " + args) |
366 | 367 |
367 def LogMock(self, cmd, args=""): | 368 def LogMock(self, cmd, args=""): |
368 print "Log: %s %s" % (cmd, args) | 369 print "Log: %s %s" % (cmd, args) |
369 | 370 |
370 MOCKS = { | 371 MOCKS = { |
371 "gclient": GitMock, # TODO(machenbach): Yet another hack. Unify all mocks. | 372 "gclient": CmdMock, |
372 "git": GitMock, | 373 "git": CmdMock, |
373 "roll-dep": GitMock, # TODO(machenbach): Yet another hack. Unify all mocks. | 374 "roll-dep": CmdMock, |
374 # TODO(machenbach): Little hack to reuse the git mock for the one svn call | 375 "svn": CmdMock, |
375 # in merge-to-branch. The command should be made explicit in the test | |
376 # expectations. | |
377 "svn": GitMock, | |
378 "vi": LogMock, | 376 "vi": LogMock, |
379 } | 377 } |
380 | 378 |
381 def Call(self, fun, *args, **kwargs): | 379 def Call(self, fun, *args, **kwargs): |
382 print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs)) | 380 print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs)) |
383 | 381 |
384 def Command(self, cmd, args="", prefix="", pipe=True): | 382 def Command(self, cmd, args="", prefix="", pipe=True): |
385 return ScriptTest.MOCKS[cmd](self, cmd, args) | 383 return ScriptTest.MOCKS[cmd](self, cmd, args) |
386 | 384 |
387 def ReadLine(self): | 385 def ReadLine(self): |
388 return self._rl_mock.Call("readline") | 386 return self._rl_mock.Call() |
389 | 387 |
390 def ReadURL(self, url, params): | 388 def ReadURL(self, url, params): |
391 if params is not None: | 389 if params is not None: |
392 return self._url_mock.Call("readurl", url, params) | 390 return self._url_mock.Call(url, params) |
393 else: | 391 else: |
394 return self._url_mock.Call("readurl", url) | 392 return self._url_mock.Call(url) |
395 | 393 |
396 def ReadClusterFuzzAPI(self, api_key, **params): | 394 def ReadClusterFuzzAPI(self, api_key, **params): |
397 # TODO(machenbach): Use a mock for this and add a test that stops rolling | 395 # TODO(machenbach): Use a mock for this and add a test that stops rolling |
398 # due to clustefuzz results. | 396 # due to clustefuzz results. |
399 return [] | 397 return [] |
400 | 398 |
401 def Sleep(self, seconds): | 399 def Sleep(self, seconds): |
402 pass | 400 pass |
403 | 401 |
404 def GetDate(self): | 402 def GetDate(self): |
405 return "1999-07-31" | 403 return "1999-07-31" |
406 | 404 |
407 def GetUTCStamp(self): | 405 def GetUTCStamp(self): |
408 return "100000" | 406 return "100000" |
409 | 407 |
410 def ExpectGit(self, *args): | 408 def ExpectCmd(self, *args): |
411 """Convenience wrapper.""" | 409 """Convenience wrapper.""" |
412 self._git_mock.Expect(*args) | 410 self._cmd_mock.Expect(*args) |
413 | 411 |
414 def ExpectReadline(self, *args): | 412 def ExpectReadline(self, *args): |
415 """Convenience wrapper.""" | 413 """Convenience wrapper.""" |
416 self._rl_mock.Expect(*args) | 414 self._rl_mock.Expect(*args) |
417 | 415 |
418 def ExpectReadURL(self, *args): | 416 def ExpectReadURL(self, *args): |
419 """Convenience wrapper.""" | 417 """Convenience wrapper.""" |
420 self._url_mock.Expect(*args) | 418 self._url_mock.Expect(*args) |
421 | 419 |
422 def setUp(self): | 420 def setUp(self): |
423 self._git_mock = SimpleMock("git") | 421 self._cmd_mock = SimpleMock("command") |
424 self._rl_mock = SimpleMock("readline") | 422 self._rl_mock = SimpleMock("readline") |
425 self._url_mock = SimpleMock("readurl") | 423 self._url_mock = SimpleMock("readurl") |
426 self._tmp_files = [] | 424 self._tmp_files = [] |
427 self._state = {} | 425 self._state = {} |
428 | 426 |
429 def tearDown(self): | 427 def tearDown(self): |
430 Command("rm", "-rf %s*" % TEST_CONFIG[PERSISTFILE_BASENAME]) | 428 Command("rm", "-rf %s*" % TEST_CONFIG[PERSISTFILE_BASENAME]) |
431 | 429 |
432 # Clean up temps. Doesn't work automatically. | 430 # Clean up temps. Doesn't work automatically. |
433 for name in self._tmp_files: | 431 for name in self._tmp_files: |
434 if os.path.exists(name): | 432 if os.path.exists(name): |
435 os.remove(name) | 433 os.remove(name) |
436 | 434 |
437 self._git_mock.AssertFinished() | 435 self._cmd_mock.AssertFinished() |
438 self._rl_mock.AssertFinished() | 436 self._rl_mock.AssertFinished() |
439 self._url_mock.AssertFinished() | 437 self._url_mock.AssertFinished() |
440 | 438 |
441 def testGitOrig(self): | 439 def testGitOrig(self): |
442 self.assertTrue(Command("git", "--version").startswith("git version")) | 440 self.assertTrue(Command("git", "--version").startswith("git version")) |
443 | 441 |
444 def testGitMock(self): | 442 def testGitMock(self): |
445 self.ExpectGit([Git("--version", "git version 1.2.3"), Git("dummy", "")]) | 443 self.ExpectCmd([Cmd("git --version", "git version 1.2.3"), |
| 444 Cmd("git dummy", "")]) |
446 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) | 445 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) |
447 self.assertEquals("", self.MakeStep().Git("dummy")) | 446 self.assertEquals("", self.MakeStep().Git("dummy")) |
448 | 447 |
449 def testCommonPrepareDefault(self): | 448 def testCommonPrepareDefault(self): |
450 self.ExpectGit([ | 449 self.ExpectCmd([ |
451 Git("status -s -uno", ""), | 450 Cmd("git status -s -uno", ""), |
452 Git("status -s -b -uno", "## some_branch"), | 451 Cmd("git status -s -b -uno", "## some_branch"), |
453 Git("svn fetch", ""), | 452 Cmd("git svn fetch", ""), |
454 Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), | 453 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), |
455 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 454 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
456 ]) | 455 ]) |
457 self.ExpectReadline([RL("Y")]) | 456 self.ExpectReadline([RL("Y")]) |
458 self.MakeStep().CommonPrepare() | 457 self.MakeStep().CommonPrepare() |
459 self.MakeStep().PrepareBranch() | 458 self.MakeStep().PrepareBranch() |
460 self.assertEquals("some_branch", self._state["current_branch"]) | 459 self.assertEquals("some_branch", self._state["current_branch"]) |
461 | 460 |
462 def testCommonPrepareNoConfirm(self): | 461 def testCommonPrepareNoConfirm(self): |
463 self.ExpectGit([ | 462 self.ExpectCmd([ |
464 Git("status -s -uno", ""), | 463 Cmd("git status -s -uno", ""), |
465 Git("status -s -b -uno", "## some_branch"), | 464 Cmd("git status -s -b -uno", "## some_branch"), |
466 Git("svn fetch", ""), | 465 Cmd("git svn fetch", ""), |
467 Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), | 466 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), |
468 ]) | 467 ]) |
469 self.ExpectReadline([RL("n")]) | 468 self.ExpectReadline([RL("n")]) |
470 self.MakeStep().CommonPrepare() | 469 self.MakeStep().CommonPrepare() |
471 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 470 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
472 self.assertEquals("some_branch", self._state["current_branch"]) | 471 self.assertEquals("some_branch", self._state["current_branch"]) |
473 | 472 |
474 def testCommonPrepareDeleteBranchFailure(self): | 473 def testCommonPrepareDeleteBranchFailure(self): |
475 self.ExpectGit([ | 474 self.ExpectCmd([ |
476 Git("status -s -uno", ""), | 475 Cmd("git status -s -uno", ""), |
477 Git("status -s -b -uno", "## some_branch"), | 476 Cmd("git status -s -b -uno", "## some_branch"), |
478 Git("svn fetch", ""), | 477 Cmd("git svn fetch", ""), |
479 Git("branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), | 478 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG[BRANCHNAME]), |
480 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], None), | 479 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], None), |
481 ]) | 480 ]) |
482 self.ExpectReadline([RL("Y")]) | 481 self.ExpectReadline([RL("Y")]) |
483 self.MakeStep().CommonPrepare() | 482 self.MakeStep().CommonPrepare() |
484 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 483 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
485 self.assertEquals("some_branch", self._state["current_branch"]) | 484 self.assertEquals("some_branch", self._state["current_branch"]) |
486 | 485 |
487 def testInitialEnvironmentChecks(self): | 486 def testInitialEnvironmentChecks(self): |
488 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 487 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
489 os.environ["EDITOR"] = "vi" | 488 os.environ["EDITOR"] = "vi" |
490 self.MakeStep().InitialEnvironmentChecks() | 489 self.MakeStep().InitialEnvironmentChecks() |
(...skipping 24 matching lines...) Expand all Loading... |
515 " too much\n" | 514 " too much\n" |
516 " trailing", cl) | 515 " trailing", cl) |
517 | 516 |
518 self.assertEqual("//\n#define BUILD_NUMBER 3\n", | 517 self.assertEqual("//\n#define BUILD_NUMBER 3\n", |
519 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", | 518 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", |
520 r"\g<space>3", | 519 r"\g<space>3", |
521 "//\n#define BUILD_NUMBER 321\n")) | 520 "//\n#define BUILD_NUMBER 321\n")) |
522 | 521 |
523 def testPreparePushRevision(self): | 522 def testPreparePushRevision(self): |
524 # Tests the default push hash used when the --revision option is not set. | 523 # Tests the default push hash used when the --revision option is not set. |
525 self.ExpectGit([ | 524 self.ExpectCmd([ |
526 Git("log -1 --format=%H HEAD", "push_hash") | 525 Cmd("git log -1 --format=%H HEAD", "push_hash") |
527 ]) | 526 ]) |
528 | 527 |
529 self.RunStep(PushToTrunk, PreparePushRevision) | 528 self.RunStep(PushToTrunk, PreparePushRevision) |
530 self.assertEquals("push_hash", self._state["push_hash"]) | 529 self.assertEquals("push_hash", self._state["push_hash"]) |
531 | 530 |
532 def testPrepareChangeLog(self): | 531 def testPrepareChangeLog(self): |
533 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 532 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
534 self.WriteFakeVersionFile() | 533 self.WriteFakeVersionFile() |
535 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 534 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
536 | 535 |
537 self.ExpectGit([ | 536 self.ExpectCmd([ |
538 Git("log --format=%H 1234..push_hash", "rev1\nrev2\nrev3\nrev4"), | 537 Cmd("git log --format=%H 1234..push_hash", "rev1\nrev2\nrev3\nrev4"), |
539 Git("log -1 --format=%s rev1", "Title text 1"), | 538 Cmd("git log -1 --format=%s rev1", "Title text 1"), |
540 Git("log -1 --format=%B rev1", "Title\n\nBUG=\nLOG=y\n"), | 539 Cmd("git log -1 --format=%B rev1", "Title\n\nBUG=\nLOG=y\n"), |
541 Git("log -1 --format=%an rev1", "author1@chromium.org"), | 540 Cmd("git log -1 --format=%an rev1", "author1@chromium.org"), |
542 Git("log -1 --format=%s rev2", "Title text 2."), | 541 Cmd("git log -1 --format=%s rev2", "Title text 2."), |
543 Git("log -1 --format=%B rev2", "Title\n\nBUG=123\nLOG= \n"), | 542 Cmd("git log -1 --format=%B rev2", "Title\n\nBUG=123\nLOG= \n"), |
544 Git("log -1 --format=%an rev2", "author2@chromium.org"), | 543 Cmd("git log -1 --format=%an rev2", "author2@chromium.org"), |
545 Git("log -1 --format=%s rev3", "Title text 3"), | 544 Cmd("git log -1 --format=%s rev3", "Title text 3"), |
546 Git("log -1 --format=%B rev3", "Title\n\nBUG=321\nLOG=true\n"), | 545 Cmd("git log -1 --format=%B rev3", "Title\n\nBUG=321\nLOG=true\n"), |
547 Git("log -1 --format=%an rev3", "author3@chromium.org"), | 546 Cmd("git log -1 --format=%an rev3", "author3@chromium.org"), |
548 Git("log -1 --format=%s rev4", "Title text 4"), | 547 Cmd("git log -1 --format=%s rev4", "Title text 4"), |
549 Git("log -1 --format=%B rev4", | 548 Cmd("git log -1 --format=%B rev4", |
550 ("Title\n\nBUG=456\nLOG=Y\n\n" | 549 ("Title\n\nBUG=456\nLOG=Y\n\n" |
551 "Review URL: https://codereview.chromium.org/9876543210\n")), | 550 "Review URL: https://codereview.chromium.org/9876543210\n")), |
552 Git("log -1 --format=%an rev4", "author4@chromium.org"), | 551 Cmd("git log -1 --format=%an rev4", "author4@chromium.org"), |
553 ]) | 552 ]) |
554 | 553 |
555 # The cl for rev4 on rietveld has an updated LOG flag. | 554 # The cl for rev4 on rietveld has an updated LOG flag. |
556 self.ExpectReadURL([ | 555 self.ExpectReadURL([ |
557 URL("https://codereview.chromium.org/9876543210/description", | 556 URL("https://codereview.chromium.org/9876543210/description", |
558 "Title\n\nBUG=456\nLOG=N\n\n"), | 557 "Title\n\nBUG=456\nLOG=N\n\n"), |
559 ]) | 558 ]) |
560 | 559 |
561 self._state["last_push_bleeding_edge"] = "1234" | 560 self._state["last_push_bleeding_edge"] = "1234" |
562 self._state["push_hash"] = "push_hash" | 561 self._state["push_hash"] = "push_hash" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 608 |
610 # Version on trunk: 3.22.4.0. Version on master (bleeding_edge): 3.22.6. | 609 # Version on trunk: 3.22.4.0. Version on master (bleeding_edge): 3.22.6. |
611 # Make sure that the increment is 3.22.7.0. | 610 # Make sure that the increment is 3.22.7.0. |
612 def testIncrementVersion(self): | 611 def testIncrementVersion(self): |
613 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 612 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
614 self.WriteFakeVersionFile() | 613 self.WriteFakeVersionFile() |
615 self._state["last_push_trunk"] = "hash1" | 614 self._state["last_push_trunk"] = "hash1" |
616 self._state["latest_build"] = "6" | 615 self._state["latest_build"] = "6" |
617 self._state["latest_version"] = "3.22.6.0" | 616 self._state["latest_version"] = "3.22.6.0" |
618 | 617 |
619 self.ExpectGit([ | 618 self.ExpectCmd([ |
620 Git("checkout -f hash1 -- %s" % TEST_CONFIG[VERSION_FILE], ""), | 619 Cmd("git checkout -f hash1 -- %s" % TEST_CONFIG[VERSION_FILE], ""), |
621 Git("checkout -f svn/bleeding_edge -- %s" % TEST_CONFIG[VERSION_FILE], | 620 Cmd(("git checkout -f svn/bleeding_edge -- %s" % |
| 621 TEST_CONFIG[VERSION_FILE]), |
622 "", cb=lambda: self.WriteFakeVersionFile(22, 6)), | 622 "", cb=lambda: self.WriteFakeVersionFile(22, 6)), |
623 ]) | 623 ]) |
624 | 624 |
625 self.ExpectReadline([ | 625 self.ExpectReadline([ |
626 RL("Y"), # Increment build number. | 626 RL("Y"), # Increment build number. |
627 ]) | 627 ]) |
628 | 628 |
629 self.RunStep(PushToTrunk, IncrementVersion) | 629 self.RunStep(PushToTrunk, IncrementVersion) |
630 | 630 |
631 self.assertEquals("3", self._state["new_major"]) | 631 self.assertEquals("3", self._state["new_major"]) |
632 self.assertEquals("22", self._state["new_minor"]) | 632 self.assertEquals("22", self._state["new_minor"]) |
633 self.assertEquals("7", self._state["new_build"]) | 633 self.assertEquals("7", self._state["new_build"]) |
634 self.assertEquals("0", self._state["new_patch"]) | 634 self.assertEquals("0", self._state["new_patch"]) |
635 | 635 |
636 def _TestSquashCommits(self, change_log, expected_msg): | 636 def _TestSquashCommits(self, change_log, expected_msg): |
637 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 637 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
638 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: | 638 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: |
639 f.write(change_log) | 639 f.write(change_log) |
640 | 640 |
641 self.ExpectGit([ | 641 self.ExpectCmd([ |
642 Git("diff svn/trunk hash1", "patch content"), | 642 Cmd("git diff svn/trunk hash1", "patch content"), |
643 Git("svn find-rev hash1", "123455\n"), | 643 Cmd("git svn find-rev hash1", "123455\n"), |
644 ]) | 644 ]) |
645 | 645 |
646 self._state["push_hash"] = "hash1" | 646 self._state["push_hash"] = "hash1" |
647 self._state["date"] = "1999-11-11" | 647 self._state["date"] = "1999-11-11" |
648 | 648 |
649 self.RunStep(PushToTrunk, SquashCommits) | 649 self.RunStep(PushToTrunk, SquashCommits) |
650 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) | 650 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) |
651 | 651 |
652 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) | 652 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) |
653 self.assertTrue(re.search(r"patch content", patch)) | 653 self.assertTrue(re.search(r"patch content", patch)) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 | 735 |
736 Performance and stability improvements on all platforms. | 736 Performance and stability improvements on all platforms. |
737 | 737 |
738 | 738 |
739 1999-04-05: Version 3.22.4 | 739 1999-04-05: Version 3.22.4 |
740 | 740 |
741 Performance and stability improvements on all platforms.\n""", | 741 Performance and stability improvements on all platforms.\n""", |
742 change_log) | 742 change_log) |
743 | 743 |
744 force_flag = " -f" if not manual else "" | 744 force_flag = " -f" if not manual else "" |
745 self.ExpectGit([ | 745 self.ExpectCmd([ |
746 Git("status -s -uno", ""), | 746 Cmd("git status -s -uno", ""), |
747 Git("status -s -b -uno", "## some_branch\n"), | 747 Cmd("git status -s -b -uno", "## some_branch\n"), |
748 Git("svn fetch", ""), | 748 Cmd("git svn fetch", ""), |
749 Git("branch", " branch1\n* branch2\n"), | 749 Cmd("git branch", " branch1\n* branch2\n"), |
750 Git("branch", " branch1\n* branch2\n"), | 750 Cmd("git branch", " branch1\n* branch2\n"), |
751 Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), | 751 Cmd("git checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], |
752 Git("svn find-rev r123455", "push_hash\n"), | 752 ""), |
753 Git(("log -1 --format=%H --grep=" | 753 Cmd("git svn find-rev r123455", "push_hash\n"), |
| 754 Cmd(("git log -1 --format=%H --grep=" |
754 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 755 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
755 "svn/trunk"), "hash2\n"), | 756 "svn/trunk"), "hash2\n"), |
756 Git("log -1 hash2", "Log message\n"), | 757 Cmd("git log -1 hash2", "Log message\n"), |
757 Git("log -1 --format=%s hash2", | 758 Cmd("git log -1 --format=%s hash2", |
758 "Version 3.4.5 (based on bleeding_edge revision r1234)\n"), | 759 "Version 3.4.5 (based on bleeding_edge revision r1234)\n"), |
759 Git("svn find-rev r1234", "hash3\n"), | 760 Cmd("git svn find-rev r1234", "hash3\n"), |
760 Git("checkout -f svn/bleeding_edge -- %s" % TEST_CONFIG[VERSION_FILE], | 761 Cmd(("git checkout -f svn/bleeding_edge -- %s" % |
| 762 TEST_CONFIG[VERSION_FILE]), |
761 "", cb=self.WriteFakeVersionFile), | 763 "", cb=self.WriteFakeVersionFile), |
762 Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 764 Cmd("git checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
763 cb=self.WriteFakeVersionFile), | 765 cb=self.WriteFakeVersionFile), |
764 Git("log --format=%H hash3..push_hash", "rev1\n"), | 766 Cmd("git log --format=%H hash3..push_hash", "rev1\n"), |
765 Git("log -1 --format=%s rev1", "Log text 1.\n"), | 767 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), |
766 Git("log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), | 768 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), |
767 Git("log -1 --format=%an rev1", "author1@chromium.org\n"), | 769 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), |
768 Git("svn fetch", "fetch result\n"), | 770 Cmd("git svn fetch", "fetch result\n"), |
769 Git("checkout -f svn/bleeding_edge", ""), | 771 Cmd("git checkout -f svn/bleeding_edge", ""), |
770 Git("diff svn/trunk push_hash", "patch content\n"), | 772 Cmd("git diff svn/trunk push_hash", "patch content\n"), |
771 Git("svn find-rev push_hash", "123455\n"), | 773 Cmd("git svn find-rev push_hash", "123455\n"), |
772 Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", | 774 Cmd("git checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "", |
773 cb=ResetToTrunk), | 775 cb=ResetToTrunk), |
774 Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 776 Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), |
775 Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", | 777 Cmd("git checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", |
776 cb=ResetChangeLog), | 778 cb=ResetChangeLog), |
777 Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", | 779 Cmd("git checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", |
778 cb=self.WriteFakeVersionFile), | 780 cb=self.WriteFakeVersionFile), |
779 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 781 Cmd("git commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", |
780 cb=CheckSVNCommit), | 782 cb=CheckSVNCommit), |
781 Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), | 783 Cmd("git svn dcommit 2>&1", |
782 Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), | 784 "Some output\nCommitted r123456\nSome output\n"), |
783 Git("checkout -f some_branch", ""), | 785 Cmd("git svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), |
784 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 786 Cmd("git checkout -f some_branch", ""), |
785 Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""), | 787 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
| 788 Cmd("git branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""), |
786 ]) | 789 ]) |
787 | 790 |
788 # Expected keyboard input in manual mode: | 791 # Expected keyboard input in manual mode: |
789 if manual: | 792 if manual: |
790 self.ExpectReadline([ | 793 self.ExpectReadline([ |
791 RL("Y"), # Confirm last push. | 794 RL("Y"), # Confirm last push. |
792 RL(""), # Open editor. | 795 RL(""), # Open editor. |
793 RL("Y"), # Increment build number. | 796 RL("Y"), # Increment build number. |
794 RL("Y"), # Sanity check. | 797 RL("Y"), # Sanity check. |
795 ]) | 798 ]) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): | 840 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): |
838 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) | 841 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) |
839 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 842 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
840 TEST_CONFIG[DEPS_FILE]) | 843 TEST_CONFIG[DEPS_FILE]) |
841 def WriteDeps(): | 844 def WriteDeps(): |
842 TextToFile("Some line\n \"v8_revision\": \"123455\",\n some line", | 845 TextToFile("Some line\n \"v8_revision\": \"123455\",\n some line", |
843 TEST_CONFIG[DEPS_FILE]) | 846 TEST_CONFIG[DEPS_FILE]) |
844 | 847 |
845 os.environ["EDITOR"] = "vi" | 848 os.environ["EDITOR"] = "vi" |
846 force_flag = " -f" if not manual else "" | 849 force_flag = " -f" if not manual else "" |
847 self.ExpectGit([ | 850 self.ExpectCmd([ |
848 Git("status -s -uno", ""), | 851 Cmd("git status -s -uno", ""), |
849 Git("status -s -b -uno", "## some_branch\n"), | 852 Cmd("git status -s -b -uno", "## some_branch\n"), |
850 Git("svn fetch", ""), | 853 Cmd("git svn fetch", ""), |
851 Git(("log -1 --format=%H --grep=" | 854 Cmd(("git log -1 --format=%H --grep=" |
852 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 855 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
853 "svn/trunk"), "push_hash\n"), | 856 "svn/trunk"), "push_hash\n"), |
854 Git("svn find-rev push_hash", "123455\n"), | 857 Cmd("git svn find-rev push_hash", "123455\n"), |
855 Git("log -1 --format=%s push_hash", | 858 Cmd("git log -1 --format=%s push_hash", |
856 "Version 3.22.5 (based on bleeding_edge revision r123454)\n"), | 859 "Version 3.22.5 (based on bleeding_edge revision r123454)\n"), |
857 Git("status -s -uno", ""), | 860 Cmd("git status -s -uno", ""), |
858 Git("checkout -f master", ""), | 861 Cmd("git checkout -f master", ""), |
859 Git("sync --nohooks", "syncing..."), | 862 Cmd("gclient sync --nohooks", "syncing..."), |
860 Git("fetch origin", ""), | 863 Cmd("git fetch origin", ""), |
861 Git("checkout -b v8-roll-123455", ""), | 864 Cmd("git checkout -b v8-roll-123455", ""), |
862 Git("v8 123455", "rolled", cb=WriteDeps), | 865 Cmd("roll-dep v8 123455", "rolled", cb=WriteDeps), |
863 Git(("commit -am \"Update V8 to version 3.22.5 " | 866 Cmd(("git commit -am \"Update V8 to version 3.22.5 " |
864 "(based on bleeding_edge revision r123454).\n\n" | 867 "(based on bleeding_edge revision r123454).\n\n" |
865 "Please reply to the V8 sheriff c_name@chromium.org in " | 868 "Please reply to the V8 sheriff c_name@chromium.org in " |
866 "case of problems.\n\nTBR=c_name@chromium.org\""), | 869 "case of problems.\n\nTBR=c_name@chromium.org\""), |
867 ""), | 870 ""), |
868 Git(("cl upload --send-mail --email \"author@chromium.org\"%s" | 871 Cmd(("git cl upload --send-mail --email \"author@chromium.org\"%s" |
869 % force_flag), ""), | 872 % force_flag), ""), |
870 ]) | 873 ]) |
871 | 874 |
872 self.ExpectReadURL([ | 875 self.ExpectReadURL([ |
873 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", | 876 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", |
874 "document.write('g_name')"), | 877 "document.write('g_name')"), |
875 ]) | 878 ]) |
876 | 879 |
877 # Expected keyboard input in manual mode: | 880 # Expected keyboard input in manual mode: |
878 if manual: | 881 if manual: |
(...skipping 18 matching lines...) Expand all Loading... |
897 def testChromiumRollManual(self): | 900 def testChromiumRollManual(self): |
898 self._ChromiumRoll(manual=True) | 901 self._ChromiumRoll(manual=True) |
899 | 902 |
900 def testChromiumRollSemiAutomatic(self): | 903 def testChromiumRollSemiAutomatic(self): |
901 self._ChromiumRoll() | 904 self._ChromiumRoll() |
902 | 905 |
903 def testChromiumRollForced(self): | 906 def testChromiumRollForced(self): |
904 self._ChromiumRoll(force=True) | 907 self._ChromiumRoll(force=True) |
905 | 908 |
906 def testCheckLastPushRecently(self): | 909 def testCheckLastPushRecently(self): |
907 self.ExpectGit([ | 910 self.ExpectCmd([ |
908 Git(("log -1 --format=%H --grep=" | 911 Cmd(("git log -1 --format=%H --grep=" |
909 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 912 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
910 "svn/trunk"), "hash2\n"), | 913 "svn/trunk"), "hash2\n"), |
911 Git("log -1 --format=%s hash2", | 914 Cmd("git log -1 --format=%s hash2", |
912 "Version 3.4.5 (based on bleeding_edge revision r99)\n"), | 915 "Version 3.4.5 (based on bleeding_edge revision r99)\n"), |
913 ]) | 916 ]) |
914 | 917 |
915 self._state["lkgr"] = "101" | 918 self._state["lkgr"] = "101" |
916 | 919 |
917 self.assertRaises(Exception, lambda: self.RunStep(auto_push.AutoPush, | 920 self.assertRaises(Exception, lambda: self.RunStep(auto_push.AutoPush, |
918 CheckLastPush, | 921 CheckLastPush, |
919 AUTO_PUSH_ARGS)) | 922 AUTO_PUSH_ARGS)) |
920 | 923 |
921 def testAutoPush(self): | 924 def testAutoPush(self): |
922 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 925 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
923 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" | 926 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" |
924 | 927 |
925 self.ExpectReadURL([ | 928 self.ExpectReadURL([ |
926 URL("https://v8-status.appspot.com/current?format=json", | 929 URL("https://v8-status.appspot.com/current?format=json", |
927 "{\"message\": \"Tree is throttled\"}"), | 930 "{\"message\": \"Tree is throttled\"}"), |
928 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), | 931 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), |
929 URL("https://v8-status.appspot.com/lkgr", "100"), | 932 URL("https://v8-status.appspot.com/lkgr", "100"), |
930 ]) | 933 ]) |
931 | 934 |
932 self.ExpectGit([ | 935 self.ExpectCmd([ |
933 Git("status -s -uno", ""), | 936 Cmd("git status -s -uno", ""), |
934 Git("status -s -b -uno", "## some_branch\n"), | 937 Cmd("git status -s -b -uno", "## some_branch\n"), |
935 Git("svn fetch", ""), | 938 Cmd("git svn fetch", ""), |
936 Git(("log -1 --format=%H --grep=\"" | 939 Cmd(("git log -1 --format=%H --grep=\"" |
937 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" | 940 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" |
938 " svn/trunk"), "push_hash\n"), | 941 " svn/trunk"), "push_hash\n"), |
939 Git("log -1 --format=%s push_hash", | 942 Cmd("git log -1 --format=%s push_hash", |
940 "Version 3.4.5 (based on bleeding_edge revision r79)\n"), | 943 "Version 3.4.5 (based on bleeding_edge revision r79)\n"), |
941 ]) | 944 ]) |
942 | 945 |
943 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) | 946 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) |
944 | 947 |
945 state = json.loads(FileToText("%s-state.json" | 948 state = json.loads(FileToText("%s-state.json" |
946 % TEST_CONFIG[PERSISTFILE_BASENAME])) | 949 % TEST_CONFIG[PERSISTFILE_BASENAME])) |
947 | 950 |
948 self.assertEquals("100", state["lkgr"]) | 951 self.assertEquals("100", state["lkgr"]) |
949 | 952 |
950 def testAutoPushStoppedBySettings(self): | 953 def testAutoPushStoppedBySettings(self): |
951 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 954 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
952 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() | 955 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() |
953 TextToFile("{\"enable_auto_push\": false}", TEST_CONFIG[SETTINGS_LOCATION]) | 956 TextToFile("{\"enable_auto_push\": false}", TEST_CONFIG[SETTINGS_LOCATION]) |
954 | 957 |
955 self.ExpectReadURL([]) | 958 self.ExpectReadURL([]) |
956 | 959 |
957 self.ExpectGit([ | 960 self.ExpectCmd([ |
958 Git("status -s -uno", ""), | 961 Cmd("git status -s -uno", ""), |
959 Git("status -s -b -uno", "## some_branch\n"), | 962 Cmd("git status -s -b -uno", "## some_branch\n"), |
960 Git("svn fetch", ""), | 963 Cmd("git svn fetch", ""), |
961 ]) | 964 ]) |
962 | 965 |
963 def RunAutoPush(): | 966 def RunAutoPush(): |
964 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) | 967 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) |
965 self.assertRaises(Exception, RunAutoPush) | 968 self.assertRaises(Exception, RunAutoPush) |
966 | 969 |
967 def testAutoPushStoppedByTreeStatus(self): | 970 def testAutoPushStoppedByTreeStatus(self): |
968 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 971 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
969 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" | 972 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" |
970 | 973 |
971 self.ExpectReadURL([ | 974 self.ExpectReadURL([ |
972 URL("https://v8-status.appspot.com/current?format=json", | 975 URL("https://v8-status.appspot.com/current?format=json", |
973 "{\"message\": \"Tree is throttled (no push)\"}"), | 976 "{\"message\": \"Tree is throttled (no push)\"}"), |
974 ]) | 977 ]) |
975 | 978 |
976 self.ExpectGit([ | 979 self.ExpectCmd([ |
977 Git("status -s -uno", ""), | 980 Cmd("git status -s -uno", ""), |
978 Git("status -s -b -uno", "## some_branch\n"), | 981 Cmd("git status -s -b -uno", "## some_branch\n"), |
979 Git("svn fetch", ""), | 982 Cmd("git svn fetch", ""), |
980 ]) | 983 ]) |
981 | 984 |
982 def RunAutoPush(): | 985 def RunAutoPush(): |
983 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) | 986 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS) |
984 self.assertRaises(Exception, RunAutoPush) | 987 self.assertRaises(Exception, RunAutoPush) |
985 | 988 |
986 def testAutoRollExistingRoll(self): | 989 def testAutoRollExistingRoll(self): |
987 self.ExpectReadURL([ | 990 self.ExpectReadURL([ |
988 URL("https://codereview.chromium.org/search", | 991 URL("https://codereview.chromium.org/search", |
989 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 992 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
(...skipping 19 matching lines...) Expand all Loading... |
1009 | 1012 |
1010 def testAutoRollUpToDate(self): | 1013 def testAutoRollUpToDate(self): |
1011 self.ExpectReadURL([ | 1014 self.ExpectReadURL([ |
1012 URL("https://codereview.chromium.org/search", | 1015 URL("https://codereview.chromium.org/search", |
1013 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1016 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
1014 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1017 ("{\"results\": [{\"subject\": \"different\"}]}")), |
1015 URL("http://src.chromium.org/svn/trunk/src/DEPS", | 1018 URL("http://src.chromium.org/svn/trunk/src/DEPS", |
1016 self.FAKE_DEPS), | 1019 self.FAKE_DEPS), |
1017 ]) | 1020 ]) |
1018 | 1021 |
1019 self.ExpectGit([ | 1022 self.ExpectCmd([ |
1020 Git(("log -1 --format=%H --grep=" | 1023 Cmd(("git log -1 --format=%H --grep=" |
1021 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 1024 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
1022 "svn/trunk"), "push_hash\n"), | 1025 "svn/trunk"), "push_hash\n"), |
1023 Git("svn find-rev push_hash", "123455\n"), | 1026 Cmd("git svn find-rev push_hash", "123455\n"), |
1024 ]) | 1027 ]) |
1025 | 1028 |
1026 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1029 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
1027 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) | 1030 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) |
1028 self.assertEquals(1, result) | 1031 self.assertEquals(1, result) |
1029 | 1032 |
1030 def testAutoRoll(self): | 1033 def testAutoRoll(self): |
1031 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile() | 1034 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile() |
1032 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE]) | 1035 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE]) |
1033 self.ExpectReadURL([ | 1036 self.ExpectReadURL([ |
1034 URL("https://codereview.chromium.org/search", | 1037 URL("https://codereview.chromium.org/search", |
1035 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1038 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
1036 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1039 ("{\"results\": [{\"subject\": \"different\"}]}")), |
1037 URL("http://src.chromium.org/svn/trunk/src/DEPS", | 1040 URL("http://src.chromium.org/svn/trunk/src/DEPS", |
1038 self.FAKE_DEPS), | 1041 self.FAKE_DEPS), |
1039 ]) | 1042 ]) |
1040 | 1043 |
1041 self.ExpectGit([ | 1044 self.ExpectCmd([ |
1042 Git(("log -1 --format=%H --grep=" | 1045 Cmd(("git log -1 --format=%H --grep=" |
1043 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 1046 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
1044 "svn/trunk"), "push_hash\n"), | 1047 "svn/trunk"), "push_hash\n"), |
1045 Git("svn find-rev push_hash", "123456\n"), | 1048 Cmd("git svn find-rev push_hash", "123456\n"), |
1046 ]) | 1049 ]) |
1047 | 1050 |
1048 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1051 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
1049 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"]) | 1052 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"]) |
1050 self.assertEquals(0, result) | 1053 self.assertEquals(0, result) |
1051 | 1054 |
1052 def testMergeToBranch(self): | 1055 def testMergeToBranch(self): |
1053 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() | 1056 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() |
1054 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 1057 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
1055 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1058 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
(...skipping 23 matching lines...) Expand all Loading... |
1079 | 1082 |
1080 def VerifySVNCommit(): | 1083 def VerifySVNCommit(): |
1081 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 1084 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
1082 self.assertEquals(msg, commit) | 1085 self.assertEquals(msg, commit) |
1083 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 1086 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
1084 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 1087 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
1085 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 1088 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
1086 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version)) | 1089 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version)) |
1087 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 1090 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
1088 | 1091 |
1089 self.ExpectGit([ | 1092 self.ExpectCmd([ |
1090 Git("status -s -uno", ""), | 1093 Cmd("git status -s -uno", ""), |
1091 Git("status -s -b -uno", "## some_branch\n"), | 1094 Cmd("git status -s -b -uno", "## some_branch\n"), |
1092 Git("svn fetch", ""), | 1095 Cmd("git svn fetch", ""), |
1093 Git("branch", " branch1\n* branch2\n"), | 1096 Cmd("git branch", " branch1\n* branch2\n"), |
1094 Git("checkout -b %s svn/trunk" % TEST_CONFIG[BRANCHNAME], ""), | 1097 Cmd("git checkout -b %s svn/trunk" % TEST_CONFIG[BRANCHNAME], ""), |
1095 Git("log --format=%H --grep=\"Port r12345\" --reverse svn/bleeding_edge", | 1098 Cmd(("git log --format=%H --grep=\"Port r12345\" " |
| 1099 "--reverse svn/bleeding_edge"), |
1096 "hash1\nhash2"), | 1100 "hash1\nhash2"), |
1097 Git("svn find-rev hash1 svn/bleeding_edge", "45678"), | 1101 Cmd("git svn find-rev hash1 svn/bleeding_edge", "45678"), |
1098 Git("log -1 --format=%s hash1", "Title1"), | 1102 Cmd("git log -1 --format=%s hash1", "Title1"), |
1099 Git("svn find-rev hash2 svn/bleeding_edge", "23456"), | 1103 Cmd("git svn find-rev hash2 svn/bleeding_edge", "23456"), |
1100 Git("log -1 --format=%s hash2", "Title2"), | 1104 Cmd("git log -1 --format=%s hash2", "Title2"), |
1101 Git("log --format=%H --grep=\"Port r23456\" --reverse svn/bleeding_edge", | 1105 Cmd(("git log --format=%H --grep=\"Port r23456\" " |
| 1106 "--reverse svn/bleeding_edge"), |
1102 ""), | 1107 ""), |
1103 Git("log --format=%H --grep=\"Port r34567\" --reverse svn/bleeding_edge", | 1108 Cmd(("git log --format=%H --grep=\"Port r34567\" " |
| 1109 "--reverse svn/bleeding_edge"), |
1104 "hash3"), | 1110 "hash3"), |
1105 Git("svn find-rev hash3 svn/bleeding_edge", "56789"), | 1111 Cmd("git svn find-rev hash3 svn/bleeding_edge", "56789"), |
1106 Git("log -1 --format=%s hash3", "Title3"), | 1112 Cmd("git log -1 --format=%s hash3", "Title3"), |
1107 Git("svn find-rev r12345 svn/bleeding_edge", "hash4"), | 1113 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"), |
1108 # Simulate svn being down which stops the script. | 1114 # Simulate svn being down which stops the script. |
1109 Git("svn find-rev r23456 svn/bleeding_edge", None), | 1115 Cmd("git svn find-rev r23456 svn/bleeding_edge", None), |
1110 # Restart script in the failing step. | 1116 # Restart script in the failing step. |
1111 Git("svn find-rev r12345 svn/bleeding_edge", "hash4"), | 1117 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"), |
1112 Git("svn find-rev r23456 svn/bleeding_edge", "hash2"), | 1118 Cmd("git svn find-rev r23456 svn/bleeding_edge", "hash2"), |
1113 Git("svn find-rev r34567 svn/bleeding_edge", "hash3"), | 1119 Cmd("git svn find-rev r34567 svn/bleeding_edge", "hash3"), |
1114 Git("svn find-rev r45678 svn/bleeding_edge", "hash1"), | 1120 Cmd("git svn find-rev r45678 svn/bleeding_edge", "hash1"), |
1115 Git("svn find-rev r56789 svn/bleeding_edge", "hash5"), | 1121 Cmd("git svn find-rev r56789 svn/bleeding_edge", "hash5"), |
1116 Git("log -1 --format=%s hash4", "Title4"), | 1122 Cmd("git log -1 --format=%s hash4", "Title4"), |
1117 Git("log -1 --format=%s hash2", "Title2"), | 1123 Cmd("git log -1 --format=%s hash2", "Title2"), |
1118 Git("log -1 --format=%s hash3", "Title3"), | 1124 Cmd("git log -1 --format=%s hash3", "Title3"), |
1119 Git("log -1 --format=%s hash1", "Title1"), | 1125 Cmd("git log -1 --format=%s hash1", "Title1"), |
1120 Git("log -1 --format=%s hash5", "Revert \"Something\""), | 1126 Cmd("git log -1 --format=%s hash5", "Revert \"Something\""), |
1121 Git("log -1 hash4", "Title4\nBUG=123\nBUG=234"), | 1127 Cmd("git log -1 hash4", "Title4\nBUG=123\nBUG=234"), |
1122 Git("log -1 hash2", "Title2\n BUG = v8:123,345"), | 1128 Cmd("git log -1 hash2", "Title2\n BUG = v8:123,345"), |
1123 Git("log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"), | 1129 Cmd("git log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"), |
1124 Git("log -1 hash1", "Title1\nBUG="), | 1130 Cmd("git log -1 hash1", "Title1\nBUG="), |
1125 Git("log -1 hash5", "Revert \"Something\"\nBUG=none"), | 1131 Cmd("git log -1 hash5", "Revert \"Something\"\nBUG=none"), |
1126 Git("log -1 -p hash4", "patch4"), | 1132 Cmd("git log -1 -p hash4", "patch4"), |
1127 Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], | 1133 Cmd(("git apply --index --reject \"%s\"" % |
| 1134 TEST_CONFIG[TEMPORARY_PATCH_FILE]), |
1128 "", cb=VerifyPatch("patch4")), | 1135 "", cb=VerifyPatch("patch4")), |
1129 Git("log -1 -p hash2", "patch2"), | 1136 Cmd("git log -1 -p hash2", "patch2"), |
1130 Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], | 1137 Cmd(("git apply --index --reject \"%s\"" % |
| 1138 TEST_CONFIG[TEMPORARY_PATCH_FILE]), |
1131 "", cb=VerifyPatch("patch2")), | 1139 "", cb=VerifyPatch("patch2")), |
1132 Git("log -1 -p hash3", "patch3"), | 1140 Cmd("git log -1 -p hash3", "patch3"), |
1133 Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], | 1141 Cmd(("git apply --index --reject \"%s\"" % |
| 1142 TEST_CONFIG[TEMPORARY_PATCH_FILE]), |
1134 "", cb=VerifyPatch("patch3")), | 1143 "", cb=VerifyPatch("patch3")), |
1135 Git("log -1 -p hash1", "patch1"), | 1144 Cmd("git log -1 -p hash1", "patch1"), |
1136 Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], | 1145 Cmd(("git apply --index --reject \"%s\"" % |
| 1146 TEST_CONFIG[TEMPORARY_PATCH_FILE]), |
1137 "", cb=VerifyPatch("patch1")), | 1147 "", cb=VerifyPatch("patch1")), |
1138 Git("log -1 -p hash5", "patch5\n"), | 1148 Cmd("git log -1 -p hash5", "patch5\n"), |
1139 Git("apply --index --reject \"%s\"" % TEST_CONFIG[TEMPORARY_PATCH_FILE], | 1149 Cmd(("git apply --index --reject \"%s\"" % |
| 1150 TEST_CONFIG[TEMPORARY_PATCH_FILE]), |
1140 "", cb=VerifyPatch("patch5\n")), | 1151 "", cb=VerifyPatch("patch5\n")), |
1141 Git("apply --index --reject \"%s\"" % extra_patch, ""), | 1152 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""), |
1142 Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], ""), | 1153 Cmd("git commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], ""), |
1143 Git("cl upload --send-mail -r \"reviewer@chromium.org\"", ""), | 1154 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\"", ""), |
1144 Git("checkout -f %s" % TEST_CONFIG[BRANCHNAME], ""), | 1155 Cmd("git checkout -f %s" % TEST_CONFIG[BRANCHNAME], ""), |
1145 Git("cl presubmit", "Presubmit successfull\n"), | 1156 Cmd("git cl presubmit", "Presubmit successfull\n"), |
1146 Git("cl dcommit -f --bypass-hooks", "Closing issue\n", cb=VerifySVNCommit)
, | 1157 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", |
1147 Git("svn fetch", ""), | 1158 cb=VerifySVNCommit), |
1148 Git(("log -1 --format=%%H --grep=\"%s\" svn/trunk" | 1159 Cmd("git svn fetch", ""), |
| 1160 Cmd(("git log -1 --format=%%H --grep=\"%s\" svn/trunk" |
1149 % msg.replace("\"", "\\\"")), "hash6"), | 1161 % msg.replace("\"", "\\\"")), "hash6"), |
1150 Git("svn find-rev hash6", "1324"), | 1162 Cmd("git svn find-rev hash6", "1324"), |
1151 Git(("copy -r 1324 https://v8.googlecode.com/svn/trunk " | 1163 Cmd(("svn copy -r 1324 https://v8.googlecode.com/svn/trunk " |
1152 "https://v8.googlecode.com/svn/tags/3.22.5.1 -m " | 1164 "https://v8.googlecode.com/svn/tags/3.22.5.1 -m " |
1153 "\"Tagging version 3.22.5.1\""), ""), | 1165 "\"Tagging version 3.22.5.1\""), ""), |
1154 Git("checkout -f some_branch", ""), | 1166 Cmd("git checkout -f some_branch", ""), |
1155 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 1167 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
1156 ]) | 1168 ]) |
1157 | 1169 |
1158 self.ExpectReadline([ | 1170 self.ExpectReadline([ |
1159 RL("Y"), # Automatically add corresponding ports (34567, 56789)? | 1171 RL("Y"), # Automatically add corresponding ports (34567, 56789)? |
1160 RL("Y"), # Automatically increment patch level? | 1172 RL("Y"), # Automatically increment patch level? |
1161 RL("reviewer@chromium.org"), # V8 reviewer. | 1173 RL("reviewer@chromium.org"), # V8 reviewer. |
1162 RL("LGTM"), # Enter LGTM for V8 CL. | 1174 RL("LGTM"), # Enter LGTM for V8 CL. |
1163 ]) | 1175 ]) |
1164 | 1176 |
1165 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS | 1177 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 WriteDEPS(567) | 1256 WriteDEPS(567) |
1245 | 1257 |
1246 def ResetVersion(minor, build, patch=0): | 1258 def ResetVersion(minor, build, patch=0): |
1247 return lambda: self.WriteFakeVersionFile(minor=minor, | 1259 return lambda: self.WriteFakeVersionFile(minor=minor, |
1248 build=build, | 1260 build=build, |
1249 patch=patch) | 1261 patch=patch) |
1250 | 1262 |
1251 def ResetDEPS(revision): | 1263 def ResetDEPS(revision): |
1252 return lambda: WriteDEPS(revision) | 1264 return lambda: WriteDEPS(revision) |
1253 | 1265 |
1254 self.ExpectGit([ | 1266 self.ExpectCmd([ |
1255 Git("status -s -uno", ""), | 1267 Cmd("git status -s -uno", ""), |
1256 Git("status -s -b -uno", "## some_branch\n"), | 1268 Cmd("git status -s -b -uno", "## some_branch\n"), |
1257 Git("svn fetch", ""), | 1269 Cmd("git svn fetch", ""), |
1258 Git("branch", " branch1\n* branch2\n"), | 1270 Cmd("git branch", " branch1\n* branch2\n"), |
1259 Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), | 1271 Cmd("git checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), |
1260 Git("branch -r", " svn/3.21\n svn/3.3\n"), | 1272 Cmd("git branch -r", " svn/3.21\n svn/3.3\n"), |
1261 Git("reset --hard svn/3.3", ""), | 1273 Cmd("git reset --hard svn/3.3", ""), |
1262 Git("log --format=%H", "hash1\nhash2"), | 1274 Cmd("git log --format=%H", "hash1\nhash2"), |
1263 Git("diff --name-only hash1 hash1^", ""), | 1275 Cmd("git diff --name-only hash1 hash1^", ""), |
1264 Git("diff --name-only hash2 hash2^", TEST_CONFIG[VERSION_FILE]), | 1276 Cmd("git diff --name-only hash2 hash2^", TEST_CONFIG[VERSION_FILE]), |
1265 Git("checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1277 Cmd("git checkout -f hash2 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1266 cb=ResetVersion(3, 1, 1)), | 1278 cb=ResetVersion(3, 1, 1)), |
1267 Git("log -1 --format=%B hash2", | 1279 Cmd("git log -1 --format=%B hash2", |
1268 "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"), | 1280 "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"), |
1269 Git("log -1 --format=%s hash2", ""), | 1281 Cmd("git log -1 --format=%s hash2", ""), |
1270 Git("svn find-rev hash2", "234"), | 1282 Cmd("git svn find-rev hash2", "234"), |
1271 Git("log -1 --format=%ci hash2", "18:15"), | 1283 Cmd("git log -1 --format=%ci hash2", "18:15"), |
1272 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1284 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1273 cb=ResetVersion(22, 5)), | 1285 cb=ResetVersion(22, 5)), |
1274 Git("reset --hard svn/3.21", ""), | 1286 Cmd("git reset --hard svn/3.21", ""), |
1275 Git("log --format=%H", "hash3\nhash4\nhash5\n"), | 1287 Cmd("git log --format=%H", "hash3\nhash4\nhash5\n"), |
1276 Git("diff --name-only hash3 hash3^", TEST_CONFIG[VERSION_FILE]), | 1288 Cmd("git diff --name-only hash3 hash3^", TEST_CONFIG[VERSION_FILE]), |
1277 Git("checkout -f hash3 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1289 Cmd("git checkout -f hash3 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1278 cb=ResetVersion(21, 2)), | 1290 cb=ResetVersion(21, 2)), |
1279 Git("log -1 --format=%B hash3", ""), | 1291 Cmd("git log -1 --format=%B hash3", ""), |
1280 Git("log -1 --format=%s hash3", ""), | 1292 Cmd("git log -1 --format=%s hash3", ""), |
1281 Git("svn find-rev hash3", "123"), | 1293 Cmd("git svn find-rev hash3", "123"), |
1282 Git("log -1 --format=%ci hash3", "03:15"), | 1294 Cmd("git log -1 --format=%ci hash3", "03:15"), |
1283 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1295 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1284 cb=ResetVersion(22, 5)), | 1296 cb=ResetVersion(22, 5)), |
1285 Git("reset --hard svn/trunk", ""), | 1297 Cmd("git reset --hard svn/trunk", ""), |
1286 Git("log --format=%H", "hash6\n"), | 1298 Cmd("git log --format=%H", "hash6\n"), |
1287 Git("diff --name-only hash6 hash6^", TEST_CONFIG[VERSION_FILE]), | 1299 Cmd("git diff --name-only hash6 hash6^", TEST_CONFIG[VERSION_FILE]), |
1288 Git("checkout -f hash6 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1300 Cmd("git checkout -f hash6 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1289 cb=ResetVersion(22, 3)), | 1301 cb=ResetVersion(22, 3)), |
1290 Git("log -1 --format=%B hash6", ""), | 1302 Cmd("git log -1 --format=%B hash6", ""), |
1291 Git("log -1 --format=%s hash6", ""), | 1303 Cmd("git log -1 --format=%s hash6", ""), |
1292 Git("svn find-rev hash6", "345"), | 1304 Cmd("git svn find-rev hash6", "345"), |
1293 Git("log -1 --format=%ci hash6", ""), | 1305 Cmd("git log -1 --format=%ci hash6", ""), |
1294 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1306 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1295 cb=ResetVersion(22, 5)), | 1307 cb=ResetVersion(22, 5)), |
1296 Git("reset --hard svn/bleeding_edge", ""), | 1308 Cmd("git reset --hard svn/bleeding_edge", ""), |
1297 Git("log https://v8.googlecode.com/svn/tags -v --limit 20", | 1309 Cmd("svn log https://v8.googlecode.com/svn/tags -v --limit 20", |
1298 tag_response_text), | 1310 tag_response_text), |
1299 Git("svn find-rev r22626", "hash_22626"), | 1311 Cmd("git svn find-rev r22626", "hash_22626"), |
1300 Git("svn find-rev hash_22626", "22626"), | 1312 Cmd("git svn find-rev hash_22626", "22626"), |
1301 Git("log -1 --format=%ci hash_22626", "01:23"), | 1313 Cmd("git log -1 --format=%ci hash_22626", "01:23"), |
1302 Git("svn find-rev r22624", "hash_22624"), | 1314 Cmd("git svn find-rev r22624", "hash_22624"), |
1303 Git("svn find-rev hash_22624", "22624"), | 1315 Cmd("git svn find-rev hash_22624", "22624"), |
1304 Git("log -1 --format=%ci hash_22624", "02:34"), | 1316 Cmd("git log -1 --format=%ci hash_22624", "02:34"), |
1305 Git("status -s -uno", ""), | 1317 Cmd("git status -s -uno", ""), |
1306 Git("checkout -f master", ""), | 1318 Cmd("git checkout -f master", ""), |
1307 Git("pull", ""), | 1319 Cmd("git pull", ""), |
1308 Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), | 1320 Cmd("git checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), |
1309 Git("fetch origin", ""), | 1321 Cmd("git fetch origin", ""), |
1310 Git("log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"), | 1322 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"), |
1311 Git("diff --name-only c_hash1 c_hash1^", ""), | 1323 Cmd("git diff --name-only c_hash1 c_hash1^", ""), |
1312 Git("diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]), | 1324 Cmd("git diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]), |
1313 Git("checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "", | 1325 Cmd("git checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "", |
1314 cb=ResetDEPS("0123456789012345678901234567890123456789")), | 1326 cb=ResetDEPS("0123456789012345678901234567890123456789")), |
1315 Git("log -1 --format=%B c_hash2", c_hash2_commit_log), | 1327 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log), |
1316 Git("rev-list -n 1 0123456789012345678901234567890123456789", | 1328 Cmd("git rev-list -n 1 0123456789012345678901234567890123456789", |
1317 "0123456789012345678901234567890123456789"), | 1329 "0123456789012345678901234567890123456789"), |
1318 Git("log -1 --format=%B 0123456789012345678901234567890123456789", | 1330 Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789", |
1319 c_v8_22624_log), | 1331 c_v8_22624_log), |
1320 Git("diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]), | 1332 Cmd("git diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]), |
1321 Git("checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "", | 1333 Cmd("git checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "", |
1322 cb=ResetDEPS(345)), | 1334 cb=ResetDEPS(345)), |
1323 Git("log -1 --format=%B c_hash3", c_hash3_commit_log), | 1335 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log), |
1324 Git("checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", | 1336 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", |
1325 cb=ResetDEPS(567)), | 1337 cb=ResetDEPS(567)), |
1326 Git("branch -r", " weird/123\n branch-heads/7\n"), | 1338 Cmd("git branch -r", " weird/123\n branch-heads/7\n"), |
1327 Git("checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "", | 1339 Cmd("git checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "", |
1328 cb=ResetDEPS(345)), | 1340 cb=ResetDEPS(345)), |
1329 Git("checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", | 1341 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", |
1330 cb=ResetDEPS(567)), | 1342 cb=ResetDEPS(567)), |
1331 Git("checkout -f master", ""), | 1343 Cmd("git checkout -f master", ""), |
1332 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 1344 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
1333 Git("checkout -f some_branch", ""), | 1345 Cmd("git checkout -f some_branch", ""), |
1334 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 1346 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
1335 ]) | 1347 ]) |
1336 | 1348 |
1337 args = ["-c", TEST_CONFIG[CHROMIUM], | 1349 args = ["-c", TEST_CONFIG[CHROMIUM], |
1338 "--json", json_output, | 1350 "--json", json_output, |
1339 "--csv", csv_output, | 1351 "--csv", csv_output, |
1340 "--max-releases", "1"] | 1352 "--max-releases", "1"] |
1341 Releases(TEST_CONFIG, self).Run(args) | 1353 Releases(TEST_CONFIG, self).Run(args) |
1342 | 1354 |
1343 # Check expected output. | 1355 # Check expected output. |
1344 csv = ("3.28.41,bleeding_edge,22626,,\r\n" | 1356 csv = ("3.28.41,bleeding_edge,22626,,\r\n" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 | 1388 |
1377 def testBumpUpVersion(self): | 1389 def testBumpUpVersion(self): |
1378 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1390 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
1379 self.WriteFakeVersionFile() | 1391 self.WriteFakeVersionFile() |
1380 | 1392 |
1381 def ResetVersion(minor, build, patch=0): | 1393 def ResetVersion(minor, build, patch=0): |
1382 return lambda: self.WriteFakeVersionFile(minor=minor, | 1394 return lambda: self.WriteFakeVersionFile(minor=minor, |
1383 build=build, | 1395 build=build, |
1384 patch=patch) | 1396 patch=patch) |
1385 | 1397 |
1386 self.ExpectGit([ | 1398 self.ExpectCmd([ |
1387 Git("status -s -uno", ""), | 1399 Cmd("git status -s -uno", ""), |
1388 Git("checkout -f bleeding_edge", "", cb=ResetVersion(11, 4)), | 1400 Cmd("git checkout -f bleeding_edge", "", cb=ResetVersion(11, 4)), |
1389 Git("pull", ""), | 1401 Cmd("git pull", ""), |
1390 Git("branch", ""), | 1402 Cmd("git branch", ""), |
1391 Git("checkout -f bleeding_edge", ""), | 1403 Cmd("git checkout -f bleeding_edge", ""), |
1392 Git("log -1 --format=%H", "latest_hash"), | 1404 Cmd("git log -1 --format=%H", "latest_hash"), |
1393 Git("diff --name-only latest_hash latest_hash^", ""), | 1405 Cmd("git diff --name-only latest_hash latest_hash^", ""), |
1394 Git("checkout -f bleeding_edge", ""), | 1406 Cmd("git checkout -f bleeding_edge", ""), |
1395 Git("log --format=%H --grep=\"^git-svn-id: [^@]*@12345 [A-Za-z0-9-]*$\"", | 1407 Cmd(("git log --format=%H --grep=" |
| 1408 "\"^git-svn-id: [^@]*@12345 [A-Za-z0-9-]*$\""), |
1396 "lkgr_hash"), | 1409 "lkgr_hash"), |
1397 Git("checkout -b auto-bump-up-version lkgr_hash", ""), | 1410 Cmd("git checkout -b auto-bump-up-version lkgr_hash", ""), |
1398 Git("checkout -f bleeding_edge", ""), | 1411 Cmd("git checkout -f bleeding_edge", ""), |
1399 Git("branch", ""), | 1412 Cmd("git branch", ""), |
1400 Git("diff --name-only lkgr_hash lkgr_hash^", ""), | 1413 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), |
1401 Git("checkout -f master", "", cb=ResetVersion(11, 5)), | 1414 Cmd("git checkout -f master", "", cb=ResetVersion(11, 5)), |
1402 Git("pull", ""), | 1415 Cmd("git pull", ""), |
1403 Git("checkout -b auto-bump-up-version bleeding_edge", "", | 1416 Cmd("git checkout -b auto-bump-up-version bleeding_edge", "", |
1404 cb=ResetVersion(11, 4)), | 1417 cb=ResetVersion(11, 4)), |
1405 Git("commit -am \"[Auto-roll] Bump up version to 3.11.6.0\n\n" | 1418 Cmd("git commit -am \"[Auto-roll] Bump up version to 3.11.6.0\n\n" |
1406 "TBR=author@chromium.org\"", ""), | 1419 "TBR=author@chromium.org\"", ""), |
1407 Git("cl upload --send-mail --email \"author@chromium.org\" -f " | 1420 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " |
1408 "--bypass-hooks", ""), | 1421 "--bypass-hooks", ""), |
1409 Git("cl dcommit -f --bypass-hooks", ""), | 1422 Cmd("git cl dcommit -f --bypass-hooks", ""), |
1410 Git("checkout -f bleeding_edge", ""), | 1423 Cmd("git checkout -f bleeding_edge", ""), |
1411 Git("branch", "auto-bump-up-version\n* bleeding_edge"), | 1424 Cmd("git branch", "auto-bump-up-version\n* bleeding_edge"), |
1412 Git("branch -D auto-bump-up-version", ""), | 1425 Cmd("git branch -D auto-bump-up-version", ""), |
1413 ]) | 1426 ]) |
1414 | 1427 |
1415 self.ExpectReadURL([ | 1428 self.ExpectReadURL([ |
1416 URL("https://v8-status.appspot.com/lkgr", "12345"), | 1429 URL("https://v8-status.appspot.com/lkgr", "12345"), |
1417 URL("https://v8-status.appspot.com/current?format=json", | 1430 URL("https://v8-status.appspot.com/current?format=json", |
1418 "{\"message\": \"Tree is open\"}"), | 1431 "{\"message\": \"Tree is open\"}"), |
1419 ]) | 1432 ]) |
1420 | 1433 |
1421 BumpUpVersion(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) | 1434 BumpUpVersion(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) |
1422 | 1435 |
1423 def testAutoTag(self): | 1436 def testAutoTag(self): |
1424 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1437 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
1425 self.WriteFakeVersionFile() | 1438 self.WriteFakeVersionFile() |
1426 | 1439 |
1427 def ResetVersion(minor, build, patch=0): | 1440 def ResetVersion(minor, build, patch=0): |
1428 return lambda: self.WriteFakeVersionFile(minor=minor, | 1441 return lambda: self.WriteFakeVersionFile(minor=minor, |
1429 build=build, | 1442 build=build, |
1430 patch=patch) | 1443 patch=patch) |
1431 | 1444 |
1432 self.ExpectGit([ | 1445 self.ExpectCmd([ |
1433 Git("status -s -uno", ""), | 1446 Cmd("git status -s -uno", ""), |
1434 Git("status -s -b -uno", "## some_branch\n"), | 1447 Cmd("git status -s -b -uno", "## some_branch\n"), |
1435 Git("svn fetch", ""), | 1448 Cmd("git svn fetch", ""), |
1436 Git("branch", " branch1\n* branch2\n"), | 1449 Cmd("git branch", " branch1\n* branch2\n"), |
1437 Git("checkout -f master", ""), | 1450 Cmd("git checkout -f master", ""), |
1438 Git("svn rebase", ""), | 1451 Cmd("git svn rebase", ""), |
1439 Git("checkout -b %s" % TEST_CONFIG[BRANCHNAME], "", | 1452 Cmd("git checkout -b %s" % TEST_CONFIG[BRANCHNAME], "", |
1440 cb=ResetVersion(4, 5)), | 1453 cb=ResetVersion(4, 5)), |
1441 Git("branch -r", "svn/tags/3.4.2\nsvn/tags/3.2.1.0\nsvn/branches/3.4"), | 1454 Cmd("git branch -r", |
1442 Git("log --format=%H --grep=\"\\[Auto\\-roll\\] Bump up version to\"", | 1455 "svn/tags/3.4.2\nsvn/tags/3.2.1.0\nsvn/branches/3.4"), |
| 1456 Cmd(("git log --format=%H --grep=" |
| 1457 "\"\\[Auto\\-roll\\] Bump up version to\""), |
1443 "hash125\nhash118\nhash111\nhash101"), | 1458 "hash125\nhash118\nhash111\nhash101"), |
1444 Git("checkout -f hash125 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1459 Cmd("git checkout -f hash125 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1445 cb=ResetVersion(4, 4)), | 1460 cb=ResetVersion(4, 4)), |
1446 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1461 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1447 cb=ResetVersion(4, 5)), | 1462 cb=ResetVersion(4, 5)), |
1448 Git("checkout -f hash118 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1463 Cmd("git checkout -f hash118 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1449 cb=ResetVersion(4, 3)), | 1464 cb=ResetVersion(4, 3)), |
1450 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1465 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1451 cb=ResetVersion(4, 5)), | 1466 cb=ResetVersion(4, 5)), |
1452 Git("checkout -f hash111 -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1467 Cmd("git checkout -f hash111 -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1453 cb=ResetVersion(4, 2)), | 1468 cb=ResetVersion(4, 2)), |
1454 Git("checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", | 1469 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[VERSION_FILE], "", |
1455 cb=ResetVersion(4, 5)), | 1470 cb=ResetVersion(4, 5)), |
1456 Git("svn find-rev hash118", "118"), | 1471 Cmd("git svn find-rev hash118", "118"), |
1457 Git("svn find-rev hash125", "125"), | 1472 Cmd("git svn find-rev hash125", "125"), |
1458 Git("svn find-rev r123", "hash123"), | 1473 Cmd("git svn find-rev r123", "hash123"), |
1459 Git("log -1 --format=%at hash123", "1"), | 1474 Cmd("git log -1 --format=%at hash123", "1"), |
1460 Git("reset --hard hash123", ""), | 1475 Cmd("git reset --hard hash123", ""), |
1461 Git("svn tag 3.4.3 -m \"Tagging version 3.4.3\"", ""), | 1476 Cmd("git svn tag 3.4.3 -m \"Tagging version 3.4.3\"", ""), |
1462 Git("checkout -f some_branch", ""), | 1477 Cmd("git checkout -f some_branch", ""), |
1463 Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 1478 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), |
1464 ]) | 1479 ]) |
1465 | 1480 |
1466 self.ExpectReadURL([ | 1481 self.ExpectReadURL([ |
1467 URL("https://v8-status.appspot.com/revisions?format=json", | 1482 URL("https://v8-status.appspot.com/revisions?format=json", |
1468 "[{\"revision\": \"126\", \"status\": true}," | 1483 "[{\"revision\": \"126\", \"status\": true}," |
1469 "{\"revision\": \"123\", \"status\": true}," | 1484 "{\"revision\": \"123\", \"status\": true}," |
1470 "{\"revision\": \"112\", \"status\": true}]"), | 1485 "{\"revision\": \"112\", \"status\": true}]"), |
1471 ]) | 1486 ]) |
1472 | 1487 |
1473 AutoTag(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) | 1488 AutoTag(TEST_CONFIG, self).Run(["-a", "author@chromium.org"]) |
1474 | 1489 |
1475 # Test that we bail out if the last change was a version change. | 1490 # Test that we bail out if the last change was a version change. |
1476 def testBumpUpVersionBailout1(self): | 1491 def testBumpUpVersionBailout1(self): |
1477 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1492 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
1478 self._state["latest"] = "latest_hash" | 1493 self._state["latest"] = "latest_hash" |
1479 | 1494 |
1480 self.ExpectGit([ | 1495 self.ExpectCmd([ |
1481 Git("diff --name-only latest_hash latest_hash^", | 1496 Cmd("git diff --name-only latest_hash latest_hash^", |
1482 TEST_CONFIG[VERSION_FILE]), | 1497 TEST_CONFIG[VERSION_FILE]), |
1483 ]) | 1498 ]) |
1484 | 1499 |
1485 self.assertEquals(1, | 1500 self.assertEquals(1, |
1486 self.RunStep(BumpUpVersion, LastChangeBailout, ["--dry_run"])) | 1501 self.RunStep(BumpUpVersion, LastChangeBailout, ["--dry_run"])) |
1487 | 1502 |
1488 # Test that we bail out if the lkgr was a version change. | 1503 # Test that we bail out if the lkgr was a version change. |
1489 def testBumpUpVersionBailout2(self): | 1504 def testBumpUpVersionBailout2(self): |
1490 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1505 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
1491 self._state["lkgr"] = "lkgr_hash" | 1506 self._state["lkgr"] = "lkgr_hash" |
1492 | 1507 |
1493 self.ExpectGit([ | 1508 self.ExpectCmd([ |
1494 Git("diff --name-only lkgr_hash lkgr_hash^", TEST_CONFIG[VERSION_FILE]), | 1509 Cmd("git diff --name-only lkgr_hash lkgr_hash^", |
| 1510 TEST_CONFIG[VERSION_FILE]), |
1495 ]) | 1511 ]) |
1496 | 1512 |
1497 self.assertEquals(1, | 1513 self.assertEquals(1, |
1498 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) | 1514 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) |
1499 | 1515 |
1500 # Test that we bail out if the last version is already newer than the lkgr's | 1516 # Test that we bail out if the last version is already newer than the lkgr's |
1501 # version. | 1517 # version. |
1502 def testBumpUpVersionBailout3(self): | 1518 def testBumpUpVersionBailout3(self): |
1503 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 1519 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() |
1504 self._state["lkgr"] = "lkgr_hash" | 1520 self._state["lkgr"] = "lkgr_hash" |
1505 self._state["lkgr_version"] = "3.22.4.0" | 1521 self._state["lkgr_version"] = "3.22.4.0" |
1506 self._state["latest_version"] = "3.22.5.0" | 1522 self._state["latest_version"] = "3.22.5.0" |
1507 | 1523 |
1508 self.ExpectGit([ | 1524 self.ExpectCmd([ |
1509 Git("diff --name-only lkgr_hash lkgr_hash^", ""), | 1525 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), |
1510 ]) | 1526 ]) |
1511 | 1527 |
1512 self.assertEquals(1, | 1528 self.assertEquals(1, |
1513 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) | 1529 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) |
1514 | 1530 |
1515 | 1531 |
1516 class SystemTest(unittest.TestCase): | 1532 class SystemTest(unittest.TestCase): |
1517 def testReload(self): | 1533 def testReload(self): |
1518 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, | 1534 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, |
1519 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) | 1535 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) |
1520 body = step.Reload( | 1536 body = step.Reload( |
1521 """------------------------------------------------------------------------ | 1537 """------------------------------------------------------------------------ |
1522 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines | 1538 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines |
1523 | 1539 |
1524 Prepare push to trunk. Now working on version 3.23.11. | 1540 Prepare push to trunk. Now working on version 3.23.11. |
1525 | 1541 |
1526 R=danno@chromium.org | 1542 R=danno@chromium.org |
1527 | 1543 |
1528 Review URL: https://codereview.chromium.org/83173002 | 1544 Review URL: https://codereview.chromium.org/83173002 |
1529 | 1545 |
1530 ------------------------------------------------------------------------""") | 1546 ------------------------------------------------------------------------""") |
1531 self.assertEquals( | 1547 self.assertEquals( |
1532 """Prepare push to trunk. Now working on version 3.23.11. | 1548 """Prepare push to trunk. Now working on version 3.23.11. |
1533 | 1549 |
1534 R=danno@chromium.org | 1550 R=danno@chromium.org |
1535 | 1551 |
1536 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1552 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |