Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 698513002: Switch auto push script to git. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/auto_push.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 923
924 deps = FileToText(os.path.join(chrome_dir, "DEPS")) 924 deps = FileToText(os.path.join(chrome_dir, "DEPS"))
925 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) 925 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))
926 926
927 def testCheckLastPushRecently(self): 927 def testCheckLastPushRecently(self):
928 self.Expect([ 928 self.Expect([
929 Cmd(("git log -1 --format=%H --grep=" 929 Cmd(("git log -1 --format=%H --grep="
930 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 930 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
931 "origin/candidates"), "hash2\n"), 931 "origin/candidates"), "hash2\n"),
932 Cmd("git log -1 --format=%s hash2", 932 Cmd("git log -1 --format=%s hash2",
933 "Version 3.4.5 (based on bleeding_edge revision r99)\n"), 933 "Version 3.4.5 (based on abc123)\n"),
934 ]) 934 ])
935 935
936 self._state["lkgr"] = "101" 936 self._state["lkgr"] = "abc123"
937 937 self.assertEquals(0, self.RunStep(
938 self.assertRaises(Exception, lambda: self.RunStep(auto_push.AutoPush, 938 auto_push.AutoPush, CheckLastPush, AUTO_PUSH_ARGS))
939 CheckLastPush,
940 AUTO_PUSH_ARGS))
941 939
942 def testAutoPush(self): 940 def testAutoPush(self):
943 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 941 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
944 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist" 942 TEST_CONFIG["SETTINGS_LOCATION"] = "~/.doesnotexist"
945 943
946 self.Expect([ 944 self.Expect([
947 Cmd("git status -s -uno", ""), 945 Cmd("git status -s -uno", ""),
948 Cmd("git status -s -b -uno", "## some_branch\n"), 946 Cmd("git status -s -b -uno", "## some_branch\n"),
949 Cmd("git fetch", ""), 947 Cmd("git fetch", ""),
950 Cmd("git svn fetch", ""), 948 Cmd("git svn fetch", ""),
951 URL("https://v8-status.appspot.com/current?format=json", 949 URL("https://v8-status.appspot.com/current?format=json",
952 "{\"message\": \"Tree is throttled\"}"), 950 "{\"message\": \"Tree is throttled\"}"),
953 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), 951 URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")),
954 URL("https://v8-status.appspot.com/lkgr", "100"), 952 URL("https://v8-status.appspot.com/lkgr", "abc123"),
955 Cmd(("git log -1 --format=%H --grep=\"" 953 Cmd(("git log -1 --format=%H --grep=\""
956 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" 954 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\""
957 " origin/candidates"), "push_hash\n"), 955 " origin/candidates"), "push_hash\n"),
958 Cmd("git log -1 --format=%s push_hash", 956 Cmd("git log -1 --format=%s push_hash",
959 "Version 3.4.5 (based on bleeding_edge revision r79)\n"), 957 "Version 3.4.5 (based on abc101)\n"),
960 ]) 958 ])
961 959
962 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) 960 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
963 961
964 state = json.loads(FileToText("%s-state.json" 962 state = json.loads(FileToText("%s-state.json"
965 % TEST_CONFIG["PERSISTFILE_BASENAME"])) 963 % TEST_CONFIG["PERSISTFILE_BASENAME"]))
966 964
967 self.assertEquals("100", state["lkgr"]) 965 self.assertEquals("abc123", state["lkgr"])
968 966
969 def testAutoPushStoppedBySettings(self): 967 def testAutoPushStoppedBySettings(self):
970 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 968 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
971 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile() 969 TEST_CONFIG["SETTINGS_LOCATION"] = self.MakeEmptyTempFile()
972 TextToFile("{\"enable_auto_push\": false}", 970 TextToFile("{\"enable_auto_push\": false}",
973 TEST_CONFIG["SETTINGS_LOCATION"]) 971 TEST_CONFIG["SETTINGS_LOCATION"])
974 972
975 self.Expect([ 973 self.Expect([
976 Cmd("git status -s -uno", ""), 974 Cmd("git status -s -uno", ""),
977 Cmd("git status -s -b -uno", "## some_branch\n"), 975 Cmd("git status -s -b -uno", "## some_branch\n"),
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 1709
1712 Review URL: https://codereview.chromium.org/83173002 1710 Review URL: https://codereview.chromium.org/83173002
1713 1711
1714 ------------------------------------------------------------------------""") 1712 ------------------------------------------------------------------------""")
1715 self.assertEquals( 1713 self.assertEquals(
1716 """Prepare push to trunk. Now working on version 3.23.11. 1714 """Prepare push to trunk. Now working on version 3.23.11.
1717 1715
1718 R=danno@chromium.org 1716 R=danno@chromium.org
1719 1717
1720 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1718 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/auto_push.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698