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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 f.write("#define MINOR_VERSION 22\n") | 291 f.write("#define MINOR_VERSION 22\n") |
292 f.write("#define BUILD_NUMBER 5\n") | 292 f.write("#define BUILD_NUMBER 5\n") |
293 f.write("#define PATCH_LEVEL 0\n") | 293 f.write("#define PATCH_LEVEL 0\n") |
294 f.write(" // Some line...\n") | 294 f.write(" // Some line...\n") |
295 f.write("#define IS_CANDIDATE_VERSION 0\n") | 295 f.write("#define IS_CANDIDATE_VERSION 0\n") |
296 return name | 296 return name |
297 | 297 |
298 def MakeStep(self, step_class=Step, state=None, options=None): | 298 def MakeStep(self, step_class=Step, state=None, options=None): |
299 """Convenience wrapper.""" | 299 """Convenience wrapper.""" |
300 options = options or CommonOptions(MakeOptions()) | 300 options = options or CommonOptions(MakeOptions()) |
| 301 state = state if state is not None else self._state |
301 return MakeStep(step_class=step_class, number=0, state=state, | 302 return MakeStep(step_class=step_class, number=0, state=state, |
302 config=TEST_CONFIG, options=options, | 303 config=TEST_CONFIG, options=options, |
303 side_effect_handler=self) | 304 side_effect_handler=self) |
304 | 305 |
305 def GitMock(self, cmd, args="", pipe=True): | 306 def GitMock(self, cmd, args="", pipe=True): |
306 print "%s %s" % (cmd, args) | 307 print "%s %s" % (cmd, args) |
307 return self._git_mock.Call(args) | 308 return self._git_mock.Call(args) |
308 | 309 |
309 def LogMock(self, cmd, args=""): | 310 def LogMock(self, cmd, args=""): |
310 print "Log: %s %s" % (cmd, args) | 311 print "Log: %s %s" % (cmd, args) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 350 |
350 def ExpectReadURL(self, *args): | 351 def ExpectReadURL(self, *args): |
351 """Convenience wrapper.""" | 352 """Convenience wrapper.""" |
352 self._url_mock.Expect(*args) | 353 self._url_mock.Expect(*args) |
353 | 354 |
354 def setUp(self): | 355 def setUp(self): |
355 self._git_mock = SimpleMock("git") | 356 self._git_mock = SimpleMock("git") |
356 self._rl_mock = SimpleMock("readline") | 357 self._rl_mock = SimpleMock("readline") |
357 self._url_mock = SimpleMock("readurl") | 358 self._url_mock = SimpleMock("readurl") |
358 self._tmp_files = [] | 359 self._tmp_files = [] |
| 360 self._state = {} |
359 | 361 |
360 def tearDown(self): | 362 def tearDown(self): |
361 Command("rm", "-rf %s*" % TEST_CONFIG[PERSISTFILE_BASENAME]) | 363 Command("rm", "-rf %s*" % TEST_CONFIG[PERSISTFILE_BASENAME]) |
362 | 364 |
363 # Clean up temps. Doesn't work automatically. | 365 # Clean up temps. Doesn't work automatically. |
364 for name in self._tmp_files: | 366 for name in self._tmp_files: |
365 if os.path.exists(name): | 367 if os.path.exists(name): |
366 os.remove(name) | 368 os.remove(name) |
367 | 369 |
368 self._git_mock.AssertFinished() | 370 self._git_mock.AssertFinished() |
369 self._rl_mock.AssertFinished() | 371 self._rl_mock.AssertFinished() |
370 self._url_mock.AssertFinished() | 372 self._url_mock.AssertFinished() |
371 | 373 |
372 def testPersistRestore(self): | |
373 self.MakeStep().Persist("test1", "") | |
374 self.assertEquals("", self.MakeStep().Restore("test1")) | |
375 self.MakeStep().Persist("test2", "AB123") | |
376 self.assertEquals("AB123", self.MakeStep().Restore("test2")) | |
377 | |
378 def testGitOrig(self): | 374 def testGitOrig(self): |
379 self.assertTrue(Command("git", "--version").startswith("git version")) | 375 self.assertTrue(Command("git", "--version").startswith("git version")) |
380 | 376 |
381 def testGitMock(self): | 377 def testGitMock(self): |
382 self.ExpectGit([["--version", "git version 1.2.3"], ["dummy", ""]]) | 378 self.ExpectGit([["--version", "git version 1.2.3"], ["dummy", ""]]) |
383 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) | 379 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) |
384 self.assertEquals("", self.MakeStep().Git("dummy")) | 380 self.assertEquals("", self.MakeStep().Git("dummy")) |
385 | 381 |
386 def testCommonPrepareDefault(self): | 382 def testCommonPrepareDefault(self): |
387 self.ExpectGit([ | 383 self.ExpectGit([ |
388 ["status -s -uno", ""], | 384 ["status -s -uno", ""], |
389 ["status -s -b -uno", "## some_branch"], | 385 ["status -s -b -uno", "## some_branch"], |
390 ["svn fetch", ""], | 386 ["svn fetch", ""], |
391 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 387 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
392 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 388 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
393 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 389 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
394 ["branch", ""], | 390 ["branch", ""], |
395 ]) | 391 ]) |
396 self.ExpectReadline(["Y"]) | 392 self.ExpectReadline(["Y"]) |
397 self.MakeStep().CommonPrepare() | 393 self.MakeStep().CommonPrepare() |
398 self.MakeStep().PrepareBranch() | 394 self.MakeStep().PrepareBranch() |
399 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 395 self.assertEquals("some_branch", self._state["current_branch"]) |
400 | 396 |
401 def testCommonPrepareNoConfirm(self): | 397 def testCommonPrepareNoConfirm(self): |
402 self.ExpectGit([ | 398 self.ExpectGit([ |
403 ["status -s -uno", ""], | 399 ["status -s -uno", ""], |
404 ["status -s -b -uno", "## some_branch"], | 400 ["status -s -b -uno", "## some_branch"], |
405 ["svn fetch", ""], | 401 ["svn fetch", ""], |
406 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 402 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
407 ]) | 403 ]) |
408 self.ExpectReadline(["n"]) | 404 self.ExpectReadline(["n"]) |
409 self.MakeStep().CommonPrepare() | 405 self.MakeStep().CommonPrepare() |
410 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 406 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
411 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 407 self.assertEquals("some_branch", self._state["current_branch"]) |
412 | 408 |
413 def testCommonPrepareDeleteBranchFailure(self): | 409 def testCommonPrepareDeleteBranchFailure(self): |
414 self.ExpectGit([ | 410 self.ExpectGit([ |
415 ["status -s -uno", ""], | 411 ["status -s -uno", ""], |
416 ["status -s -b -uno", "## some_branch"], | 412 ["status -s -b -uno", "## some_branch"], |
417 ["svn fetch", ""], | 413 ["svn fetch", ""], |
418 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 414 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
419 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None], | 415 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None], |
420 ]) | 416 ]) |
421 self.ExpectReadline(["Y"]) | 417 self.ExpectReadline(["Y"]) |
422 self.MakeStep().CommonPrepare() | 418 self.MakeStep().CommonPrepare() |
423 self.assertRaises(Exception, self.MakeStep().PrepareBranch) | 419 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
424 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 420 self.assertEquals("some_branch", self._state["current_branch"]) |
425 | 421 |
426 def testInitialEnvironmentChecks(self): | 422 def testInitialEnvironmentChecks(self): |
427 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 423 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
428 os.environ["EDITOR"] = "vi" | 424 os.environ["EDITOR"] = "vi" |
429 self.MakeStep().InitialEnvironmentChecks() | 425 self.MakeStep().InitialEnvironmentChecks() |
430 | 426 |
431 def testReadAndPersistVersion(self): | 427 def testReadAndPersistVersion(self): |
432 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 428 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
433 step = self.MakeStep() | 429 step = self.MakeStep() |
434 step.ReadAndPersistVersion() | 430 step.ReadAndPersistVersion() |
435 self.assertEquals("3", self.MakeStep().Restore("major")) | 431 self.assertEquals("3", step["major"]) |
436 self.assertEquals("22", self.MakeStep().Restore("minor")) | 432 self.assertEquals("22", step["minor"]) |
437 self.assertEquals("5", self.MakeStep().Restore("build")) | 433 self.assertEquals("5", step["build"]) |
438 self.assertEquals("0", self.MakeStep().Restore("patch")) | 434 self.assertEquals("0", step["patch"]) |
439 self.assertEquals("3", step._state["major"]) | |
440 self.assertEquals("22", step._state["minor"]) | |
441 self.assertEquals("5", step._state["build"]) | |
442 self.assertEquals("0", step._state["patch"]) | |
443 | 435 |
444 def testRegex(self): | 436 def testRegex(self): |
445 self.assertEqual("(issue 321)", | 437 self.assertEqual("(issue 321)", |
446 re.sub(r"BUG=v8:(.*)$", r"(issue \1)", "BUG=v8:321")) | 438 re.sub(r"BUG=v8:(.*)$", r"(issue \1)", "BUG=v8:321")) |
447 self.assertEqual("(Chromium issue 321)", | 439 self.assertEqual("(Chromium issue 321)", |
448 re.sub(r"BUG=(.*)$", r"(Chromium issue \1)", "BUG=321")) | 440 re.sub(r"BUG=(.*)$", r"(Chromium issue \1)", "BUG=321")) |
449 | 441 |
450 cl = " too little\n\ttab\ttab\n too much\n trailing " | 442 cl = " too little\n\ttab\ttab\n too much\n trailing " |
451 cl = MSub(r"\t", r" ", cl) | 443 cl = MSub(r"\t", r" ", cl) |
452 cl = MSub(r"^ {1,7}([^ ])", r" \1", cl) | 444 cl = MSub(r"^ {1,7}([^ ])", r" \1", cl) |
(...skipping 30 matching lines...) Expand all Loading... |
483 "Review URL: https://codereview.chromium.org/9876543210\n")], | 475 "Review URL: https://codereview.chromium.org/9876543210\n")], |
484 ["log -1 rev4 --format=\"%an\"", "author4@chromium.org"], | 476 ["log -1 rev4 --format=\"%an\"", "author4@chromium.org"], |
485 ]) | 477 ]) |
486 | 478 |
487 # The cl for rev4 on rietveld has an updated LOG flag. | 479 # The cl for rev4 on rietveld has an updated LOG flag. |
488 self.ExpectReadURL([ | 480 self.ExpectReadURL([ |
489 ["https://codereview.chromium.org/9876543210/description", | 481 ["https://codereview.chromium.org/9876543210/description", |
490 "Title\n\nBUG=456\nLOG=N\n\n"], | 482 "Title\n\nBUG=456\nLOG=N\n\n"], |
491 ]) | 483 ]) |
492 | 484 |
493 self.MakeStep().Persist("last_push", "1234") | 485 self._state["last_push"] = "1234" |
494 self.MakeStep(PrepareChangeLog).Run() | 486 self.MakeStep(PrepareChangeLog).Run() |
495 | 487 |
496 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 488 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
497 | 489 |
498 expected_cl = """1999-07-31: Version 3.22.5 | 490 expected_cl = """1999-07-31: Version 3.22.5 |
499 | 491 |
500 Title text 1. | 492 Title text 1. |
501 | 493 |
502 Title text 3 (Chromium issue 321). | 494 Title text 3 (Chromium issue 321). |
503 | 495 |
(...skipping 11 matching lines...) Expand all Loading... |
515 # | 507 # |
516 # Title text 3 (Chromium issue 321). | 508 # Title text 3 (Chromium issue 321). |
517 # (author3@chromium.org) | 509 # (author3@chromium.org) |
518 # | 510 # |
519 # Title text 4 (Chromium issue 456). | 511 # Title text 4 (Chromium issue 456). |
520 # (author4@chromium.org) | 512 # (author4@chromium.org) |
521 # | 513 # |
522 #""" | 514 #""" |
523 | 515 |
524 self.assertEquals(expected_cl, actual_cl) | 516 self.assertEquals(expected_cl, actual_cl) |
525 self.assertEquals("3", self.MakeStep().Restore("major")) | 517 self.assertEquals("3", self._state["major"]) |
526 self.assertEquals("22", self.MakeStep().Restore("minor")) | 518 self.assertEquals("22", self._state["minor"]) |
527 self.assertEquals("5", self.MakeStep().Restore("build")) | 519 self.assertEquals("5", self._state["build"]) |
528 self.assertEquals("0", self.MakeStep().Restore("patch")) | 520 self.assertEquals("0", self._state["patch"]) |
529 | 521 |
530 def testEditChangeLog(self): | 522 def testEditChangeLog(self): |
531 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 523 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
532 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 524 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
533 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) | 525 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) |
534 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 526 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
535 os.environ["EDITOR"] = "vi" | 527 os.environ["EDITOR"] = "vi" |
536 | 528 |
537 self.ExpectReadline([ | 529 self.ExpectReadline([ |
538 "", # Open editor. | 530 "", # Open editor. |
539 ]) | 531 ]) |
540 | 532 |
541 self.MakeStep(EditChangeLog).Run() | 533 self.MakeStep(EditChangeLog).Run() |
542 | 534 |
543 self.assertEquals("New\n Lines\n\n\n Original CL", | 535 self.assertEquals("New\n Lines\n\n\n Original CL", |
544 FileToText(TEST_CONFIG[CHANGELOG_FILE])) | 536 FileToText(TEST_CONFIG[CHANGELOG_FILE])) |
545 | 537 |
546 def testIncrementVersion(self): | 538 def testIncrementVersion(self): |
547 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 539 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
548 self.MakeStep().Persist("build", "5") | 540 self._state["build"] = "5" |
549 | 541 |
550 self.ExpectReadline([ | 542 self.ExpectReadline([ |
551 "Y", # Increment build number. | 543 "Y", # Increment build number. |
552 ]) | 544 ]) |
553 | 545 |
554 self.MakeStep(IncrementVersion).Run() | 546 self.MakeStep(IncrementVersion).Run() |
555 | 547 |
556 self.assertEquals("3", self.MakeStep().Restore("new_major")) | 548 self.assertEquals("3", self._state["new_major"]) |
557 self.assertEquals("22", self.MakeStep().Restore("new_minor")) | 549 self.assertEquals("22", self._state["new_minor"]) |
558 self.assertEquals("6", self.MakeStep().Restore("new_build")) | 550 self.assertEquals("6", self._state["new_build"]) |
559 self.assertEquals("0", self.MakeStep().Restore("new_patch")) | 551 self.assertEquals("0", self._state["new_patch"]) |
560 | 552 |
561 def testLastChangeLogEntries(self): | 553 def testLastChangeLogEntries(self): |
562 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 554 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
563 l = """ | 555 l = """ |
564 Fixed something. | 556 Fixed something. |
565 (issue 1234)\n""" | 557 (issue 1234)\n""" |
566 for _ in xrange(10): l = l + l | 558 for _ in xrange(10): l = l + l |
567 | 559 |
568 cl_chunk = """2013-11-12: Version 3.23.2\n%s | 560 cl_chunk = """2013-11-12: Version 3.23.2\n%s |
569 Performance and stability improvements on all platforms.\n\n\n""" % l | 561 Performance and stability improvements on all platforms.\n\n\n""" % l |
570 | 562 |
571 cl_chunk_full = cl_chunk + cl_chunk + cl_chunk | 563 cl_chunk_full = cl_chunk + cl_chunk + cl_chunk |
572 TextToFile(cl_chunk_full, TEST_CONFIG[CHANGELOG_FILE]) | 564 TextToFile(cl_chunk_full, TEST_CONFIG[CHANGELOG_FILE]) |
573 | 565 |
574 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE]) | 566 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE]) |
575 self.assertEquals(cl_chunk, cl) | 567 self.assertEquals(cl_chunk, cl) |
576 | 568 |
577 def _TestSquashCommits(self, change_log, expected_msg): | 569 def _TestSquashCommits(self, change_log, expected_msg): |
578 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 570 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
579 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: | 571 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: |
580 f.write(change_log) | 572 f.write(change_log) |
581 | 573 |
582 self.ExpectGit([ | 574 self.ExpectGit([ |
583 ["diff svn/trunk hash1", "patch content"], | 575 ["diff svn/trunk hash1", "patch content"], |
584 ["svn find-rev hash1", "123455\n"], | 576 ["svn find-rev hash1", "123455\n"], |
585 ]) | 577 ]) |
586 | 578 |
587 self.MakeStep().Persist("prepare_commit_hash", "hash1") | 579 self._state["prepare_commit_hash"] = "hash1" |
588 self.MakeStep().Persist("date", "1999-11-11") | 580 self._state["date"] = "1999-11-11" |
589 | 581 |
590 self.MakeStep(SquashCommits).Run() | 582 self.MakeStep(SquashCommits).Run() |
591 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) | 583 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) |
592 | 584 |
593 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) | 585 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) |
594 self.assertTrue(re.search(r"patch content", patch)) | 586 self.assertTrue(re.search(r"patch content", patch)) |
595 | 587 |
596 def testSquashCommitsUnformatted(self): | 588 def testSquashCommitsUnformatted(self): |
597 change_log = """1999-11-11: Version 3.22.5 | 589 change_log = """1999-11-11: Version 3.22.5 |
598 | 590 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 ["status -s -uno", ""], | 795 ["status -s -uno", ""], |
804 ["status -s -b -uno", "## some_branch\n"], | 796 ["status -s -b -uno", "## some_branch\n"], |
805 ["svn fetch", ""], | 797 ["svn fetch", ""], |
806 ["svn log -1 --oneline", "r100 | Text"], | 798 ["svn log -1 --oneline", "r100 | Text"], |
807 ["svn log -1 --oneline ChangeLog", "r65 | Prepare push to trunk..."], | 799 ["svn log -1 --oneline ChangeLog", "r65 | Prepare push to trunk..."], |
808 ]) | 800 ]) |
809 | 801 |
810 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions( | 802 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions( |
811 MakeOptions(status_password=status_password)), self) | 803 MakeOptions(status_password=status_password)), self) |
812 | 804 |
813 self.assertEquals("100", self.MakeStep().Restore("lkgr")) | 805 state = json.loads(FileToText("%s-state.json" |
814 self.assertEquals("100", self.MakeStep().Restore("latest")) | 806 % TEST_CONFIG[PERSISTFILE_BASENAME])) |
| 807 |
| 808 self.assertEquals("100", state["lkgr"]) |
| 809 self.assertEquals("100", state["latest"]) |
815 | 810 |
816 def testAutoRollStoppedBySettings(self): | 811 def testAutoRollStoppedBySettings(self): |
817 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 812 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
818 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() | 813 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() |
819 TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION]) | 814 TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION]) |
820 | 815 |
821 self.ExpectReadURL([]) | 816 self.ExpectReadURL([]) |
822 | 817 |
823 self.ExpectGit([ | 818 self.ExpectGit([ |
824 ["status -s -uno", ""], | 819 ["status -s -uno", ""], |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 ["log -1 --format=%s hash1", "Title1"], | 894 ["log -1 --format=%s hash1", "Title1"], |
900 ["svn find-rev hash2 svn/bleeding_edge", "23456"], | 895 ["svn find-rev hash2 svn/bleeding_edge", "23456"], |
901 ["log -1 --format=%s hash2", "Title2"], | 896 ["log -1 --format=%s hash2", "Title2"], |
902 ["log svn/bleeding_edge --reverse --format=%H --grep=\"Port r23456\"", | 897 ["log svn/bleeding_edge --reverse --format=%H --grep=\"Port r23456\"", |
903 ""], | 898 ""], |
904 ["log svn/bleeding_edge --reverse --format=%H --grep=\"Port r34567\"", | 899 ["log svn/bleeding_edge --reverse --format=%H --grep=\"Port r34567\"", |
905 "hash3"], | 900 "hash3"], |
906 ["svn find-rev hash3 svn/bleeding_edge", "56789"], | 901 ["svn find-rev hash3 svn/bleeding_edge", "56789"], |
907 ["log -1 --format=%s hash3", "Title3"], | 902 ["log -1 --format=%s hash3", "Title3"], |
908 ["svn find-rev \"r12345\" svn/bleeding_edge", "hash4"], | 903 ["svn find-rev \"r12345\" svn/bleeding_edge", "hash4"], |
| 904 # Simulate svn being down which stops the script. |
| 905 ["svn find-rev \"r23456\" svn/bleeding_edge", None], |
| 906 # Restart script in the failing step. |
| 907 ["svn find-rev \"r12345\" svn/bleeding_edge", "hash4"], |
909 ["svn find-rev \"r23456\" svn/bleeding_edge", "hash2"], | 908 ["svn find-rev \"r23456\" svn/bleeding_edge", "hash2"], |
910 ["svn find-rev \"r34567\" svn/bleeding_edge", "hash3"], | 909 ["svn find-rev \"r34567\" svn/bleeding_edge", "hash3"], |
911 ["svn find-rev \"r45678\" svn/bleeding_edge", "hash1"], | 910 ["svn find-rev \"r45678\" svn/bleeding_edge", "hash1"], |
912 ["svn find-rev \"r56789\" svn/bleeding_edge", "hash5"], | 911 ["svn find-rev \"r56789\" svn/bleeding_edge", "hash5"], |
913 ["log -1 --format=%s hash4", "Title4"], | 912 ["log -1 --format=%s hash4", "Title4"], |
914 ["log -1 --format=%s hash2", "Title2"], | 913 ["log -1 --format=%s hash2", "Title2"], |
915 ["log -1 --format=%s hash3", "Title3"], | 914 ["log -1 --format=%s hash3", "Title3"], |
916 ["log -1 --format=%s hash1", "Title1"], | 915 ["log -1 --format=%s hash1", "Title1"], |
917 ["log -1 --format=%s hash5", "Title5"], | 916 ["log -1 --format=%s hash5", "Title5"], |
918 ["log -1 hash4", "Title4\nBUG=123\nBUG=234"], | 917 ["log -1 hash4", "Title4\nBUG=123\nBUG=234"], |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 "Y", # Automatically increment patch level? | 956 "Y", # Automatically increment patch level? |
958 "reviewer@chromium.org", # V8 reviewer. | 957 "reviewer@chromium.org", # V8 reviewer. |
959 "LGTM", # Enter LGTM for V8 CL. | 958 "LGTM", # Enter LGTM for V8 CL. |
960 ]) | 959 ]) |
961 | 960 |
962 options = MakeOptions(p=extra_patch, f=True) | 961 options = MakeOptions(p=extra_patch, f=True) |
963 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS | 962 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS |
964 # ports of r12345. r56789 is the MIPS port of r34567. | 963 # ports of r12345. r56789 is the MIPS port of r34567. |
965 args = ["trunk", "12345", "23456", "34567"] | 964 args = ["trunk", "12345", "23456", "34567"] |
966 self.assertTrue(merge_to_branch.ProcessOptions(options, args)) | 965 self.assertTrue(merge_to_branch.ProcessOptions(options, args)) |
| 966 |
| 967 # The first run of the script stops because of the svn being down. |
| 968 self.assertRaises(Exception, |
| 969 lambda: RunMergeToBranch(TEST_CONFIG, |
| 970 MergeToBranchOptions(options, args), |
| 971 self)) |
| 972 |
| 973 # Test that state recovery after restarting the script works. |
| 974 options.s = 3 |
967 RunMergeToBranch(TEST_CONFIG, MergeToBranchOptions(options, args), self) | 975 RunMergeToBranch(TEST_CONFIG, MergeToBranchOptions(options, args), self) |
968 | 976 |
969 | 977 |
970 class SystemTest(unittest.TestCase): | 978 class SystemTest(unittest.TestCase): |
971 def testReload(self): | 979 def testReload(self): |
972 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, | 980 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, |
973 options=CommonOptions(MakeOptions()), | 981 options=CommonOptions(MakeOptions()), |
974 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) | 982 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) |
975 body = step.Reload( | 983 body = step.Reload( |
976 """------------------------------------------------------------------------ | 984 """------------------------------------------------------------------------ |
977 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines | 985 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines |
978 | 986 |
979 Prepare push to trunk. Now working on version 3.23.11. | 987 Prepare push to trunk. Now working on version 3.23.11. |
980 | 988 |
981 R=danno@chromium.org | 989 R=danno@chromium.org |
982 | 990 |
983 Review URL: https://codereview.chromium.org/83173002 | 991 Review URL: https://codereview.chromium.org/83173002 |
984 | 992 |
985 ------------------------------------------------------------------------""") | 993 ------------------------------------------------------------------------""") |
986 self.assertEquals( | 994 self.assertEquals( |
987 """Prepare push to trunk. Now working on version 3.23.11. | 995 """Prepare push to trunk. Now working on version 3.23.11. |
988 | 996 |
989 R=danno@chromium.org | 997 R=danno@chromium.org |
990 | 998 |
991 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 999 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |