Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for classes in gtest_command.py.""" | 6 """Unit tests for classes in gtest_command.py.""" |
| 7 | 7 |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 import test_env # pylint: disable=W0611 | 10 import test_env # pylint: disable=W0611 |
| 11 | 11 |
| 12 from common import gtest_utils | 12 from common import gtest_utils |
| 13 | 13 |
| 14 | 14 |
| 15 FAILURES = ['NavigationControllerTest.Reload', | 15 FAILURES = ['NavigationControllerTest.Reload', |
| 16 'NavigationControllerTest/SpdyNetworkTransTest.Constructor/0', | 16 'NavigationControllerTest/SpdyNetworkTransTest.Constructor/0', |
| 17 'BadTest.TimesOut', | 17 'BadTest.TimesOut', |
| 18 'MoreBadTest.TimesOutAndFails', | 18 'MoreBadTest.TimesOutAndFails', |
| 19 'SomeOtherTest.SwitchTypes'] | 19 'SomeOtherTest.SwitchTypes', |
| 20 'SomeOtherTest.FAILS_FooBar'] | |
|
M-A Ruel
2012/06/18 14:55:57
maybe renaming it to
SomeOtherTest.FAILS_ThisTest
csharp
2012/06/18 15:17:39
Done.
| |
| 20 | 21 |
| 21 FAILS_FAILURES = ['SomeOtherTest.FAILS_Bar'] | 22 FAILS_FAILURES = ['SomeOtherTest.FAILS_Bar'] |
| 22 FLAKY_FAILURES = ['SomeOtherTest.FLAKY_Baz'] | 23 FLAKY_FAILURES = ['SomeOtherTest.FLAKY_Baz'] |
| 23 | 24 |
| 24 TIMEOUT_MESSAGE = 'Killed (timed out).' | 25 TIMEOUT_MESSAGE = 'Killed (timed out).' |
| 25 | 26 |
| 26 RELOAD_ERRORS = ('C:\b\slave\chrome-release-snappy\build\chrome\browser' | 27 RELOAD_ERRORS = ('C:\b\slave\chrome-release-snappy\build\chrome\browser' |
| 27 '\navigation_controller_unittest.cc:381: Failure' + """ | 28 '\navigation_controller_unittest.cc:381: Failure' + """ |
| 28 Value of: -1 | 29 Value of: -1 |
| 29 Expected: contents->controller()->GetPendingEntryIndex() | 30 Expected: contents->controller()->GetPendingEntryIndex() |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 [ RUN ] MoreBadTest.TimesOutAndFails | 109 [ RUN ] MoreBadTest.TimesOutAndFails |
| 109 %(morebad_errors)s | 110 %(morebad_errors)s |
| 110 """ % {'morebad_errors': MOREBAD_ERRORS} + | 111 """ % {'morebad_errors': MOREBAD_ERRORS} + |
| 111 '[0531/042642:ERROR:/b/slave/chromium-rel-mac-builder/build/src/chrome/test' | 112 '[0531/042642:ERROR:/b/slave/chromium-rel-mac-builder/build/src/chrome/test' |
| 112 '/test_launcher/out_of_proc_test_runner.cc(79)] Test timeout (30000 ms) ' | 113 '/test_launcher/out_of_proc_test_runner.cc(79)] Test timeout (30000 ms) ' |
| 113 'exceeded for MoreBadTest.TimesOutAndFails' + """ | 114 'exceeded for MoreBadTest.TimesOutAndFails' + """ |
| 114 Handling SIGTERM. | 115 Handling SIGTERM. |
| 115 Successfully wrote to shutdown pipe, resetting signal handler. | 116 Successfully wrote to shutdown pipe, resetting signal handler. |
| 116 [ FAILED ] MoreBadTest.TimesOutAndFails (31000 ms) | 117 [ FAILED ] MoreBadTest.TimesOutAndFails (31000 ms) |
| 117 | 118 |
| 118 [----------] 4 tests from SomeOtherTest | 119 [----------] 5 tests from SomeOtherTest |
| 119 [ RUN ] SomeOtherTest.SwitchTypes | 120 [ RUN ] SomeOtherTest.SwitchTypes |
| 120 %(switch_errors)s | 121 %(switch_errors)s |
| 121 [ FAILED ] SomeOtherTest.SwitchTypes (40 ms) | 122 [ FAILED ] SomeOtherTest.SwitchTypes (40 ms) |
| 122 [ RUN ] SomeOtherTest.Foo | 123 [ RUN ] SomeOtherTest.Foo |
| 123 [ OK ] SomeOtherTest.Foo (20 ms) | 124 [ OK ] SomeOtherTest.Foo (20 ms) |
| 124 [ RUN ] SomeOtherTest.FAILS_Bar | 125 [ RUN ] SomeOtherTest.FAILS_Bar |
| 125 Some error message for a failing test. | 126 Some error message for a failing test. |
| 126 [ FAILED ] SomeOtherTest.FAILS_Bar (40 ms) | 127 [ FAILED ] SomeOtherTest.FAILS_Bar (40 ms) |
| 128 [ RUN ] SomeOtherTest.FAILS_FooBar | |
| 129 [0521/041343:ERROR:test_launcher.cc(384)] Test timeout (45000 ms) exceeded for S omeOtherTest.FAILS_FooBar | |
| 127 [ RUN ] SomeOtherTest.FLAKY_Baz | 130 [ RUN ] SomeOtherTest.FLAKY_Baz |
| 128 Some error message for a flaky test. | 131 Some error message for a flaky test. |
| 129 [ FAILED ] SomeOtherTest.FLAKY_Baz (40 ms) | 132 [ FAILED ] SomeOtherTest.FLAKY_Baz (40 ms) |
| 130 [----------] 2 tests from SomeOtherTest (60 ms total) | 133 [----------] 2 tests from SomeOtherTest (60 ms total) |
| 131 | 134 |
| 132 [----------] Global test environment tear-down | 135 [----------] Global test environment tear-down |
| 133 [==========] 7 tests from 3 test cases ran. (3750 ms total) | 136 [==========] 8 tests from 3 test cases ran. (3750 ms total) |
| 134 [ PASSED ] 4 tests. | 137 [ PASSED ] 4 tests. |
| 135 [ FAILED ] 3 tests, listed below: | 138 [ FAILED ] 4 tests, listed below: |
| 136 [ FAILED ] NavigationControllerTest.Reload | 139 [ FAILED ] NavigationControllerTest.Reload |
| 137 [ FAILED ] NavigationControllerTest/SpdyNetworkTransTest.Constructor/0 | 140 [ FAILED ] NavigationControllerTest/SpdyNetworkTransTest.Constructor/0 |
| 138 [ FAILED ] SomeOtherTest.SwitchTypes | 141 [ FAILED ] SomeOtherTest.SwitchTypes |
| 142 [ FAILED ] SomeOtherTest.FAILS_FooBar | |
| 139 | 143 |
| 140 1 FAILED TEST | 144 1 FAILED TEST |
| 141 YOU HAVE 10 DISABLED TESTS | 145 YOU HAVE 10 DISABLED TESTS |
| 142 | 146 |
| 143 YOU HAVE 2 FLAKY TESTS | 147 YOU HAVE 2 FLAKY TESTS |
| 144 | 148 |
| 145 program finished with exit code 1 | 149 program finished with exit code 1 |
| 146 """ % {'switch_errors' : SWITCH_ERRORS}) | 150 """ % {'switch_errors' : SWITCH_ERRORS}) |
| 147 | 151 |
| 148 TEST_DATA_CRASH = """ | 152 TEST_DATA_CRASH = """ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 | 229 |
| 226 [----------] 4 tests from SomeOtherTest | 230 [----------] 4 tests from SomeOtherTest |
| 227 [ RUN ] SomeOtherTest.SwitchTypes | 231 [ RUN ] SomeOtherTest.SwitchTypes |
| 228 %(switch_errors)s | 232 %(switch_errors)s |
| 229 [ FAILED ] SomeOtherTest.SwitchTypes (40 ms) | 233 [ FAILED ] SomeOtherTest.SwitchTypes (40 ms) |
| 230 [ RUN ] SomeOtherTest.Foo | 234 [ RUN ] SomeOtherTest.Foo |
| 231 [ OK ] SomeOtherTest.Foo (20 ms) | 235 [ OK ] SomeOtherTest.Foo (20 ms) |
| 232 [ RUN ] SomeOtherTest.FAILS_Bar | 236 [ RUN ] SomeOtherTest.FAILS_Bar |
| 233 Some error message for a failing test. | 237 Some error message for a failing test. |
| 234 [ FAILED ] SomeOtherTest.FAILS_Bar (40 ms) | 238 [ FAILED ] SomeOtherTest.FAILS_Bar (40 ms) |
| 239 [ RUN ] SomeOtherTest.FAILS_FooBar | |
| 240 [0521/041343:ERROR:test_launcher.cc(384)] Test timeout (45000 ms) exceeded for S omeOtherTest.FAILS_FooBar | |
| 235 [ RUN ] SomeOtherTest.FLAKY_Baz | 241 [ RUN ] SomeOtherTest.FLAKY_Baz |
| 236 Some error message for a flaky test. | 242 Some error message for a flaky test. |
| 237 [ FAILED ] SomeOtherTest.FLAKY_Baz (40 ms) | 243 [ FAILED ] SomeOtherTest.FLAKY_Baz (40 ms) |
| 238 [----------] 2 tests from SomeOtherTest (60 ms total) | 244 [----------] 2 tests from SomeOtherTest (60 ms total) |
| 239 | 245 |
| 240 [----------] Global test environment tear-down | 246 [----------] Global test environment tear-down |
| 241 [==========] 6 tests from 3 test cases ran. (3750 ms total) | 247 [==========] 7 tests from 3 test cases ran. (3750 ms total) |
| 242 [ PASSED ] 5 tests. | 248 [ PASSED ] 5 tests. |
| 243 [ FAILED ] 1 test, listed below: | 249 [ FAILED ] 2 test, listed below: |
| 244 [ FAILED ] SomeOtherTest.SwitchTypes | 250 [ FAILED ] SomeOtherTest.SwitchTypes |
| 251 [ FAILED ] SomeOtherTest.FAILS_FooBar | |
| 245 | 252 |
| 246 1 FAILED TEST | 253 1 FAILED TEST |
| 247 YOU HAVE 10 DISABLED TESTS | 254 YOU HAVE 10 DISABLED TESTS |
| 248 | 255 |
| 249 YOU HAVE 2 FLAKY TESTS | 256 YOU HAVE 2 FLAKY TESTS |
| 250 """ % {'switch_errors' : SWITCH_ERRORS}) | 257 """ % {'switch_errors' : SWITCH_ERRORS}) |
| 251 | 258 |
| 252 TEST_DATA_SHARD_1 = ("""Note: This is test shard 13 of 30. | 259 TEST_DATA_SHARD_1 = ("""Note: This is test shard 13 of 30. |
| 253 [==========] Running 5 tests from 2 test cases. | 260 [==========] Running 5 tests from 2 test cases. |
| 254 [----------] Global test environment set-up. | 261 [----------] Global test environment set-up. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 | 445 |
| 439 parser = gtest_utils.GTestLogParser() | 446 parser = gtest_utils.GTestLogParser() |
| 440 for line in FAILING_TESTS_OUTPUT.splitlines(): | 447 for line in FAILING_TESTS_OUTPUT.splitlines(): |
| 441 parser.ProcessLine(line) | 448 parser.ProcessLine(line) |
| 442 self.assertEqual(FAILING_TESTS_EXPECTED, | 449 self.assertEqual(FAILING_TESTS_EXPECTED, |
| 443 parser.FailedTests(True, True)) | 450 parser.FailedTests(True, True)) |
| 444 | 451 |
| 445 | 452 |
| 446 if __name__ == '__main__': | 453 if __name__ == '__main__': |
| 447 unittest.main() | 454 unittest.main() |
| OLD | NEW |