Reviewers: Jakob,
Message:
PTAL
Description:
Add more test coverage to push-to-trunk script.
Ensure that fetching commits works with huge change logs. The verbosity
option
will help debugging when dcommit hangs.
BUG=
Please review this at https://codereview.chromium.org/70143003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+34, -13 lines):
M tools/push-to-trunk/common_includes.py
M tools/push-to-trunk/push_to_trunk.py
M tools/push-to-trunk/test_scripts.py
Index: tools/push-to-trunk/common_includes.py
diff --git a/tools/push-to-trunk/common_includes.py
b/tools/push-to-trunk/common_includes.py
index
3b2eab01e1ecb3838be84cf3d563354318194eb2..06041a5e3f7eb70808c6433858a85cbf5d493dcb
100644
--- a/tools/push-to-trunk/common_includes.py
+++ b/tools/push-to-trunk/common_includes.py
@@ -67,6 +67,19 @@ def MSub(rexp, replacement, text):
return re.sub(rexp, replacement, text, flags=re.MULTILINE)
+def GetLastChangeLogEntries(change_log):
+ return Command("cat %s | awk --posix '{\
+ if ($0 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}:/) {\
+ if (in_firstblock == 1) {\
+ exit 0;\
+ } else {\
+ in_firstblock = 1;\
+ }\
+ };\
+ print $0;\
+ }'" % change_log)
+
+
# Some commands don't like the pipe, e.g. calling vi from within the
script or
# from subscripts like git cl upload.
def Command(cmd, args="", prefix="", pipe=True):
Index: tools/push-to-trunk/push_to_trunk.py
diff --git a/tools/push-to-trunk/push_to_trunk.py
b/tools/push-to-trunk/push_to_trunk.py
index
6ec03cbe031d2dcb1d40a7a851ea3270779f3afd..9f72cd2d6dafa4cbbfb404f2668a7591f205fb00
100755
--- a/tools/push-to-trunk/push_to_trunk.py
+++ b/tools/push-to-trunk/push_to_trunk.py
@@ -221,18 +221,10 @@ class CommitRepository(Step):
self.WaitForLGTM()
# Re-read the ChangeLog entry (to pick up possible changes).
# FIXME(machenbach): This was hanging once with a broken pipe.
- TextToFile(Command("cat %s | awk --posix '{\
- if ($0 ~ /^[0-9]{4}-[0-9]{2}-[0-9]{2}:/) {\
- if (in_firstblock == 1) {\
- exit 0;\
- } else {\
- in_firstblock = 1;\
- }\
- };\
- print $0;\
- }'" % self.Config(CHANGELOG_FILE)),
self.Config(CHANGELOG_ENTRY_FILE))
-
- if self.Git("cl dcommit", "PRESUBMIT_TREE_CHECK=\"skip\"") is None:
+ TextToFile(GetLastChangeLogEntries(self.Config(CHANGELOG_FILE)),
+ self.Config(CHANGELOG_ENTRY_FILE))
+
+ if self.Git("cl dcommit -v", "PRESUBMIT_TREE_CHECK=\"skip\"") is None:
self.Die("'git cl dcommit' failed, please try again.")
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py
b/tools/push-to-trunk/test_scripts.py
index
9865adaabb3ad78262ea7f93f04230ef543bfc61..0975b0d65a95413e36d0179e4c260be24306b6a8
100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -287,6 +287,22 @@ class ScriptTest(unittest.TestCase):
self.assertEquals("6", self.MakeStep().Restore("new_build"))
self.assertEquals("0", self.MakeStep().Restore("new_patch"))
+ def testLastChangeLogEntries(self):
+ TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
+ l = """
+ Fixed something.
+ (issue 1234)\n"""
+ for _ in xrange(10): l = l + l
+
+ cl_chunk = """2013-11-12: Version 3.23.2\n%s
+ Performance and stability improvements on all
platforms.\n\n\n""" % l
+
+ cl_chunk_full = cl_chunk + cl_chunk + cl_chunk
+ TextToFile(cl_chunk_full, TEST_CONFIG[CHANGELOG_FILE])
+
+ cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE])
+ self.assertEquals(cl_chunk, cl)
+
def testSquashCommits(self):
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f:
@@ -368,7 +384,7 @@ class ScriptTest(unittest.TestCase):
" 2 files changed\n",
CheckPreparePush],
["cl upload -r \"[email protected]\" --send-mail", "done\n"],
- ["cl dcommit", "Closing issue\n"],
+ ["cl dcommit -v", "Closing issue\n"],
["svn fetch", "fetch result\n"],
["checkout svn/bleeding_edge", ""],
[("log -1 --format=%H --grep=\"Prepare push to trunk. "
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.