| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 self.assertEquals(" Line 1\n Line 3\n", | 64 self.assertEquals(" Line 1\n Line 3\n", |
| 65 StripComments(" Line 1\n# Line 2\n Line 3\n#\n")) | 65 StripComments(" Line 1\n# Line 2\n Line 3\n#\n")) |
| 66 self.assertEquals("\nLine 2 ### Test\n #", | 66 self.assertEquals("\nLine 2 ### Test\n #", |
| 67 StripComments("###\n# \n\n# Line 1\nLine 2 ### Test\n #")) | 67 StripComments("###\n# \n\n# Line 1\nLine 2 ### Test\n #")) |
| 68 | 68 |
| 69 def testMakeChangeLogBodySimple(self): | 69 def testMakeChangeLogBodySimple(self): |
| 70 commits = [ | 70 commits = [ |
| 71 ["Title text 1", | 71 ["Title text 1", |
| 72 "Title text 1\n\nBUG=\n", | 72 "Title text 1\n\nBUG=\n", |
| 73 "author1@chromium.org"], | 73 "author1@chromium.org"], |
| 74 ["Title text 2", | 74 ["Title text 2.", |
| 75 "Title text 2\n\nBUG=1234\n", | 75 "Title text 2\n\nBUG=1234\n", |
| 76 "author2@chromium.org"], | 76 "author2@chromium.org"], |
| 77 ] | 77 ] |
| 78 self.assertEquals(" Title text 1\n" | 78 self.assertEquals(" Title text 1.\n" |
| 79 " (author1@chromium.org)\n\n" | 79 " (author1@chromium.org)\n\n" |
| 80 " Title text 2\n" | 80 " Title text 2 (Chromium issue 1234).\n" |
| 81 " (Chromium issue 1234)\n" | |
| 82 " (author2@chromium.org)\n\n", | 81 " (author2@chromium.org)\n\n", |
| 83 MakeChangeLogBody(commits)) | 82 MakeChangeLogBody(commits)) |
| 84 | 83 |
| 85 def testMakeChangeLogBodyEmpty(self): | 84 def testMakeChangeLogBodyEmpty(self): |
| 86 self.assertEquals("", MakeChangeLogBody([])) | 85 self.assertEquals("", MakeChangeLogBody([])) |
| 87 | 86 |
| 88 def testMakeChangeLogBodyAutoFormat(self): | 87 def testMakeChangeLogBodyAutoFormat(self): |
| 89 commits = [ | 88 commits = [ |
| 90 ["Title text 1", | 89 ["Title text 1!", |
| 91 "Title text 1\nLOG=y\nBUG=\n", | 90 "Title text 1\nLOG=y\nBUG=\n", |
| 92 "author1@chromium.org"], | 91 "author1@chromium.org"], |
| 93 ["Title text 2", | 92 ["Title text 2", |
| 94 "Title text 2\n\nBUG=1234\n", | 93 "Title text 2\n\nBUG=1234\n", |
| 95 "author2@chromium.org"], | 94 "author2@chromium.org"], |
| 96 ["Title text 3", | 95 ["Title text 3", |
| 97 "Title text 3\n\nBUG=1234\nLOG = Yes\n", | 96 "Title text 3\n\nBUG=1234\nLOG = Yes\n", |
| 98 "author3@chromium.org"], | 97 "author3@chromium.org"], |
| 99 ["Title text 3", | 98 ["Title text 3", |
| 100 "Title text 4\n\nBUG=1234\nLOG=\n", | 99 "Title text 4\n\nBUG=1234\nLOG=\n", |
| 101 "author4@chromium.org"], | 100 "author4@chromium.org"], |
| 102 ] | 101 ] |
| 103 self.assertEquals(" Title text 1\n\n" | 102 self.assertEquals(" Title text 1.\n\n" |
| 104 " Title text 3\n" | 103 " Title text 3 (Chromium issue 1234).\n\n", |
| 105 " (Chromium issue 1234)\n\n", | |
| 106 MakeChangeLogBody(commits, True)) | 104 MakeChangeLogBody(commits, True)) |
| 107 | 105 |
| 108 def testMakeChangeLogBugReferenceEmpty(self): | 106 def testMakeChangeLogBugReferenceEmpty(self): |
| 109 self.assertEquals("", MakeChangeLogBugReference("")) | 107 self.assertEquals("", MakeChangeLogBugReference("")) |
| 110 self.assertEquals("", MakeChangeLogBugReference("LOG=")) | 108 self.assertEquals("", MakeChangeLogBugReference("LOG=")) |
| 111 self.assertEquals("", MakeChangeLogBugReference(" BUG =")) | 109 self.assertEquals("", MakeChangeLogBugReference(" BUG =")) |
| 112 self.assertEquals("", MakeChangeLogBugReference("BUG=none\t")) | 110 self.assertEquals("", MakeChangeLogBugReference("BUG=none\t")) |
| 113 | 111 |
| 114 def testMakeChangeLogBugReferenceSimple(self): | 112 def testMakeChangeLogBugReferenceSimple(self): |
| 115 self.assertEquals(" (issue 987654)\n", | 113 self.assertEquals("(issue 987654)", |
| 116 MakeChangeLogBugReference("BUG = v8:987654")) | 114 MakeChangeLogBugReference("BUG = v8:987654")) |
| 117 self.assertEquals(" (Chromium issue 987654)\n", | 115 self.assertEquals("(Chromium issue 987654)", |
| 118 MakeChangeLogBugReference("BUG=987654 ")) | 116 MakeChangeLogBugReference("BUG=987654 ")) |
| 119 | 117 |
| 120 def testMakeChangeLogBugReferenceFromBody(self): | 118 def testMakeChangeLogBugReferenceFromBody(self): |
| 121 self.assertEquals(" (Chromium issue 1234567)\n", | 119 self.assertEquals("(Chromium issue 1234567)", |
| 122 MakeChangeLogBugReference("Title\n\nTBR=\nBUG=\n" | 120 MakeChangeLogBugReference("Title\n\nTBR=\nBUG=\n" |
| 123 " BUG=\tchromium:1234567\t\n" | 121 " BUG=\tchromium:1234567\t\n" |
| 124 "R=somebody\n")) | 122 "R=somebody\n")) |
| 125 | 123 |
| 126 def testMakeChangeLogBugReferenceMultiple(self): | 124 def testMakeChangeLogBugReferenceMultiple(self): |
| 127 # All issues should be sorted and grouped. Multiple references to the same | 125 # All issues should be sorted and grouped. Multiple references to the same |
| 128 # issue should be filtered. | 126 # issue should be filtered. |
| 129 self.assertEquals(" (issues 123, 234, Chromium issue 345)\n", | 127 self.assertEquals("(issues 123, 234, Chromium issue 345)", |
| 130 MakeChangeLogBugReference("Title\n\n" | 128 MakeChangeLogBugReference("Title\n\n" |
| 131 "BUG=v8:234\n" | 129 "BUG=v8:234\n" |
| 132 " BUG\t= 345, \tv8:234,\n" | 130 " BUG\t= 345, \tv8:234,\n" |
| 133 "BUG=v8:123\n" | 131 "BUG=v8:123\n" |
| 134 "R=somebody\n")) | 132 "R=somebody\n")) |
| 135 self.assertEquals(" (Chromium issues 123, 234)\n", | 133 self.assertEquals("(Chromium issues 123, 234)", |
| 136 MakeChangeLogBugReference("Title\n\n" | 134 MakeChangeLogBugReference("Title\n\n" |
| 137 "BUG=234,,chromium:123 \n" | 135 "BUG=234,,chromium:123 \n" |
| 138 "R=somebody\n")) | 136 "R=somebody\n")) |
| 139 self.assertEquals(" (Chromium issues 123, 234)\n", | 137 self.assertEquals("(Chromium issues 123, 234)", |
| 140 MakeChangeLogBugReference("Title\n\n" | 138 MakeChangeLogBugReference("Title\n\n" |
| 141 "BUG=chromium:234, , 123\n" | 139 "BUG=chromium:234, , 123\n" |
| 142 "R=somebody\n")) | 140 "R=somebody\n")) |
| 143 self.assertEquals(" (issues 345, 456)\n", | 141 self.assertEquals("(issues 345, 456)", |
| 144 MakeChangeLogBugReference("Title\n\n" | 142 MakeChangeLogBugReference("Title\n\n" |
| 145 "\t\tBUG=v8:345,v8:456\n" | 143 "\t\tBUG=v8:345,v8:456\n" |
| 146 "R=somebody\n")) | 144 "R=somebody\n")) |
| 147 self.assertEquals(" (issue 123, Chromium issues 345, 456)\n", | 145 self.assertEquals("(issue 123, Chromium issues 345, 456)", |
| 148 MakeChangeLogBugReference("Title\n\n" | 146 MakeChangeLogBugReference("Title\n\n" |
| 149 "BUG=chromium:456\n" | 147 "BUG=chromium:456\n" |
| 150 "BUG = none\n" | 148 "BUG = none\n" |
| 151 "R=somebody\n" | 149 "R=somebody\n" |
| 152 "BUG=456,v8:123, 345")) | 150 "BUG=456,v8:123, 345")) |
| 153 | 151 |
| 152 # TODO(machenbach): These test don't make much sense when the formatting is |
| 153 # done later. |
| 154 def testMakeChangeLogBugReferenceLong(self): | 154 def testMakeChangeLogBugReferenceLong(self): |
| 155 # -----------------00--------10--------20--------30-------- | 155 # -----------------00--------10--------20--------30-------- |
| 156 self.assertEquals(" (issues 234, 1234567890, 1234567" | 156 self.assertEquals("(issues 234, 1234567890, 1234567" |
| 157 "8901234567890, Chromium issues 12345678,\n" | 157 "8901234567890, Chromium issues 12345678," |
| 158 " 123456789)\n", | 158 " 123456789)", |
| 159 MakeChangeLogBugReference("BUG=v8:234\n" | 159 MakeChangeLogBugReference("BUG=v8:234\n" |
| 160 "BUG=v8:1234567890\n" | 160 "BUG=v8:1234567890\n" |
| 161 "BUG=v8:12345678901234567890\n" | 161 "BUG=v8:12345678901234567890\n" |
| 162 "BUG=123456789\n" | 162 "BUG=123456789\n" |
| 163 "BUG=12345678\n")) | 163 "BUG=12345678\n")) |
| 164 # -----------------00--------10--------20--------30-------- | 164 # -----------------00--------10--------20--------30-------- |
| 165 self.assertEquals(" (issues 234, 1234567890, 1234567" | 165 self.assertEquals("(issues 234, 1234567890, 1234567" |
| 166 "8901234567890, Chromium issues\n" | 166 "8901234567890, Chromium issues" |
| 167 " 123456789, 1234567890)\n", | 167 " 123456789, 1234567890)", |
| 168 MakeChangeLogBugReference("BUG=v8:234\n" | 168 MakeChangeLogBugReference("BUG=v8:234\n" |
| 169 "BUG=v8:12345678901234567890\n" | 169 "BUG=v8:12345678901234567890\n" |
| 170 "BUG=v8:1234567890\n" | 170 "BUG=v8:1234567890\n" |
| 171 "BUG=123456789\n" | 171 "BUG=123456789\n" |
| 172 "BUG=1234567890\n")) | 172 "BUG=1234567890\n")) |
| 173 # -----------------00--------10--------20--------30-------- | 173 # -----------------00--------10--------20--------30-------- |
| 174 self.assertEquals(" (Chromium issues 234, 1234567890" | 174 self.assertEquals("(Chromium issues 234, 1234567890" |
| 175 ", 12345678901234567,\n" | 175 ", 12345678901234567, " |
| 176 " 1234567890123456789)\n", | 176 "1234567890123456789)", |
| 177 MakeChangeLogBugReference("BUG=234\n" | 177 MakeChangeLogBugReference("BUG=234\n" |
| 178 "BUG=12345678901234567\n" | 178 "BUG=12345678901234567\n" |
| 179 "BUG=1234567890123456789\n" | 179 "BUG=1234567890123456789\n" |
| 180 "BUG=1234567890\n")) | 180 "BUG=1234567890\n")) |
| 181 | 181 |
| 182 | 182 |
| 183 class SimpleMock(object): | 183 class SimpleMock(object): |
| 184 def __init__(self, name): | 184 def __init__(self, name): |
| 185 self._name = name | 185 self._name = name |
| 186 self._recipe = [] | 186 self._recipe = [] |
| 187 self._index = -1 | 187 self._index = -1 |
| 188 | 188 |
| 189 def Expect(self, recipe): | 189 def Expect(self, recipe): |
| 190 self._recipe = recipe | 190 self._recipe = recipe |
| 191 | 191 |
| 192 def Call(self, *args): | 192 def Call(self, *args): |
| 193 self._index += 1 | 193 self._index += 1 |
| 194 try: | 194 try: |
| 195 expected_call = self._recipe[self._index] | 195 expected_call = self._recipe[self._index] |
| 196 except IndexError: | 196 except IndexError: |
| 197 raise Exception("Calling %s %s" % (name, " ".join(args))) | 197 raise Exception("Calling %s %s" % (self._name, " ".join(args))) |
| 198 | 198 |
| 199 # Pack expectations without arguments into a list. | 199 # Pack expectations without arguments into a list. |
| 200 if not isinstance(expected_call, list): | 200 if not isinstance(expected_call, list): |
| 201 expected_call = [expected_call] | 201 expected_call = [expected_call] |
| 202 | 202 |
| 203 # The number of arguments in the expectation must match the actual | 203 # The number of arguments in the expectation must match the actual |
| 204 # arguments. | 204 # arguments. |
| 205 if len(args) > len(expected_call): | 205 if len(args) > len(expected_call): |
| 206 raise Exception("When calling %s with arguments, the expectations " | 206 raise Exception("When calling %s with arguments, the expectations " |
| 207 "must consist of at least as many arguments.") | 207 "must consist of at least as many arguments.") |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 self.assertEqual("//\n#define BUILD_NUMBER 3\n", | 390 self.assertEqual("//\n#define BUILD_NUMBER 3\n", |
| 391 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", | 391 MSub(r"(?<=#define BUILD_NUMBER)(?P<space>\s+)\d*$", |
| 392 r"\g<space>3", | 392 r"\g<space>3", |
| 393 "//\n#define BUILD_NUMBER 321\n")) | 393 "//\n#define BUILD_NUMBER 321\n")) |
| 394 | 394 |
| 395 def testPrepareChangeLog(self): | 395 def testPrepareChangeLog(self): |
| 396 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 396 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 397 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 397 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 398 | 398 |
| 399 self.ExpectGit([ | 399 self.ExpectGit([ |
| 400 ["log 1234..HEAD --format=%H", "rev1\nrev2\nrev3"], | 400 ["log 1234..HEAD --format=%H", "rev1\nrev2\nrev3\nrev4"], |
| 401 ["log -1 rev1 --format=\"%s\"", "Title text 1"], | 401 ["log -1 rev1 --format=\"%s\"", "Title text 1"], |
| 402 ["log -1 rev1 --format=\"%B\"", "Title\n\nBUG=\nLOG=y\n"], | 402 ["log -1 rev1 --format=\"%B\"", "Title\n\nBUG=\nLOG=y\n"], |
| 403 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org"], | 403 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org"], |
| 404 ["log -1 rev2 --format=\"%s\"", "Title text 2"], | 404 ["log -1 rev2 --format=\"%s\"", "Title text 2."], |
| 405 ["log -1 rev2 --format=\"%B\"", "Title\n\nBUG=123\nLOG= \n"], | 405 ["log -1 rev2 --format=\"%B\"", "Title\n\nBUG=123\nLOG= \n"], |
| 406 ["log -1 rev2 --format=\"%an\"", "author2@chromium.org"], | 406 ["log -1 rev2 --format=\"%an\"", "author2@chromium.org"], |
| 407 ["log -1 rev3 --format=\"%s\"", "Title text 3"], | 407 ["log -1 rev3 --format=\"%s\"", "Title text 3"], |
| 408 ["log -1 rev3 --format=\"%B\"", "Title\n\nBUG=321\nLOG=true\n"], | 408 ["log -1 rev3 --format=\"%B\"", "Title\n\nBUG=321\nLOG=true\n"], |
| 409 ["log -1 rev3 --format=\"%an\"", "author3@chromium.org"], | 409 ["log -1 rev3 --format=\"%an\"", "author3@chromium.org"], |
| 410 ["log -1 rev4 --format=\"%s\"", "Title text 4"], |
| 411 ["log -1 rev4 --format=\"%B\"", |
| 412 ("Title\n\nBUG=456\nLOG=Y\n\n" |
| 413 "Review URL: https://codereview.chromium.org/9876543210\n")], |
| 414 ["log -1 rev4 --format=\"%an\"", "author4@chromium.org"], |
| 415 ]) |
| 416 |
| 417 # The cl for rev4 on rietveld has an updated LOG flag. |
| 418 self.ExpectReadURL([ |
| 419 ["https://codereview.chromium.org/9876543210/description", |
| 420 "Title\n\nBUG=456\nLOG=N\n\n"], |
| 410 ]) | 421 ]) |
| 411 | 422 |
| 412 self.MakeStep().Persist("last_push", "1234") | 423 self.MakeStep().Persist("last_push", "1234") |
| 413 self.MakeStep(PrepareChangeLog).Run() | 424 self.MakeStep(PrepareChangeLog).Run() |
| 414 | 425 |
| 415 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 426 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
| 416 | 427 |
| 417 # TODO(machenbach): Mock out call to date() in order to make a fixed | 428 # TODO(machenbach): Mock out call to date() in order to make a fixed |
| 418 # comparison here instead of a regexp match. | 429 # comparison here instead of a regexp match. |
| 419 expected_cl = """\\d+\\-\\d+\\-\\d+: Version 3\\.22\\.5 | 430 expected_cl = """\\d+\\-\\d+\\-\\d+: Version 3\\.22\\.5 |
| 420 | 431 |
| 421 Title text 1 | 432 Title text 1. |
| 422 | 433 |
| 423 Title text 3 | 434 Title text 3 \\(Chromium issue 321\\). |
| 424 \\(Chromium issue 321\\) | |
| 425 | 435 |
| 426 Performance and stability improvements on all platforms\\. | 436 Performance and stability improvements on all platforms\\. |
| 427 # | 437 # |
| 428 # The change log above is auto-generated\\. Please review if all relevant | 438 # The change log above is auto-generated\\. Please review if all relevant |
| 429 # commit messages from the list below are included\\. | 439 # commit messages from the list below are included\\. |
| 430 # All lines starting with # will be stripped\\. | 440 # All lines starting with # will be stripped\\. |
| 431 # | 441 # |
| 432 # Title text 1 | 442 # Title text 1. |
| 433 # \\(author1@chromium\\.org\\) | 443 # \\(author1@chromium\\.org\\) |
| 434 # | 444 # |
| 435 # Title text 2 | 445 # Title text 2 \\(Chromium issue 123\\). |
| 436 # \\(Chromium issue 123\\) | |
| 437 # \\(author2@chromium\\.org\\) | 446 # \\(author2@chromium\\.org\\) |
| 438 # | 447 # |
| 439 # Title text 3 | 448 # Title text 3 \\(Chromium issue 321\\). |
| 440 # \\(Chromium issue 321\\) | |
| 441 # \\(author3@chromium\\.org\\) | 449 # \\(author3@chromium\\.org\\) |
| 442 # | 450 # |
| 451 # Title text 4 \\(Chromium issue 456\\). |
| 452 # \\(author4@chromium\\.org\\) |
| 453 # |
| 443 #""" | 454 #""" |
| 444 | 455 |
| 445 self.assertTrue(re.match(expected_cl, actual_cl)) | 456 self.assertTrue(re.match(expected_cl, actual_cl)) |
| 446 self.assertEquals("3", self.MakeStep().Restore("major")) | 457 self.assertEquals("3", self.MakeStep().Restore("major")) |
| 447 self.assertEquals("22", self.MakeStep().Restore("minor")) | 458 self.assertEquals("22", self.MakeStep().Restore("minor")) |
| 448 self.assertEquals("5", self.MakeStep().Restore("build")) | 459 self.assertEquals("5", self.MakeStep().Restore("build")) |
| 449 self.assertEquals("0", self.MakeStep().Restore("patch")) | 460 self.assertEquals("0", self.MakeStep().Restore("patch")) |
| 450 | 461 |
| 451 def testEditChangeLog(self): | 462 def testEditChangeLog(self): |
| 452 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 463 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() |
| 453 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 464 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() |
| 454 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) | 465 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) |
| 455 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) | 466 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) |
| 456 os.environ["EDITOR"] = "vi" | 467 os.environ["EDITOR"] = "vi" |
| 457 | 468 |
| 458 self.ExpectReadline([ | 469 self.ExpectReadline([ |
| 459 "", # Open editor. | 470 "", # Open editor. |
| 460 ]) | 471 ]) |
| 461 | 472 |
| 462 self.MakeStep(EditChangeLog).Run() | 473 self.MakeStep(EditChangeLog).Run() |
| 463 | 474 |
| 464 self.assertEquals(" New\n Lines\n\n\n Original CL", | 475 self.assertEquals("New\n Lines\n\n\n Original CL", |
| 465 FileToText(TEST_CONFIG[CHANGELOG_FILE])) | 476 FileToText(TEST_CONFIG[CHANGELOG_FILE])) |
| 466 | 477 |
| 467 def testIncrementVersion(self): | 478 def testIncrementVersion(self): |
| 468 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 479 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 469 self.MakeStep().Persist("build", "5") | 480 self.MakeStep().Persist("build", "5") |
| 470 | 481 |
| 471 self.ExpectReadline([ | 482 self.ExpectReadline([ |
| 472 "Y", # Increment build number. | 483 "Y", # Increment build number. |
| 473 ]) | 484 ]) |
| 474 | 485 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 543 if not os.path.exists(TEST_CONFIG[CHROMIUM]): |
| 533 os.makedirs(TEST_CONFIG[CHROMIUM]) | 544 os.makedirs(TEST_CONFIG[CHROMIUM]) |
| 534 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) | 545 TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE]) |
| 535 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 546 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
| 536 TEST_CONFIG[DEPS_FILE]) | 547 TEST_CONFIG[DEPS_FILE]) |
| 537 os.environ["EDITOR"] = "vi" | 548 os.environ["EDITOR"] = "vi" |
| 538 | 549 |
| 539 def CheckPreparePush(): | 550 def CheckPreparePush(): |
| 540 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 551 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 541 self.assertTrue(re.search(r"Version 3.22.5", cl)) | 552 self.assertTrue(re.search(r"Version 3.22.5", cl)) |
| 542 self.assertTrue(re.search(r" Log text 1", cl)) | 553 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| 543 self.assertTrue(re.search(r" \(issue 321\)", cl)) | |
| 544 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) | 554 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) |
| 545 | 555 |
| 546 # Make sure all comments got stripped. | 556 # Make sure all comments got stripped. |
| 547 self.assertFalse(re.search(r"^#", cl, flags=re.M)) | 557 self.assertFalse(re.search(r"^#", cl, flags=re.M)) |
| 548 | 558 |
| 549 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 559 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 550 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) | 560 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 551 | 561 |
| 552 def CheckUpload(): | 562 def CheckUpload(): |
| 553 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 563 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 554 | 564 |
| 555 def CheckSVNCommit(): | 565 def CheckSVNCommit(): |
| 556 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) | 566 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) |
| 557 self.assertTrue(re.search(r"Version 3.22.5", commit)) | 567 self.assertTrue(re.search(r"Version 3.22.5", commit)) |
| 558 self.assertTrue(re.search(r"Log text 1. \(issue 321\)", commit)) | 568 self.assertTrue(re.search(r"Log text 1 \(issue 321\).", commit)) |
| 559 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 569 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
| 560 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 570 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
| 561 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 571 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
| 562 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) | 572 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| 563 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) | 573 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) |
| 564 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 574 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
| 565 | 575 |
| 566 force_flag = " -f" if force else "" | 576 force_flag = " -f" if force else "" |
| 567 self.ExpectGit([ | 577 self.ExpectGit([ |
| 568 ["status -s -uno", ""], | 578 ["status -s -uno", ""], |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 options.l = None | 646 options.l = None |
| 637 options.f = force | 647 options.f = force |
| 638 options.r = "reviewer@chromium.org" if force else None | 648 options.r = "reviewer@chromium.org" if force else None |
| 639 options.c = TEST_CONFIG[CHROMIUM] | 649 options.c = TEST_CONFIG[CHROMIUM] |
| 640 RunPushToTrunk(TEST_CONFIG, options, self) | 650 RunPushToTrunk(TEST_CONFIG, options, self) |
| 641 | 651 |
| 642 deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 652 deps = FileToText(TEST_CONFIG[DEPS_FILE]) |
| 643 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 653 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |
| 644 | 654 |
| 645 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 655 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 646 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 656 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
| 647 self.assertTrue(re.search(r" Log text 1", cl)) | 657 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| 648 self.assertTrue(re.search(r" \(issue 321\)", cl)) | |
| 649 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 658 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
| 650 | 659 |
| 651 # Note: The version file is on build number 5 again in the end of this test | 660 # Note: The version file is on build number 5 again in the end of this test |
| 652 # since the git command that merges to the bleeding edge branch is mocked | 661 # since the git command that merges to the bleeding edge branch is mocked |
| 653 # out. | 662 # out. |
| 654 | 663 |
| 655 def testPushToTrunk(self): | 664 def testPushToTrunk(self): |
| 656 self._PushToTrunk() | 665 self._PushToTrunk() |
| 657 | 666 |
| 658 def testPushToTrunkForced(self): | 667 def testPushToTrunkForced(self): |
| (...skipping 20 matching lines...) Expand all Loading... |
| 679 class Options( object ): | 688 class Options( object ): |
| 680 pass | 689 pass |
| 681 | 690 |
| 682 options = Options() | 691 options = Options() |
| 683 options.s = 0 | 692 options.s = 0 |
| 684 | 693 |
| 685 auto_roll.RunAutoRoll(TEST_CONFIG, options, self) | 694 auto_roll.RunAutoRoll(TEST_CONFIG, options, self) |
| 686 | 695 |
| 687 self.assertEquals("100", self.MakeStep().Restore("lkgr")) | 696 self.assertEquals("100", self.MakeStep().Restore("lkgr")) |
| 688 self.assertEquals("101", self.MakeStep().Restore("latest")) | 697 self.assertEquals("101", self.MakeStep().Restore("latest")) |
| 698 |
| 699 |
| 700 class SystemTest(unittest.TestCase): |
| 701 def testReload(self): |
| 702 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, |
| 703 options=None, |
| 704 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) |
| 705 body = step.Reload( |
| 706 """------------------------------------------------------------------------ |
| 707 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines |
| 708 |
| 709 Prepare push to trunk. Now working on version 3.23.11. |
| 710 |
| 711 R=danno@chromium.org |
| 712 |
| 713 Review URL: https://codereview.chromium.org/83173002 |
| 714 |
| 715 ------------------------------------------------------------------------""") |
| 716 self.assertEquals( |
| 717 """Prepare push to trunk. Now working on version 3.23.11. |
| 718 |
| 719 R=danno@chromium.org |
| 720 |
| 721 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |