| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 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 disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 import base64 | 29 import base64 |
| 30 import time | 30 import time |
| 31 | 31 |
| 32 from webkitpy.common.system.crash_logs import CrashLogs | 32 from webkitpy.common.system.crash_logs import CrashLogs |
| 33 from webkitpy.layout_tests.models import test_run_results | 33 from webkitpy.layout_tests.models import test_run_results |
| 34 from webkitpy.layout_tests.models.test_configuration import TestConfiguration | 34 from webkitpy.layout_tests.models.test_configuration import TestConfiguration |
| 35 from webkitpy.layout_tests.port.base import Port, VirtualTestSuite | 35 from webkitpy.layout_tests.port.base import Port, VirtualTestSuite |
| 36 from webkitpy.layout_tests.port.driver import DeviceFailure, Driver, DriverOutpu
t | 36 from webkitpy.layout_tests.port.driver import DeviceFailure, Driver, DriverOutpu
t |
| 37 | 37 |
| 38 | 38 |
| 39 # Here we use a non-standard location for the layout tests, to ensure that |
| 40 # this works. The path contains a '.' in the name because we've seen bugs |
| 41 # related to this before. |
| 42 LAYOUT_TEST_DIR = '/test.checkout/LayoutTests' |
| 43 PERF_TEST_DIR = '/test.checkout/PerformanceTests' |
| 44 |
| 45 |
| 39 # This sets basic expectations for a test. Each individual expectation | 46 # This sets basic expectations for a test. Each individual expectation |
| 40 # can be overridden by a keyword argument in TestList.add(). | 47 # can be overridden by a keyword argument in TestList.add(). |
| 41 class TestInstance(object): | 48 class TestInstance(object): |
| 42 | 49 |
| 43 def __init__(self, name): | 50 def __init__(self, name): |
| 44 self.name = name | 51 self.name = name |
| 45 self.base = name[(name.rfind("/") + 1):name.rfind(".")] | 52 self.base = name[(name.rfind("/") + 1):name.rfind(".")] |
| 46 self.crash = False | 53 self.crash = False |
| 47 self.web_process_crash = False | 54 self.web_process_crash = False |
| 48 self.exception = False | 55 self.exception = False |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-
png') | 259 expected_image='image_not_in_pixeldir-pngtEXtchecksum\x00checksum-
png') |
| 253 | 260 |
| 254 # For testing that virtual test suites don't expand names containing themsel
ves | 261 # For testing that virtual test suites don't expand names containing themsel
ves |
| 255 # See webkit.org/b/97925 and base_unittest.PortTest.test_tests(). | 262 # See webkit.org/b/97925 and base_unittest.PortTest.test_tests(). |
| 256 tests.add('passes/test-virtual-passes.html') | 263 tests.add('passes/test-virtual-passes.html') |
| 257 tests.add('passes/virtual_passes/test-virtual-passes.html') | 264 tests.add('passes/virtual_passes/test-virtual-passes.html') |
| 258 | 265 |
| 259 return tests | 266 return tests |
| 260 | 267 |
| 261 | 268 |
| 262 # Here we use a non-standard location for the layout tests, to ensure that | |
| 263 # this works. The path contains a '.' in the name because we've seen bugs | |
| 264 # related to this before. | |
| 265 | |
| 266 LAYOUT_TEST_DIR = '/test.checkout/LayoutTests' | |
| 267 PERF_TEST_DIR = '/test.checkout/PerformanceTests' | |
| 268 | |
| 269 | |
| 270 # Here we synthesize an in-memory filesystem from the test list | 269 # Here we synthesize an in-memory filesystem from the test list |
| 271 # in order to fully control the test output and to demonstrate that | 270 # in order to fully control the test output and to demonstrate that |
| 272 # we don't need a real filesystem to run the tests. | 271 # we don't need a real filesystem to run the tests. |
| 273 def add_unit_tests_to_mock_filesystem(filesystem): | 272 def add_unit_tests_to_mock_filesystem(filesystem): |
| 274 # Add the test_expectations file. | 273 # Add the test_expectations file. |
| 275 filesystem.maybe_make_directory('/mock-checkout/LayoutTests') | 274 filesystem.maybe_make_directory(LAYOUT_TEST_DIR + '') |
| 276 if not filesystem.exists('/mock-checkout/LayoutTests/TestExpectations'): | 275 if not filesystem.exists(LAYOUT_TEST_DIR + '/TestExpectations'): |
| 277 filesystem.write_text_file('/mock-checkout/LayoutTests/TestExpectations'
, """ | 276 filesystem.write_text_file(LAYOUT_TEST_DIR + '/TestExpectations', """ |
| 278 Bug(test) failures/expected/crash.html [ Crash ] | 277 Bug(test) failures/expected/crash.html [ Crash ] |
| 279 Bug(test) failures/expected/crash_then_text.html [ Failure ] | 278 Bug(test) failures/expected/crash_then_text.html [ Failure ] |
| 280 Bug(test) failures/expected/image.html [ Failure ] | 279 Bug(test) failures/expected/image.html [ Failure ] |
| 281 Bug(test) failures/expected/needsrebaseline.html [ NeedsRebaseline ] | 280 Bug(test) failures/expected/needsrebaseline.html [ NeedsRebaseline ] |
| 282 Bug(test) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ] | 281 Bug(test) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ] |
| 283 Bug(test) failures/expected/audio.html [ Failure ] | 282 Bug(test) failures/expected/audio.html [ Failure ] |
| 284 Bug(test) failures/expected/image_checksum.html [ Failure ] | 283 Bug(test) failures/expected/image_checksum.html [ Failure ] |
| 285 Bug(test) failures/expected/mismatch.html [ Failure ] | 284 Bug(test) failures/expected/mismatch.html [ Failure ] |
| 286 Bug(test) failures/expected/newlines_leading.html [ Failure ] | 285 Bug(test) failures/expected/newlines_leading.html [ Failure ] |
| 287 Bug(test) failures/expected/newlines_trailing.html [ Failure ] | 286 Bug(test) failures/expected/newlines_trailing.html [ Failure ] |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 372 |
| 374 # FIXME: crbug.com/279494. This needs to be in the "real layout tests | 373 # FIXME: crbug.com/279494. This needs to be in the "real layout tests |
| 375 # dir" in a mock filesystem, rather than outside of the checkout, so | 374 # dir" in a mock filesystem, rather than outside of the checkout, so |
| 376 # that tests that want to write to a TestExpectations file can share | 375 # that tests that want to write to a TestExpectations file can share |
| 377 # this between "test" ports and "real" ports. This is the result of | 376 # this between "test" ports and "real" ports. This is the result of |
| 378 # rebaseline_unittest.py having tests that refer to "real" port names | 377 # rebaseline_unittest.py having tests that refer to "real" port names |
| 379 # and real builders instead of fake builders that point back to the | 378 # and real builders instead of fake builders that point back to the |
| 380 # test ports. rebaseline_unittest.py needs to not mix both "real" ports | 379 # test ports. rebaseline_unittest.py needs to not mix both "real" ports |
| 381 # and "test" ports | 380 # and "test" ports |
| 382 | 381 |
| 383 self._generic_expectations_path = '/mock-checkout/LayoutTests/TestExpect
ations' | 382 self._generic_expectations_path = LAYOUT_TEST_DIR + '/TestExpectations' |
| 384 self._results_directory = None | 383 self._results_directory = None |
| 385 | 384 |
| 386 self._operating_system = 'mac' | 385 self._operating_system = 'mac' |
| 387 if self._name.startswith('test-win'): | 386 if self._name.startswith('test-win'): |
| 388 self._operating_system = 'win' | 387 self._operating_system = 'win' |
| 389 elif self._name.startswith('test-linux'): | 388 elif self._name.startswith('test-linux'): |
| 390 self._operating_system = 'linux' | 389 self._operating_system = 'linux' |
| 391 | 390 |
| 392 version_map = { | 391 version_map = { |
| 393 'test-win-win7': 'win7', | 392 'test-win-win7': 'win7', |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 else: | 623 else: |
| 625 image = test.actual_image | 624 image = test.actual_image |
| 626 return DriverOutput(actual_text, image, test.actual_checksum, audio, | 625 return DriverOutput(actual_text, image, test.actual_checksum, audio, |
| 627 crash=(crash or web_process_crash), crashed_process_
name=crashed_process_name, | 626 crash=(crash or web_process_crash), crashed_process_
name=crashed_process_name, |
| 628 crashed_pid=crashed_pid, crash_log=crash_log, | 627 crashed_pid=crashed_pid, crash_log=crash_log, |
| 629 test_time=time.time() - start_time, timeout=test.tim
eout, error=test.error, pid=self.pid, | 628 test_time=time.time() - start_time, timeout=test.tim
eout, error=test.error, pid=self.pid, |
| 630 leak=test.leak) | 629 leak=test.leak) |
| 631 | 630 |
| 632 def stop(self): | 631 def stop(self): |
| 633 self.started = False | 632 self.started = False |
| OLD | NEW |