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

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

Issue 540973002: Add cwd to all shell commands in auto roll scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months 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/releases.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
11 # disclaimer in the documentation and/or other materials provided 11 # disclaimer in the documentation and/or other materials provided
12 # with the distribution. 12 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its 13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived 14 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission. 15 # from this software without specific prior written permission.
16 # 16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import os 29 import os
30 import shutil
30 import tempfile 31 import tempfile
31 import traceback 32 import traceback
32 import unittest 33 import unittest
33 34
34 import auto_push 35 import auto_push
35 from auto_push import CheckLastPush 36 from auto_push import CheckLastPush
36 from auto_push import SETTINGS_LOCATION 37 from auto_push import SETTINGS_LOCATION
37 import auto_roll 38 import auto_roll
38 from auto_roll import CLUSTERFUZZ_API_KEY_FILE 39 from auto_roll import CLUSTERFUZZ_API_KEY_FILE
39 import common_includes 40 import common_includes
40 from common_includes import * 41 from common_includes import *
41 import merge_to_branch 42 import merge_to_branch
42 from merge_to_branch import * 43 from merge_to_branch import *
43 import push_to_trunk 44 import push_to_trunk
44 from push_to_trunk import * 45 from push_to_trunk import *
45 import chromium_roll 46 import chromium_roll
46 from chromium_roll import CHROMIUM 47 from chromium_roll import CHROMIUM
47 from chromium_roll import DEPS_FILE
48 from chromium_roll import ChromiumRoll 48 from chromium_roll import ChromiumRoll
49 import releases 49 import releases
50 from releases import Releases 50 from releases import Releases
51 import bump_up_version 51 import bump_up_version
52 from bump_up_version import BumpUpVersion 52 from bump_up_version import BumpUpVersion
53 from bump_up_version import LastChangeBailout 53 from bump_up_version import LastChangeBailout
54 from bump_up_version import LKGRVersionUpToDateBailout 54 from bump_up_version import LKGRVersionUpToDateBailout
55 from auto_tag import AutoTag 55 from auto_tag import AutoTag
56 56
57 57
58 TEST_CONFIG = { 58 TEST_CONFIG = {
59 "DEFAULT_CWD": "[DEFAULT_CWD]",
59 BRANCHNAME: "test-prepare-push", 60 BRANCHNAME: "test-prepare-push",
60 TRUNKBRANCH: "test-trunk-push", 61 TRUNKBRANCH: "test-trunk-push",
61 PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile", 62 PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile",
62 DOT_GIT_LOCATION: None, 63 DOT_GIT_LOCATION: None,
63 VERSION_FILE: None, 64 VERSION_FILE: None,
64 CHANGELOG_FILE: None, 65 CHANGELOG_FILE: None,
65 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", 66 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry",
66 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", 67 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch",
67 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", 68 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg",
68 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", 69 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium",
69 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS",
70 SETTINGS_LOCATION: None, 70 SETTINGS_LOCATION: None,
71 ALREADY_MERGING_SENTINEL_FILE: 71 ALREADY_MERGING_SENTINEL_FILE:
72 "/tmp/test-merge-to-branch-tempfile-already-merging", 72 "/tmp/test-merge-to-branch-tempfile-already-merging",
73 COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES", 73 COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES",
74 TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch", 74 TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch",
75 CLUSTERFUZZ_API_KEY_FILE: "/tmp/test-fake-cf-api-key", 75 CLUSTERFUZZ_API_KEY_FILE: "/tmp/test-fake-cf-api-key",
76 } 76 }
77 77
78 78
79 AUTO_PUSH_ARGS = [ 79 AUTO_PUSH_ARGS = [
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 "BUG=1234567890\n")) 252 "BUG=1234567890\n"))
253 253
254 254
255 def Cmd(*args, **kwargs): 255 def Cmd(*args, **kwargs):
256 """Convenience function returning a shell command test expectation.""" 256 """Convenience function returning a shell command test expectation."""
257 return { 257 return {
258 "name": "command", 258 "name": "command",
259 "args": args, 259 "args": args,
260 "ret": args[-1], 260 "ret": args[-1],
261 "cb": kwargs.get("cb"), 261 "cb": kwargs.get("cb"),
262 "cwd": kwargs.get("cwd", "[DEFAULT_CWD]"),
262 } 263 }
263 264
264 265
265 def RL(text, cb=None): 266 def RL(text, cb=None):
266 """Convenience function returning a readline test expectation.""" 267 """Convenience function returning a readline test expectation."""
267 return {"name": "readline", "args": [], "ret": text, "cb": cb} 268 return {
269 "name": "readline",
270 "args": [],
271 "ret": text,
272 "cb": cb,
273 "cwd": None,
274 }
268 275
269 276
270 def URL(*args, **kwargs): 277 def URL(*args, **kwargs):
271 """Convenience function returning a readurl test expectation.""" 278 """Convenience function returning a readurl test expectation."""
272 return { 279 return {
273 "name": "readurl", 280 "name": "readurl",
274 "args": args[:-1], 281 "args": args[:-1],
275 "ret": args[-1], 282 "ret": args[-1],
276 "cb": kwargs.get("cb"), 283 "cb": kwargs.get("cb"),
284 "cwd": None,
277 } 285 }
278 286
279 287
280 class SimpleMock(object): 288 class SimpleMock(object):
281 def __init__(self): 289 def __init__(self):
282 self._recipe = [] 290 self._recipe = []
283 self._index = -1 291 self._index = -1
284 292
285 def Expect(self, recipe): 293 def Expect(self, recipe):
286 self._recipe = recipe 294 self._recipe = recipe
287 295
288 def Call(self, name, *args): # pragma: no cover 296 def Call(self, name, *args, **kwargs): # pragma: no cover
289 self._index += 1 297 self._index += 1
290 try: 298 try:
291 expected_call = self._recipe[self._index] 299 expected_call = self._recipe[self._index]
292 except IndexError: 300 except IndexError:
293 raise NoRetryException("Calling %s %s" % (name, " ".join(args))) 301 raise NoRetryException("Calling %s %s" % (name, " ".join(args)))
294 302
295 if not isinstance(expected_call, dict): 303 if not isinstance(expected_call, dict):
296 raise NoRetryException("Found wrong expectation type for %s %s" % 304 raise NoRetryException("Found wrong expectation type for %s %s" %
297 (name, " ".join(args))) 305 (name, " ".join(args)))
298 306
299 if expected_call["name"] != name: 307 if expected_call["name"] != name:
300 raise NoRetryException("Expected action: %s %s - Actual: %s" % 308 raise NoRetryException("Expected action: %s %s - Actual: %s" %
301 (expected_call["name"], expected_call["args"], name)) 309 (expected_call["name"], expected_call["args"], name))
302 310
311 # Check if the given working directory matches the expected one.
312 if expected_call["cwd"] != kwargs.get("cwd"):
313 raise NoRetryException("Expected cwd: %s in %s %s - Actual: %s" %
314 (expected_call["cwd"],
315 expected_call["name"],
316 expected_call["args"],
317 kwargs.get("cwd")))
318
303 # The number of arguments in the expectation must match the actual 319 # The number of arguments in the expectation must match the actual
304 # arguments. 320 # arguments.
305 if len(args) > len(expected_call['args']): 321 if len(args) > len(expected_call['args']):
306 raise NoRetryException("When calling %s with arguments, the " 322 raise NoRetryException("When calling %s with arguments, the "
307 "expectations must consist of at least as many arguments." % 323 "expectations must consist of at least as many arguments." %
308 name) 324 name)
309 325
310 # Compare expected and actual arguments. 326 # Compare expected and actual arguments.
311 for (expected_arg, actual_arg) in zip(expected_call['args'], args): 327 for (expected_arg, actual_arg) in zip(expected_call['args'], args):
312 if expected_arg != actual_arg: 328 if expected_arg != actual_arg:
(...skipping 20 matching lines...) Expand all
333 (self._index, len(self._recipe))) 349 (self._index, len(self._recipe)))
334 350
335 351
336 class ScriptTest(unittest.TestCase): 352 class ScriptTest(unittest.TestCase):
337 def MakeEmptyTempFile(self): 353 def MakeEmptyTempFile(self):
338 handle, name = tempfile.mkstemp() 354 handle, name = tempfile.mkstemp()
339 os.close(handle) 355 os.close(handle)
340 self._tmp_files.append(name) 356 self._tmp_files.append(name)
341 return name 357 return name
342 358
359 def MakeEmptyTempDirectory(self):
360 name = tempfile.mkdtemp()
361 self._tmp_files.append(name)
362 return name
363
364
343 def WriteFakeVersionFile(self, minor=22, build=4, patch=0): 365 def WriteFakeVersionFile(self, minor=22, build=4, patch=0):
344 with open(TEST_CONFIG[VERSION_FILE], "w") as f: 366 with open(TEST_CONFIG[VERSION_FILE], "w") as f:
345 f.write(" // Some line...\n") 367 f.write(" // Some line...\n")
346 f.write("\n") 368 f.write("\n")
347 f.write("#define MAJOR_VERSION 3\n") 369 f.write("#define MAJOR_VERSION 3\n")
348 f.write("#define MINOR_VERSION %s\n" % minor) 370 f.write("#define MINOR_VERSION %s\n" % minor)
349 f.write("#define BUILD_NUMBER %s\n" % build) 371 f.write("#define BUILD_NUMBER %s\n" % build)
350 f.write("#define PATCH_LEVEL %s\n" % patch) 372 f.write("#define PATCH_LEVEL %s\n" % patch)
351 f.write(" // Some line...\n") 373 f.write(" // Some line...\n")
352 f.write("#define IS_CANDIDATE_VERSION 0\n") 374 f.write("#define IS_CANDIDATE_VERSION 0\n")
353 375
354 def MakeStep(self): 376 def MakeStep(self):
355 """Convenience wrapper.""" 377 """Convenience wrapper."""
356 options = ScriptsBase(TEST_CONFIG, self, self._state).MakeOptions([]) 378 options = ScriptsBase(TEST_CONFIG, self, self._state).MakeOptions([])
357 return MakeStep(step_class=Step, state=self._state, 379 return MakeStep(step_class=Step, state=self._state,
358 config=TEST_CONFIG, side_effect_handler=self, 380 config=TEST_CONFIG, side_effect_handler=self,
359 options=options) 381 options=options)
360 382
361 def RunStep(self, script=PushToTrunk, step_class=Step, args=None): 383 def RunStep(self, script=PushToTrunk, step_class=Step, args=None):
362 """Convenience wrapper.""" 384 """Convenience wrapper."""
363 args = args if args is not None else ["-m"] 385 args = args if args is not None else ["-m"]
364 return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args) 386 return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args)
365 387
366 def Call(self, fun, *args, **kwargs): 388 def Call(self, fun, *args, **kwargs):
367 print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs)) 389 print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs))
368 390
369 def Command(self, cmd, args="", prefix="", pipe=True): 391 def Command(self, cmd, args="", prefix="", pipe=True, cwd=None):
370 print "%s %s" % (cmd, args) 392 print "%s %s" % (cmd, args)
371 return self._mock.Call("command", cmd + " " + args) 393 print "in %s" % cwd
394 return self._mock.Call("command", cmd + " " + args, cwd=cwd)
372 395
373 def ReadLine(self): 396 def ReadLine(self):
374 return self._mock.Call("readline") 397 return self._mock.Call("readline")
375 398
376 def ReadURL(self, url, params): 399 def ReadURL(self, url, params):
377 if params is not None: 400 if params is not None:
378 return self._mock.Call("readurl", url, params) 401 return self._mock.Call("readurl", url, params)
379 else: 402 else:
380 return self._mock.Call("readurl", url) 403 return self._mock.Call("readurl", url)
381 404
(...skipping 14 matching lines...) Expand all
396 def Expect(self, *args): 419 def Expect(self, *args):
397 """Convenience wrapper.""" 420 """Convenience wrapper."""
398 self._mock.Expect(*args) 421 self._mock.Expect(*args)
399 422
400 def setUp(self): 423 def setUp(self):
401 self._mock = SimpleMock() 424 self._mock = SimpleMock()
402 self._tmp_files = [] 425 self._tmp_files = []
403 self._state = {} 426 self._state = {}
404 427
405 def tearDown(self): 428 def tearDown(self):
406 Command("rm", "-rf %s*" % TEST_CONFIG[PERSISTFILE_BASENAME]) 429 if os.path.exists(TEST_CONFIG[PERSISTFILE_BASENAME]):
430 shutil.rmtree(TEST_CONFIG[PERSISTFILE_BASENAME])
407 431
408 # Clean up temps. Doesn't work automatically. 432 # Clean up temps. Doesn't work automatically.
409 for name in self._tmp_files: 433 for name in self._tmp_files:
410 if os.path.exists(name): 434 if os.path.isfile(name):
411 os.remove(name) 435 os.remove(name)
436 if os.path.isdir(name):
437 shutil.rmtree(name)
412 438
413 self._mock.AssertFinished() 439 self._mock.AssertFinished()
414 440
415 def testGitOrig(self):
416 self.assertTrue(Command("git", "--version").startswith("git version"))
417
418 def testGitMock(self): 441 def testGitMock(self):
419 self.Expect([Cmd("git --version", "git version 1.2.3"), 442 self.Expect([Cmd("git --version", "git version 1.2.3"),
420 Cmd("git dummy", "")]) 443 Cmd("git dummy", "")])
421 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) 444 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version"))
422 self.assertEquals("", self.MakeStep().Git("dummy")) 445 self.assertEquals("", self.MakeStep().Git("dummy"))
423 446
424 def testCommonPrepareDefault(self): 447 def testCommonPrepareDefault(self):
425 self.Expect([ 448 self.Expect([
426 Cmd("git status -s -uno", ""), 449 Cmd("git status -s -uno", ""),
427 Cmd("git status -s -b -uno", "## some_branch"), 450 Cmd("git status -s -b -uno", "## some_branch"),
(...skipping 27 matching lines...) Expand all
455 RL("Y"), 478 RL("Y"),
456 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], None), 479 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], None),
457 ]) 480 ])
458 self.MakeStep().CommonPrepare() 481 self.MakeStep().CommonPrepare()
459 self.assertRaises(Exception, self.MakeStep().PrepareBranch) 482 self.assertRaises(Exception, self.MakeStep().PrepareBranch)
460 self.assertEquals("some_branch", self._state["current_branch"]) 483 self.assertEquals("some_branch", self._state["current_branch"])
461 484
462 def testInitialEnvironmentChecks(self): 485 def testInitialEnvironmentChecks(self):
463 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 486 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
464 os.environ["EDITOR"] = "vi" 487 os.environ["EDITOR"] = "vi"
488 self.Expect([
489 Cmd("which vi", "/usr/bin/vi"),
490 ])
465 self.MakeStep().InitialEnvironmentChecks() 491 self.MakeStep().InitialEnvironmentChecks()
466 492
467 def testReadAndPersistVersion(self): 493 def testReadAndPersistVersion(self):
468 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 494 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
469 self.WriteFakeVersionFile(build=5) 495 self.WriteFakeVersionFile(build=5)
470 step = self.MakeStep() 496 step = self.MakeStep()
471 step.ReadAndPersistVersion() 497 step.ReadAndPersistVersion()
472 self.assertEquals("3", step["major"]) 498 self.assertEquals("3", step["major"])
473 self.assertEquals("22", step["minor"]) 499 self.assertEquals("22", step["minor"])
474 self.assertEquals("5", step["build"]) 500 self.assertEquals("5", step["build"])
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 730
705 Performance and stability improvements on all platforms. 731 Performance and stability improvements on all platforms.
706 732
707 733
708 1999-04-05: Version 3.22.4 734 1999-04-05: Version 3.22.4
709 735
710 Performance and stability improvements on all platforms.\n""", 736 Performance and stability improvements on all platforms.\n""",
711 change_log) 737 change_log)
712 738
713 force_flag = " -f" if not manual else "" 739 force_flag = " -f" if not manual else ""
714 expectations = [ 740 expectations = []
741 if not force:
742 expectations.append(Cmd("which vi", "/usr/bin/vi"))
743 expectations += [
715 Cmd("git status -s -uno", ""), 744 Cmd("git status -s -uno", ""),
716 Cmd("git status -s -b -uno", "## some_branch\n"), 745 Cmd("git status -s -b -uno", "## some_branch\n"),
717 Cmd("git svn fetch", ""), 746 Cmd("git svn fetch", ""),
718 Cmd("git branch", " branch1\n* branch2\n"), 747 Cmd("git branch", " branch1\n* branch2\n"),
719 Cmd("git branch", " branch1\n* branch2\n"), 748 Cmd("git branch", " branch1\n* branch2\n"),
720 Cmd("git checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], 749 Cmd("git checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME],
721 ""), 750 ""),
722 Cmd("git svn find-rev r123455", "push_hash\n"), 751 Cmd("git svn find-rev r123455", "push_hash\n"),
723 Cmd(("git log -1 --format=%H --grep=" 752 Cmd(("git log -1 --format=%H --grep="
724 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 753 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 849
821 def testChromiumRoll(self): 850 def testChromiumRoll(self):
822 googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME] 851 googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME]
823 with open(googlers_mapping_py, "w") as f: 852 with open(googlers_mapping_py, "w") as f:
824 f.write(""" 853 f.write("""
825 def list_to_dict(entries): 854 def list_to_dict(entries):
826 return {"g_name@google.com": "c_name@chromium.org"} 855 return {"g_name@google.com": "c_name@chromium.org"}
827 def get_list(): 856 def get_list():
828 pass""") 857 pass""")
829 858
859 # Setup fake directory structures.
830 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 860 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
831 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 861 TEST_CONFIG[CHROMIUM] = self.MakeEmptyTempDirectory()
832 os.makedirs(TEST_CONFIG[CHROMIUM]) 862 chrome_dir = TEST_CONFIG[CHROMIUM]
833 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): 863 os.makedirs(os.path.join(chrome_dir, "v8"))
834 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) 864
865 # Write fake deps file.
835 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", 866 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
836 TEST_CONFIG[DEPS_FILE]) 867 os.path.join(chrome_dir, "DEPS"))
837 def WriteDeps(): 868 def WriteDeps():
838 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", 869 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line",
839 TEST_CONFIG[DEPS_FILE]) 870 os.path.join(chrome_dir, "DEPS"))
840 871
841 expectations = [ 872 expectations = [
842 Cmd("git fetch origin", ""), 873 Cmd("git fetch origin", ""),
843 Cmd(("git log -1 --format=%H --grep=" 874 Cmd(("git log -1 --format=%H --grep="
844 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 875 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
845 "origin/master"), "push_hash\n"), 876 "origin/master"), "push_hash\n"),
846 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG), 877 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
847 Cmd("git log -1 --format=%s push_hash", 878 Cmd("git log -1 --format=%s push_hash",
848 "Version 3.22.5 (based on bleeding_edge revision r22622)\n"), 879 "Version 3.22.5 (based on bleeding_edge revision r22622)\n"),
849 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", 880 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js",
850 "document.write('g_name')"), 881 "document.write('g_name')"),
851 Cmd("git status -s -uno", ""), 882 Cmd("git status -s -uno", "", cwd=chrome_dir),
852 Cmd("git checkout -f master", ""), 883 Cmd("git checkout -f master", "", cwd=chrome_dir),
853 Cmd("gclient sync --nohooks", "syncing..."), 884 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir),
854 Cmd("git pull", ""), 885 Cmd("git pull", "", cwd=chrome_dir),
855 Cmd("git fetch origin", ""), 886 Cmd("git fetch origin", ""),
856 Cmd("git checkout -b v8-roll-22624", ""), 887 Cmd("git checkout -b v8-roll-22624", "", cwd=chrome_dir),
857 Cmd("roll-dep v8 22624", "rolled", cb=WriteDeps), 888 Cmd("roll-dep v8 22624", "rolled", cb=WriteDeps, cwd=chrome_dir),
858 Cmd(("git commit -am \"Update V8 to version 3.22.5 " 889 Cmd(("git commit -am \"Update V8 to version 3.22.5 "
859 "(based on bleeding_edge revision r22622).\n\n" 890 "(based on bleeding_edge revision r22622).\n\n"
860 "Please reply to the V8 sheriff c_name@chromium.org in " 891 "Please reply to the V8 sheriff c_name@chromium.org in "
861 "case of problems.\n\nTBR=c_name@chromium.org\" " 892 "case of problems.\n\nTBR=c_name@chromium.org\" "
862 "--author \"author@chromium.org <author@chromium.org>\""), 893 "--author \"author@chromium.org <author@chromium.org>\""),
863 ""), 894 "", cwd=chrome_dir),
864 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", ""), 895 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", "",
896 cwd=chrome_dir),
865 ] 897 ]
866 self.Expect(expectations) 898 self.Expect(expectations)
867 899
868 args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM], 900 args = ["-a", "author@chromium.org", "-c", chrome_dir,
869 "--sheriff", "--googlers-mapping", googlers_mapping_py, 901 "--sheriff", "--googlers-mapping", googlers_mapping_py,
870 "-r", "reviewer@chromium.org"] 902 "-r", "reviewer@chromium.org"]
871 ChromiumRoll(TEST_CONFIG, self).Run(args) 903 ChromiumRoll(TEST_CONFIG, self).Run(args)
872 904
873 deps = FileToText(TEST_CONFIG[DEPS_FILE]) 905 deps = FileToText(os.path.join(chrome_dir, "DEPS"))
874 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) 906 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))
875 907
876 def testCheckLastPushRecently(self): 908 def testCheckLastPushRecently(self):
877 self.Expect([ 909 self.Expect([
878 Cmd(("git log -1 --format=%H --grep=" 910 Cmd(("git log -1 --format=%H --grep="
879 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 911 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
880 "svn/trunk"), "hash2\n"), 912 "svn/trunk"), "hash2\n"),
881 Cmd("git log -1 --format=%s hash2", 913 Cmd("git log -1 --format=%s hash2",
882 "Version 3.4.5 (based on bleeding_edge revision r99)\n"), 914 "Version 3.4.5 (based on bleeding_edge revision r99)\n"),
883 ]) 915 ])
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 def testAutoRollExistingRoll(self): 980 def testAutoRollExistingRoll(self):
949 self.Expect([ 981 self.Expect([
950 URL("https://codereview.chromium.org/search", 982 URL("https://codereview.chromium.org/search",
951 "owner=author%40chromium.org&limit=30&closed=3&format=json", 983 "owner=author%40chromium.org&limit=30&closed=3&format=json",
952 ("{\"results\": [{\"subject\": \"different\"}," 984 ("{\"results\": [{\"subject\": \"different\"},"
953 "{\"subject\": \"Update V8 to Version...\"}]}")), 985 "{\"subject\": \"Update V8 to Version...\"}]}")),
954 ]) 986 ])
955 987
956 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 988 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
957 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) 989 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
958 self.assertEquals(1, result) 990 self.assertEquals(0, result)
959 991
960 # Snippet from the original DEPS file. 992 # Snippet from the original DEPS file.
961 FAKE_DEPS = """ 993 FAKE_DEPS = """
962 vars = { 994 vars = {
963 "v8_revision": "abcd123455", 995 "v8_revision": "abcd123455",
964 } 996 }
965 deps = { 997 deps = {
966 "src/v8": 998 "src/v8":
967 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" + 999 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" +
968 Var("v8_revision"), 1000 Var("v8_revision"),
969 } 1001 }
970 """ 1002 """
971 1003
972 def testAutoRollUpToDate(self): 1004 def testAutoRollUpToDate(self):
973 os.makedirs(TEST_CONFIG[CHROMIUM]) 1005 TEST_CONFIG[CHROMIUM] = self.MakeEmptyTempDirectory()
974 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG[CHROMIUM], "DEPS")) 1006 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG[CHROMIUM], "DEPS"))
975 self.Expect([ 1007 self.Expect([
976 URL("https://codereview.chromium.org/search", 1008 URL("https://codereview.chromium.org/search",
977 "owner=author%40chromium.org&limit=30&closed=3&format=json", 1009 "owner=author%40chromium.org&limit=30&closed=3&format=json",
978 ("{\"results\": [{\"subject\": \"different\"}]}")), 1010 ("{\"results\": [{\"subject\": \"different\"}]}")),
979 Cmd(("git log -1 --format=%H --grep=" 1011 Cmd(("git log -1 --format=%H --grep="
980 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 1012 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
981 "origin/master"), "push_hash\n"), 1013 "origin/master"), "push_hash\n"),
982 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG), 1014 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
983 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG), 1015 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG),
984 ]) 1016 ])
985 1017
986 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 1018 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
987 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) 1019 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
988 self.assertEquals(1, result) 1020 self.assertEquals(0, result)
989 1021
990 def testAutoRoll(self): 1022 def testAutoRoll(self):
991 os.makedirs(TEST_CONFIG[CHROMIUM]) 1023 TEST_CONFIG[CHROMIUM] = self.MakeEmptyTempDirectory()
992 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG[CHROMIUM], "DEPS")) 1024 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG[CHROMIUM], "DEPS"))
993 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile() 1025 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile()
994 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE]) 1026 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE])
995 1027
996 self.Expect([ 1028 self.Expect([
997 URL("https://codereview.chromium.org/search", 1029 URL("https://codereview.chromium.org/search",
998 "owner=author%40chromium.org&limit=30&closed=3&format=json", 1030 "owner=author%40chromium.org&limit=30&closed=3&format=json",
999 ("{\"results\": [{\"subject\": \"different\"}]}")), 1031 ("{\"results\": [{\"subject\": \"different\"}]}")),
1000 Cmd(("git log -1 --format=%H --grep=" 1032 Cmd(("git log -1 --format=%H --grep="
1001 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 1033 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1219
1188 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b 1220 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
1189 1221
1190 """ 1222 """
1191 json_output = self.MakeEmptyTempFile() 1223 json_output = self.MakeEmptyTempFile()
1192 csv_output = self.MakeEmptyTempFile() 1224 csv_output = self.MakeEmptyTempFile()
1193 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 1225 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
1194 self.WriteFakeVersionFile() 1226 self.WriteFakeVersionFile()
1195 1227
1196 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 1228 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
1197 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 1229 TEST_CONFIG[CHROMIUM] = self.MakeEmptyTempDirectory()
1198 os.makedirs(TEST_CONFIG[CHROMIUM]) 1230 chrome_dir = TEST_CONFIG[CHROMIUM]
1199 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): 1231 chrome_v8_dir = os.path.join(chrome_dir, "v8")
1200 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) 1232 os.makedirs(chrome_v8_dir)
1201 def WriteDEPS(revision): 1233 def WriteDEPS(revision):
1202 TextToFile("Line\n \"v8_revision\": \"%s\",\n line\n" % revision, 1234 TextToFile("Line\n \"v8_revision\": \"%s\",\n line\n" % revision,
1203 TEST_CONFIG[DEPS_FILE]) 1235 os.path.join(chrome_dir, "DEPS"))
1204 WriteDEPS(567) 1236 WriteDEPS(567)
1205 1237
1206 def ResetVersion(minor, build, patch=0): 1238 def ResetVersion(minor, build, patch=0):
1207 return lambda: self.WriteFakeVersionFile(minor=minor, 1239 return lambda: self.WriteFakeVersionFile(minor=minor,
1208 build=build, 1240 build=build,
1209 patch=patch) 1241 patch=patch)
1210 1242
1211 def ResetDEPS(revision): 1243 def ResetDEPS(revision):
1212 return lambda: WriteDEPS(revision) 1244 return lambda: WriteDEPS(revision)
1213 1245
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 cb=ResetVersion(22, 5)), 1287 cb=ResetVersion(22, 5)),
1256 Cmd("git reset --hard svn/bleeding_edge", ""), 1288 Cmd("git reset --hard svn/bleeding_edge", ""),
1257 Cmd("svn log https://v8.googlecode.com/svn/tags -v --limit 20", 1289 Cmd("svn log https://v8.googlecode.com/svn/tags -v --limit 20",
1258 tag_response_text), 1290 tag_response_text),
1259 Cmd("git svn find-rev r22626", "hash_22626"), 1291 Cmd("git svn find-rev r22626", "hash_22626"),
1260 Cmd("git svn find-rev hash_22626", "22626"), 1292 Cmd("git svn find-rev hash_22626", "22626"),
1261 Cmd("git log -1 --format=%ci hash_22626", "01:23"), 1293 Cmd("git log -1 --format=%ci hash_22626", "01:23"),
1262 Cmd("git svn find-rev r22624", "hash_22624"), 1294 Cmd("git svn find-rev r22624", "hash_22624"),
1263 Cmd("git svn find-rev hash_22624", "22624"), 1295 Cmd("git svn find-rev hash_22624", "22624"),
1264 Cmd("git log -1 --format=%ci hash_22624", "02:34"), 1296 Cmd("git log -1 --format=%ci hash_22624", "02:34"),
1265 Cmd("git status -s -uno", ""), 1297 Cmd("git status -s -uno", "", cwd=chrome_dir),
1266 Cmd("git checkout -f master", ""), 1298 Cmd("git checkout -f master", "", cwd=chrome_dir),
1267 Cmd("git pull", ""), 1299 Cmd("git pull", "", cwd=chrome_dir),
1268 Cmd("git checkout -b %s" % TEST_CONFIG[BRANCHNAME], ""), 1300 Cmd("git checkout -b %s" % TEST_CONFIG[BRANCHNAME], "", cwd=chrome_dir),
1269 Cmd("git fetch origin", ""), 1301 Cmd("git fetch origin", "", cwd=chrome_v8_dir),
1270 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"), 1302 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n",
1271 Cmd("git diff --name-only c_hash1 c_hash1^", ""), 1303 cwd=chrome_dir),
1272 Cmd("git diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]), 1304 Cmd("git diff --name-only c_hash1 c_hash1^", "", cwd=chrome_dir),
1273 Cmd("git checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1305 Cmd("git diff --name-only c_hash2 c_hash2^", "DEPS", cwd=chrome_dir),
1274 cb=ResetDEPS("0123456789012345678901234567890123456789")), 1306 Cmd("git checkout -f c_hash2 -- DEPS", "",
1275 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log), 1307 cb=ResetDEPS("0123456789012345678901234567890123456789"),
1308 cwd=chrome_dir),
1309 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log,
1310 cwd=chrome_dir),
1276 Cmd("git rev-list -n 1 0123456789012345678901234567890123456789", 1311 Cmd("git rev-list -n 1 0123456789012345678901234567890123456789",
1277 "0123456789012345678901234567890123456789"), 1312 "0123456789012345678901234567890123456789", cwd=chrome_v8_dir),
1278 Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789", 1313 Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789",
1279 self.C_V8_22624_LOG), 1314 self.C_V8_22624_LOG, cwd=chrome_v8_dir),
1280 Cmd("git diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]), 1315 Cmd("git diff --name-only c_hash3 c_hash3^", "DEPS", cwd=chrome_dir),
1281 Cmd("git checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1316 Cmd("git checkout -f c_hash3 -- DEPS", "", cb=ResetDEPS(345),
1282 cb=ResetDEPS(345)), 1317 cwd=chrome_dir),
1283 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log), 1318 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log,
1284 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", 1319 cwd=chrome_dir),
1285 cb=ResetDEPS(567)), 1320 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS(567),
1286 Cmd("git branch -r", " weird/123\n branch-heads/7\n"), 1321 cwd=chrome_dir),
1287 Cmd("git checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1322 Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir),
1288 cb=ResetDEPS(345)), 1323 Cmd("git checkout -f branch-heads/7 -- DEPS", "", cb=ResetDEPS(345),
1289 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", 1324 cwd=chrome_dir),
1290 cb=ResetDEPS(567)), 1325 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS(567),
1291 Cmd("git checkout -f master", ""), 1326 cwd=chrome_dir),
1292 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), 1327 Cmd("git checkout -f master", "", cwd=chrome_dir),
1328 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], "", cwd=chrome_dir),
1293 Cmd("git checkout -f some_branch", ""), 1329 Cmd("git checkout -f some_branch", ""),
1294 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), 1330 Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
1295 ]) 1331 ])
1296 1332
1297 args = ["-c", TEST_CONFIG[CHROMIUM], 1333 args = ["-c", TEST_CONFIG[CHROMIUM],
1298 "--json", json_output, 1334 "--json", json_output,
1299 "--csv", csv_output, 1335 "--csv", csv_output,
1300 "--max-releases", "1"] 1336 "--max-releases", "1"]
1301 Releases(TEST_CONFIG, self).Run(args) 1337 Releases(TEST_CONFIG, self).Run(args)
1302 1338
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 # Test that we bail out if the last change was a version change. 1468 # Test that we bail out if the last change was a version change.
1433 def testBumpUpVersionBailout1(self): 1469 def testBumpUpVersionBailout1(self):
1434 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 1470 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
1435 self._state["latest"] = "latest_hash" 1471 self._state["latest"] = "latest_hash"
1436 1472
1437 self.Expect([ 1473 self.Expect([
1438 Cmd("git diff --name-only latest_hash latest_hash^", 1474 Cmd("git diff --name-only latest_hash latest_hash^",
1439 TEST_CONFIG[VERSION_FILE]), 1475 TEST_CONFIG[VERSION_FILE]),
1440 ]) 1476 ])
1441 1477
1442 self.assertEquals(1, 1478 self.assertEquals(0,
1443 self.RunStep(BumpUpVersion, LastChangeBailout, ["--dry_run"])) 1479 self.RunStep(BumpUpVersion, LastChangeBailout, ["--dry_run"]))
1444 1480
1445 # Test that we bail out if the lkgr was a version change. 1481 # Test that we bail out if the lkgr was a version change.
1446 def testBumpUpVersionBailout2(self): 1482 def testBumpUpVersionBailout2(self):
1447 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 1483 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
1448 self._state["lkgr"] = "lkgr_hash" 1484 self._state["lkgr"] = "lkgr_hash"
1449 1485
1450 self.Expect([ 1486 self.Expect([
1451 Cmd("git diff --name-only lkgr_hash lkgr_hash^", 1487 Cmd("git diff --name-only lkgr_hash lkgr_hash^",
1452 TEST_CONFIG[VERSION_FILE]), 1488 TEST_CONFIG[VERSION_FILE]),
1453 ]) 1489 ])
1454 1490
1455 self.assertEquals(1, 1491 self.assertEquals(0,
1456 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) 1492 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"]))
1457 1493
1458 # Test that we bail out if the last version is already newer than the lkgr's 1494 # Test that we bail out if the last version is already newer than the lkgr's
1459 # version. 1495 # version.
1460 def testBumpUpVersionBailout3(self): 1496 def testBumpUpVersionBailout3(self):
1461 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 1497 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
1462 self._state["lkgr"] = "lkgr_hash" 1498 self._state["lkgr"] = "lkgr_hash"
1463 self._state["lkgr_version"] = "3.22.4.0" 1499 self._state["lkgr_version"] = "3.22.4.0"
1464 self._state["latest_version"] = "3.22.5.0" 1500 self._state["latest_version"] = "3.22.5.0"
1465 1501
1466 self.Expect([ 1502 self.Expect([
1467 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), 1503 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""),
1468 ]) 1504 ])
1469 1505
1470 self.assertEquals(1, 1506 self.assertEquals(0,
1471 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) 1507 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"]))
1472 1508
1473 1509
1474 class SystemTest(unittest.TestCase): 1510 class SystemTest(unittest.TestCase):
1475 def testReload(self): 1511 def testReload(self):
1476 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, 1512 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
1477 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) 1513 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER)
1478 body = step.Reload( 1514 body = step.Reload(
1479 """------------------------------------------------------------------------ 1515 """------------------------------------------------------------------------
1480 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines 1516 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines
1481 1517
1482 Prepare push to trunk. Now working on version 3.23.11. 1518 Prepare push to trunk. Now working on version 3.23.11.
1483 1519
1484 R=danno@chromium.org 1520 R=danno@chromium.org
1485 1521
1486 Review URL: https://codereview.chromium.org/83173002 1522 Review URL: https://codereview.chromium.org/83173002
1487 1523
1488 ------------------------------------------------------------------------""") 1524 ------------------------------------------------------------------------""")
1489 self.assertEquals( 1525 self.assertEquals(
1490 """Prepare push to trunk. Now working on version 3.23.11. 1526 """Prepare push to trunk. Now working on version 3.23.11.
1491 1527
1492 R=danno@chromium.org 1528 R=danno@chromium.org
1493 1529
1494 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1530 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698