| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 | 934 |
| 935 def testCheckLastPushRecently(self): | 935 def testCheckLastPushRecently(self): |
| 936 self.Expect([ | 936 self.Expect([ |
| 937 Cmd(("git log -1 --format=%H --grep=" | 937 Cmd(("git log -1 --format=%H --grep=" |
| 938 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 938 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
| 939 "origin/candidates"), "hash2\n"), | 939 "origin/candidates"), "hash2\n"), |
| 940 Cmd("git log -1 --format=%s hash2", | 940 Cmd("git log -1 --format=%s hash2", |
| 941 "Version 3.4.5 (based on abc123)\n"), | 941 "Version 3.4.5 (based on abc123)\n"), |
| 942 ]) | 942 ]) |
| 943 | 943 |
| 944 self._state["lkgr"] = "abc123" | 944 self._state["candidate"] = "abc123" |
| 945 self.assertEquals(0, self.RunStep( | 945 self.assertEquals(0, self.RunStep( |
| 946 auto_push.AutoPush, CheckLastPush, AUTO_PUSH_ARGS)) | 946 auto_push.AutoPush, CheckLastPush, AUTO_PUSH_ARGS)) |
| 947 | 947 |
| 948 def testAutoPush(self): | 948 def testAutoPush(self): |
| 949 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 949 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
| 950 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist" | 950 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist" |
| 951 | 951 |
| 952 self.Expect([ | 952 self.Expect([ |
| 953 Cmd("git status -s -uno", ""), | 953 Cmd("git status -s -uno", ""), |
| 954 Cmd("git status -s -b -uno", "## some_branch\n"), | 954 Cmd("git status -s -b -uno", "## some_branch\n"), |
| 955 Cmd("git fetch", ""), | 955 Cmd("git fetch", ""), |
| 956 URL("https://v8-status.appspot.com/current?format=json", | 956 URL("https://v8-status.appspot.com/current?format=json", |
| 957 "{\"message\": \"Tree is throttled\"}"), | 957 "{\"message\": \"Tree is throttled\"}"), |
| 958 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), | 958 Cmd("git fetch origin +refs/heads/candidate:refs/heads/candidate", ""), |
| 959 URL("https://v8-status.appspot.com/lkgr", "abc123"), | 959 Cmd("git show-ref -s refs/heads/candidate", "abc123"), |
| 960 Cmd(("git log -1 --format=%H --grep=\"" | 960 Cmd(("git log -1 --format=%H --grep=\"" |
| 961 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" | 961 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" |
| 962 " origin/candidates"), "push_hash\n"), | 962 " origin/candidates"), "push_hash\n"), |
| 963 Cmd("git log -1 --format=%s push_hash", | 963 Cmd("git log -1 --format=%s push_hash", |
| 964 "Version 3.4.5 (based on abc101)\n"), | 964 "Version 3.4.5 (based on abc101)\n"), |
| 965 ]) | 965 ]) |
| 966 | 966 |
| 967 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) | 967 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) |
| 968 | 968 |
| 969 state = json.loads(FileToText("%s-state.json" | 969 state = json.loads(FileToText("%s-state.json" |
| 970 % TEST_CONFIG["PERSISTFILE_BASENAME"])) | 970 % TEST_CONFIG["PERSISTFILE_BASENAME"])) |
| 971 | 971 |
| 972 self.assertEquals("abc123", state["lkgr"]) | 972 self.assertEquals("abc123", state["candidate"]) |
| 973 | 973 |
| 974 def testAutoPushStoppedBySettings(self): | 974 def testAutoPushStoppedBySettings(self): |
| 975 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 975 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
| 976 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile() | 976 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile() |
| 977 TextToFile("{\"enable_auto_push\": false}", | 977 TextToFile("{\"enable_auto_push\": false}", |
| 978 TEST_CONFIG["SETTINGS_LOCATION"]) | 978 TEST_CONFIG["SETTINGS_LOCATION"]) |
| 979 | 979 |
| 980 self.Expect([ | 980 self.Expect([ |
| 981 Cmd("git status -s -uno", ""), | 981 Cmd("git status -s -uno", ""), |
| 982 Cmd("git status -s -b -uno", "## some_branch\n"), | 982 Cmd("git status -s -b -uno", "## some_branch\n"), |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 | 1505 |
| 1506 Review URL: https://codereview.chromium.org/83173002 | 1506 Review URL: https://codereview.chromium.org/83173002 |
| 1507 | 1507 |
| 1508 ------------------------------------------------------------------------""") | 1508 ------------------------------------------------------------------------""") |
| 1509 self.assertEquals( | 1509 self.assertEquals( |
| 1510 """Prepare push to trunk. Now working on version 3.23.11. | 1510 """Prepare push to trunk. Now working on version 3.23.11. |
| 1511 | 1511 |
| 1512 R=danno@chromium.org | 1512 R=danno@chromium.org |
| 1513 | 1513 |
| 1514 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1514 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |