| 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 } | 1024 } |
| 1025 deps = { | 1025 deps = { |
| 1026 "src/v8": | 1026 "src/v8": |
| 1027 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + | 1027 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + |
| 1028 Var("v8_revision"), | 1028 Var("v8_revision"), |
| 1029 } | 1029 } |
| 1030 """ | 1030 """ |
| 1031 | 1031 |
| 1032 def testChromiumRollUpToDate(self): | 1032 def testChromiumRollUpToDate(self): |
| 1033 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1033 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
| 1034 json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json") |
| 1034 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1035 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
| 1035 self.Expect([ | 1036 self.Expect([ |
| 1036 Cmd("git fetch origin", ""), | 1037 Cmd("git fetch origin", ""), |
| 1037 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1038 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1038 Cmd("git describe --tags last_roll_hsh", "3.22.4"), | 1039 Cmd("git describe --tags last_roll_hsh", "3.22.4"), |
| 1039 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1040 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1040 Cmd("git rev-list --max-age=740800 --tags", | 1041 Cmd("git rev-list --max-age=740800 --tags", |
| 1041 "bad_tag\nroll_hsh\nhash_123"), | 1042 "bad_tag\nroll_hsh\nhash_123"), |
| 1042 Cmd("git describe --tags bad_tag", ""), | 1043 Cmd("git describe --tags bad_tag", ""), |
| 1043 Cmd("git describe --tags roll_hsh", "3.22.4"), | 1044 Cmd("git describe --tags roll_hsh", "3.22.4"), |
| 1044 Cmd("git describe --tags hash_123", "3.22.3"), | 1045 Cmd("git describe --tags hash_123", "3.22.3"), |
| 1045 Cmd("git describe --tags roll_hsh", "3.22.4"), | 1046 Cmd("git describe --tags roll_hsh", "3.22.4"), |
| 1046 Cmd("git describe --tags hash_123", "3.22.3"), | 1047 Cmd("git describe --tags hash_123", "3.22.3"), |
| 1047 ]) | 1048 ]) |
| 1048 | 1049 |
| 1049 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1050 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
| 1050 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) | 1051 AUTO_PUSH_ARGS + [ |
| 1052 "-c", TEST_CONFIG["CHROMIUM"], |
| 1053 "--json-output", json_output_file]) |
| 1051 self.assertEquals(0, result) | 1054 self.assertEquals(0, result) |
| 1055 json_output = json.loads(FileToText(json_output_file)) |
| 1056 self.assertEquals("up_to_date", json_output["monitoring_state"]) |
| 1057 |
| 1052 | 1058 |
| 1053 def testChromiumRoll(self): | 1059 def testChromiumRoll(self): |
| 1054 # Setup fake directory structures. | 1060 # Setup fake directory structures. |
| 1055 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1061 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
| 1062 json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json") |
| 1056 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1063 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
| 1057 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) | 1064 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) |
| 1058 chrome_dir = TEST_CONFIG["CHROMIUM"] | 1065 chrome_dir = TEST_CONFIG["CHROMIUM"] |
| 1059 os.makedirs(os.path.join(chrome_dir, "v8")) | 1066 os.makedirs(os.path.join(chrome_dir, "v8")) |
| 1060 | 1067 |
| 1061 def WriteDeps(): | 1068 def WriteDeps(): |
| 1062 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", | 1069 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", |
| 1063 os.path.join(chrome_dir, "DEPS")) | 1070 os.path.join(chrome_dir, "DEPS")) |
| 1064 | 1071 |
| 1065 expectations = [ | 1072 expectations = [ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1089 self.ROLL_COMMIT_MSG), | 1096 self.ROLL_COMMIT_MSG), |
| 1090 "", cwd=chrome_dir), | 1097 "", cwd=chrome_dir), |
| 1091 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " | 1098 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f " |
| 1092 "--use-commit-queue", "", cwd=chrome_dir), | 1099 "--use-commit-queue", "", cwd=chrome_dir), |
| 1093 Cmd("git checkout -f master", "", cwd=chrome_dir), | 1100 Cmd("git checkout -f master", "", cwd=chrome_dir), |
| 1094 Cmd("git branch -D work-branch", "", cwd=chrome_dir), | 1101 Cmd("git branch -D work-branch", "", cwd=chrome_dir), |
| 1095 ] | 1102 ] |
| 1096 self.Expect(expectations) | 1103 self.Expect(expectations) |
| 1097 | 1104 |
| 1098 args = ["-a", "author@chromium.org", "-c", chrome_dir, | 1105 args = ["-a", "author@chromium.org", "-c", chrome_dir, |
| 1099 "-r", "reviewer@chromium.org"] | 1106 "-r", "reviewer@chromium.org", "--json-output", json_output_file] |
| 1100 auto_roll.AutoRoll(TEST_CONFIG, self).Run(args) | 1107 auto_roll.AutoRoll(TEST_CONFIG, self).Run(args) |
| 1101 | 1108 |
| 1102 deps = FileToText(os.path.join(chrome_dir, "DEPS")) | 1109 deps = FileToText(os.path.join(chrome_dir, "DEPS")) |
| 1103 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) | 1110 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) |
| 1104 | 1111 |
| 1112 json_output = json.loads(FileToText(json_output_file)) |
| 1113 self.assertEquals("success", json_output["monitoring_state"]) |
| 1114 |
| 1105 def testCheckLastPushRecently(self): | 1115 def testCheckLastPushRecently(self): |
| 1106 self.Expect([ | 1116 self.Expect([ |
| 1107 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1117 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1108 Cmd("git tag", self.TAGS), | 1118 Cmd("git tag", self.TAGS), |
| 1109 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), | 1119 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), |
| 1110 Cmd("git log -1 --format=%s release_hash", | 1120 Cmd("git log -1 --format=%s release_hash", |
| 1111 "Version 3.22.4 (based on abc3)\n"), | 1121 "Version 3.22.4 (based on abc3)\n"), |
| 1112 Cmd("git log --format=%H abc3..abc123", "\n"), | 1122 Cmd("git log --format=%H abc3..abc123", "\n"), |
| 1113 ]) | 1123 ]) |
| 1114 | 1124 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 | 1546 |
| 1537 Review URL: https://codereview.chromium.org/83173002 | 1547 Review URL: https://codereview.chromium.org/83173002 |
| 1538 | 1548 |
| 1539 ------------------------------------------------------------------------""") | 1549 ------------------------------------------------------------------------""") |
| 1540 self.assertEquals( | 1550 self.assertEquals( |
| 1541 """Prepare push to trunk. Now working on version 3.23.11. | 1551 """Prepare push to trunk. Now working on version 3.23.11. |
| 1542 | 1552 |
| 1543 R=danno@chromium.org | 1553 R=danno@chromium.org |
| 1544 | 1554 |
| 1545 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1555 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |