| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 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 master.log_parser import gtest_command | 12 from master.log_parser import gtest_command |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 [----------] Global test environment tear-down | 175 [----------] Global test environment tear-down |
| 176 [==========] 5 tests from 1 test cases ran. (136 ms total) | 176 [==========] 5 tests from 1 test cases ran. (136 ms total) |
| 177 [ PASSED ] 5 tests. | 177 [ PASSED ] 5 tests. |
| 178 | 178 |
| 179 %(suppression)s | 179 %(suppression)s |
| 180 program finished with exit code 255 | 180 program finished with exit code 255 |
| 181 """ % {'suppression': VALGRIND_SUPPRESSION} | 181 """ % {'suppression': VALGRIND_SUPPRESSION} |
| 182 | 182 |
| 183 | 183 |
| 184 FAILING_TESTS_OUTPUT = """ |
| 185 Failing tests: |
| 186 ChromeRenderViewTest.FAILS_AllowDOMStorage |
| 187 PrerenderBrowserTest.PrerenderHTML5VideoJs |
| 188 """ |
| 189 |
| 190 FAILING_TESTS_EXPECTED = ['ChromeRenderViewTest.FAILS_AllowDOMStorage', |
| 191 'PrerenderBrowserTest.PrerenderHTML5VideoJs'] |
| 192 |
| 193 |
| 184 FAILURES_SHARD = ['12>NavigationControllerTest.Reload', | 194 FAILURES_SHARD = ['12>NavigationControllerTest.Reload', |
| 185 '12>NavigationControllerTest/SpdyNetworkTransTest.Constructor/
0', | 195 '12>NavigationControllerTest/SpdyNetworkTransTest.Constructor/
0', |
| 186 '0>BadTest.TimesOut', | 196 '0>BadTest.TimesOut', |
| 187 '12>MoreBadTest.TimesOutAndFails', | 197 '12>MoreBadTest.TimesOutAndFails', |
| 188 '0>SomeOtherTest.SwitchTypes'] | 198 '0>SomeOtherTest.SwitchTypes'] |
| 189 | 199 |
| 190 FAILS_FAILURES_SHARD = ['0>SomeOtherTest.FAILS_Bar'] | 200 FAILS_FAILURES_SHARD = ['0>SomeOtherTest.FAILS_Bar'] |
| 191 FLAKY_FAILURES_SHARD = ['0>SomeOtherTest.FLAKY_Baz'] | 201 FLAKY_FAILURES_SHARD = ['0>SomeOtherTest.FLAKY_Baz'] |
| 192 | 202 |
| 193 RELOAD_ERRORS_SHARD = r"""12>C:\b\slave\chrome-release-snappy\build\chrome\brows
er\navigation_controller_unittest.cc:381: Failure | 203 RELOAD_ERRORS_SHARD = r"""12>C:\b\slave\chrome-release-snappy\build\chrome\brows
er\navigation_controller_unittest.cc:381: Failure |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 for line in TEST_DATA_VALGRIND.splitlines(): | 481 for line in TEST_DATA_VALGRIND.splitlines(): |
| 472 observer.outLineReceived(line) | 482 observer.outLineReceived(line) |
| 473 | 483 |
| 474 self.assertEqual(0, len(observer.internal_error_lines)) | 484 self.assertEqual(0, len(observer.internal_error_lines)) |
| 475 self.assertFalse(observer.RunningTests()) | 485 self.assertFalse(observer.RunningTests()) |
| 476 self.assertFalse(observer.FailedTests()) | 486 self.assertFalse(observer.FailedTests()) |
| 477 self.assertEqual([VALGRIND_HASH], observer.SuppressionHashes()) | 487 self.assertEqual([VALGRIND_HASH], observer.SuppressionHashes()) |
| 478 self.assertEqual(VALGRIND_SUPPRESSION, | 488 self.assertEqual(VALGRIND_SUPPRESSION, |
| 479 '\n'.join(observer.Suppression(VALGRIND_HASH))) | 489 '\n'.join(observer.Suppression(VALGRIND_HASH))) |
| 480 | 490 |
| 491 observer = gtest_command.TestObserver() |
| 492 for line in FAILING_TESTS_OUTPUT.splitlines(): |
| 493 observer.outLineReceived(line) |
| 494 self.assertEqual(FAILING_TESTS_EXPECTED, |
| 495 observer.FailedTests(True, True)) |
| 496 |
| 497 def DISABLED_testLogLineObserverSharding(self): |
| 481 # Same tests for log parsing with sharding_supervisor. | 498 # Same tests for log parsing with sharding_supervisor. |
| 482 observer = gtest_command.TestObserver() | 499 observer = gtest_command.TestObserver() |
| 483 test_data_shard = self.AlternateShards( | 500 test_data_shard = self.AlternateShards( |
| 484 TEST_DATA_SHARD_0, TEST_DATA_SHARD_1) | 501 TEST_DATA_SHARD_0, TEST_DATA_SHARD_1) |
| 485 for line in test_data_shard: | 502 for line in test_data_shard: |
| 486 observer.outLineReceived(line) | 503 observer.outLineReceived(line) |
| 487 observer.outLineReceived(TEST_DATA_SHARD_EXIT + '2') | 504 observer.outLineReceived(TEST_DATA_SHARD_EXIT + '2') |
| 488 | 505 |
| 489 self.assertEqual(0, len(observer.internal_error_lines)) | 506 self.assertEqual(0, len(observer.internal_error_lines)) |
| 490 self.assertFalse(observer.RunningTests()) | 507 self.assertFalse(observer.RunningTests()) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 for line in test_data_shard: | 598 for line in test_data_shard: |
| 582 observer.outLineReceived(line) | 599 observer.outLineReceived(line) |
| 583 observer.outLineReceived(TEST_DATA_SHARD_EXIT + '1') | 600 observer.outLineReceived(TEST_DATA_SHARD_EXIT + '1') |
| 584 | 601 |
| 585 self.assertEqual(0, len(observer.internal_error_lines)) | 602 self.assertEqual(0, len(observer.internal_error_lines)) |
| 586 self.assertFalse(observer.RunningTests()) | 603 self.assertFalse(observer.RunningTests()) |
| 587 | 604 |
| 588 | 605 |
| 589 if __name__ == '__main__': | 606 if __name__ == '__main__': |
| 590 unittest.main() | 607 unittest.main() |
| OLD | NEW |