| OLD | NEW |
| 1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
| 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze
ged |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 import unittest | 30 import unittest |
| 31 | 31 |
| 32 from webkitpy.common.host_mock import MockHost | 32 from webkitpy.common.host_mock import MockHost |
| 33 from webkitpy.common.system.systemhost_mock import MockSystemHost | 33 from webkitpy.common.system.systemhost_mock import MockSystemHost |
| 34 from webkitpy.layout_tests import run_webkit_tests | 34 from webkitpy.layout_tests import run_webkit_tests |
| 35 from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunne
r, Sharder, TestRunInterruptedException | 35 from webkitpy.layout_tests.controllers.layout_test_runner import DriverHandler,
LayoutTestRunner, Sharder, TestRunInterruptedException |
| 36 from webkitpy.layout_tests.models import test_expectations | 36 from webkitpy.layout_tests.models import test_expectations |
| 37 from webkitpy.layout_tests.models import test_failures | 37 from webkitpy.layout_tests.models import test_failures |
| 38 from webkitpy.layout_tests.models.test_run_results import TestRunResults | 38 from webkitpy.layout_tests.models.test_run_results import TestRunResults |
| 39 from webkitpy.layout_tests.models.test_input import TestInput | 39 from webkitpy.layout_tests.models.test_input import TestInput |
| 40 from webkitpy.layout_tests.models.test_results import TestResult | 40 from webkitpy.layout_tests.models.test_results import TestResult |
| 41 from webkitpy.layout_tests.port.test import TestPort | 41 from webkitpy.layout_tests.port.test import TestPort |
| 42 | 42 |
| 43 | 43 |
| 44 TestExpectations = test_expectations.TestExpectations | 44 TestExpectations = test_expectations.TestExpectations |
| 45 | 45 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 self.assertEqual(1, run_results.expected) | 149 self.assertEqual(1, run_results.expected) |
| 150 self.assertEqual(0, run_results.unexpected) | 150 self.assertEqual(0, run_results.unexpected) |
| 151 | 151 |
| 152 run_results = TestRunResults(expectations, 1) | 152 run_results = TestRunResults(expectations, 1) |
| 153 result = TestResult(test_name=test, failures=[], reftest_type=['==']) | 153 result = TestResult(test_name=test, failures=[], reftest_type=['==']) |
| 154 runner._update_summary_with_result(run_results, result) | 154 runner._update_summary_with_result(run_results, result) |
| 155 self.assertEqual(0, run_results.expected) | 155 self.assertEqual(0, run_results.expected) |
| 156 self.assertEqual(1, run_results.unexpected) | 156 self.assertEqual(1, run_results.unexpected) |
| 157 | 157 |
| 158 | 158 |
| 159 class DriverHandlerTests(unittest.TestCase): |
| 160 def _create_driver_handler(self): |
| 161 port = TestPort(MockSystemHost()) |
| 162 return DriverHandler("test_driver", 1, "test_worker", port) |
| 163 |
| 164 def test_init(self): |
| 165 self.assertFalse(self._create_driver_handler().driver) |
| 166 |
| 167 def test_prepare(self): |
| 168 driver_handler = self._create_driver_handler() |
| 169 driver_handler.prepare() |
| 170 self.assertTrue(driver_handler.driver) |
| 171 |
| 172 def test_is_prepared(self): |
| 173 driver_handler = self._create_driver_handler() |
| 174 self.assertFalse(driver_handler.is_prepared()) |
| 175 driver_handler.prepare() |
| 176 self.assertTrue(driver_handler.is_prepared()) |
| 177 driver_handler.kill() |
| 178 self.assertFalse(driver_handler.is_prepared()) |
| 179 |
| 180 def test_kill(self): |
| 181 driver_handler = self._create_driver_handler() |
| 182 driver_handler.kill() |
| 183 self.assertFalse(driver_handler.driver) |
| 184 driver_handler.prepare() |
| 185 driver_handler.kill() |
| 186 self.assertFalse(driver_handler.driver) |
| 187 |
| 188 |
| 159 class SharderTests(unittest.TestCase): | 189 class SharderTests(unittest.TestCase): |
| 160 | 190 |
| 161 test_list = [ | 191 test_list = [ |
| 162 "http/tests/websocket/tests/unicode.htm", | 192 "http/tests/websocket/tests/unicode.htm", |
| 163 "animations/keyframes.html", | 193 "animations/keyframes.html", |
| 164 "http/tests/security/view-source-no-refresh.html", | 194 "http/tests/security/view-source-no-refresh.html", |
| 165 "http/tests/websocket/tests/websocket-protocol-ignored.html", | 195 "http/tests/websocket/tests/websocket-protocol-ignored.html", |
| 166 "fast/css/display-none-inline-style-change-crash.html", | 196 "fast/css/display-none-inline-style-change-crash.html", |
| 167 "http/tests/xmlhttprequest/supported-xml-content-types.html", | 197 "http/tests/xmlhttprequest/supported-xml-content-types.html", |
| 168 "dom/html/level2/html/HTMLAnchorElement03.html", | 198 "dom/html/level2/html/HTMLAnchorElement03.html", |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 test_list=['virtual/foo/bar1.html', 'virtual/foo/bar2.html']) | 316 test_list=['virtual/foo/bar1.html', 'virtual/foo/bar2.html']) |
| 287 self.assert_shards(unlocked, | 317 self.assert_shards(unlocked, |
| 288 [('virtual/foo', ['virtual/foo/bar1.html', 'virtual/foo/bar2.html'])
]) | 318 [('virtual/foo', ['virtual/foo/bar1.html', 'virtual/foo/bar2.html'])
]) |
| 289 | 319 |
| 290 # But, with run_singly=True, we have to restart every time anyway, so we
want full parallelism. | 320 # But, with run_singly=True, we have to restart every time anyway, so we
want full parallelism. |
| 291 locked, unlocked = self.get_shards(num_workers=2, fully_parallel=True, m
ax_locked_shards=2, run_singly=True, | 321 locked, unlocked = self.get_shards(num_workers=2, fully_parallel=True, m
ax_locked_shards=2, run_singly=True, |
| 292 test_list=['virtual/foo/bar1.html', 'virtual/foo/bar2.html']) | 322 test_list=['virtual/foo/bar1.html', 'virtual/foo/bar2.html']) |
| 293 self.assert_shards(unlocked, | 323 self.assert_shards(unlocked, |
| 294 [('.', ['virtual/foo/bar1.html']), | 324 [('.', ['virtual/foo/bar1.html']), |
| 295 ('.', ['virtual/foo/bar2.html'])]) | 325 ('.', ['virtual/foo/bar2.html'])]) |
| OLD | NEW |