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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 msg = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 424 msg = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
425 self.assertTrue(re.search(r"Version 3\.22\.5", msg)) | 425 self.assertTrue(re.search(r"Version 3\.22\.5", msg)) |
426 self.assertTrue(re.search(r"Performance and stability", msg)) | 426 self.assertTrue(re.search(r"Performance and stability", msg)) |
427 self.assertTrue(re.search(r"Log text 1\. Chromium issue 12345", msg)) | 427 self.assertTrue(re.search(r"Log text 1\. Chromium issue 12345", msg)) |
428 self.assertFalse(re.search(r"\d+\-\d+\-\d+", msg)) | 428 self.assertFalse(re.search(r"\d+\-\d+\-\d+", msg)) |
429 | 429 |
430 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) | 430 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) |
431 self.assertTrue(re.search(r"patch content", patch)) | 431 self.assertTrue(re.search(r"patch content", patch)) |
432 | 432 |
433 def testPushToTrunk(self): | 433 def _PushToTrunk(self, force=False): |
434 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 434 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
435 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 435 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
436 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 436 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
437 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 437 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
438 if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 438 if not os.path.exists(TEST_CONFIG[CHROMIUM]): |
439 os.makedirs(TEST_CONFIG[CHROMIUM]) | 439 os.makedirs(TEST_CONFIG[CHROMIUM]) |
440 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) | 440 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) |
441 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 441 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
442 TEST_CONFIG[DEPS_FILE]) | 442 TEST_CONFIG[DEPS_FILE]) |
443 os.environ["EDITOR"] = "vi" | 443 os.environ["EDITOR"] = "vi" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 self._rl_recipe = [ | 511 self._rl_recipe = [ |
512 "Y", # Confirm last push. | 512 "Y", # Confirm last push. |
513 "", # Open editor. | 513 "", # Open editor. |
514 "Y", # Increment build number. | 514 "Y", # Increment build number. |
515 "reviewer@chromium.org", # V8 reviewer. | 515 "reviewer@chromium.org", # V8 reviewer. |
516 "LGTX", # Enter LGTM for V8 CL (wrong). | 516 "LGTX", # Enter LGTM for V8 CL (wrong). |
517 "LGTM", # Enter LGTM for V8 CL. | 517 "LGTM", # Enter LGTM for V8 CL. |
518 "Y", # Sanity check. | 518 "Y", # Sanity check. |
519 "reviewer@chromium.org", # Chromium reviewer. | 519 "reviewer@chromium.org", # Chromium reviewer. |
520 ] | 520 ] |
| 521 if force: |
| 522 # TODO(machenbach): The lgtm for the prepare push is just temporary. |
| 523 # There should be no user input in "force" mode. |
| 524 self._rl_recipe = [ |
| 525 "LGTM", # Enter LGTM for V8 CL. |
| 526 ] |
521 | 527 |
522 class Options( object ): | 528 class Options( object ): |
523 pass | 529 pass |
524 | 530 |
525 options = Options() | 531 options = Options() |
526 options.s = 0 | 532 options.s = 0 |
527 options.l = None | 533 options.l = None |
| 534 options.f = force |
| 535 options.r = "reviewer@chromium.org" if force else None |
528 options.c = TEST_CONFIG[CHROMIUM] | 536 options.c = TEST_CONFIG[CHROMIUM] |
529 RunPushToTrunk(TEST_CONFIG, options, self) | 537 RunPushToTrunk(TEST_CONFIG, options, self) |
530 | 538 |
531 deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 539 deps = FileToText(TEST_CONFIG[DEPS_FILE]) |
532 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 540 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |
533 | 541 |
534 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 542 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
535 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 543 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
536 self.assertTrue(re.search(r" Log text 1", cl)) | 544 self.assertTrue(re.search(r" Log text 1", cl)) |
537 self.assertTrue(re.search(r" \(issue 321\)", cl)) | 545 self.assertTrue(re.search(r" \(issue 321\)", cl)) |
538 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 546 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
539 | 547 |
540 # Note: The version file is on build number 5 again in the end of this test | 548 # Note: The version file is on build number 5 again in the end of this test |
541 # since the git command that merges to the bleeding edge branch is mocked | 549 # since the git command that merges to the bleeding edge branch is mocked |
542 # out. | 550 # out. |
| 551 |
| 552 def testPushToTrunk(self): |
| 553 self._PushToTrunk() |
| 554 |
| 555 def testPushToTrunkForced(self): |
| 556 self._PushToTrunk(force=True) |
OLD | NEW |