| 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 22 matching lines...) Expand all Loading... |
| 33 import logging | 33 import logging |
| 34 import os | 34 import os |
| 35 import socket | 35 import socket |
| 36 import sys | 36 import sys |
| 37 import time | 37 import time |
| 38 import unittest | 38 import unittest |
| 39 | 39 |
| 40 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 | 40 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 |
| 41 from webkitpy.common.system.filesystem_mock import MockFileSystem | 41 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 42 from webkitpy.common.system.outputcapture import OutputCapture | 42 from webkitpy.common.system.outputcapture import OutputCapture |
| 43 from webkitpy.common.system.platforminfo_mock import MockPlatformInfo |
| 43 from webkitpy.common.system.systemhost import SystemHost | 44 from webkitpy.common.system.systemhost import SystemHost |
| 44 from webkitpy.common.system.systemhost_mock import MockSystemHost | 45 from webkitpy.common.system.systemhost_mock import MockSystemHost |
| 45 from webkitpy.layout_tests.models import test_run_results | 46 from webkitpy.layout_tests.models import test_run_results |
| 46 from webkitpy.layout_tests.port.base import Port, TestConfiguration | 47 from webkitpy.layout_tests.port.base import Port, TestConfiguration |
| 47 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess | 48 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess |
| 48 from webkitpy.tool.mocktool import MockOptions | 49 from webkitpy.tool.mocktool import MockOptions |
| 49 | 50 |
| 50 | 51 |
| 51 # FIXME: get rid of this fixture | 52 # FIXME: get rid of this fixture |
| 52 class TestWebKitPort(Port): | 53 class TestWebKitPort(Port): |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 000000000124f670 s __ZZN7WebCore13ff_mp3_decoder13addChildBelowEPS0_S1_E19__PRET
TY_FUNCTION__ | 412 000000000124f670 s __ZZN7WebCore13ff_mp3_decoder13addChildBelowEPS0_S1_E19__PRET
TY_FUNCTION__ |
| 412 """ | 413 """ |
| 413 # Note 'compositing' is not in the list of skipped directories (hence th
e parsing of GraphicsLayer worked): | 414 # Note 'compositing' is not in the list of skipped directories (hence th
e parsing of GraphicsLayer worked): |
| 414 expected_directories = set([ | 415 expected_directories = set([ |
| 415 "webaudio/codec-tests/aac", | 416 "webaudio/codec-tests/aac", |
| 416 ]) | 417 ]) |
| 417 result_directories = set(TestWebKitPort(symbols_string=symbols_string)._
skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.
html'])) | 418 result_directories = set(TestWebKitPort(symbols_string=symbols_string)._
skipped_tests_for_unsupported_features(test_list=['webaudio/codec-tests/mp3/foo.
html'])) |
| 418 self.assertEqual(result_directories, expected_directories) | 419 self.assertEqual(result_directories, expected_directories) |
| 419 | 420 |
| 420 def _assert_config_file_for_platform(self, port, platform, config_file): | 421 def _assert_config_file_for_platform(self, port, platform, config_file): |
| 421 self.assertEqual(port._apache_config_file_name_for_platform(platform), c
onfig_file) | 422 port.host.platform = MockPlatformInfo(os_name=platform) |
| 423 self.assertEqual(port._apache_config_file_name_for_platform(), config_fi
le) |
| 422 | 424 |
| 423 def test_linux_distro_detection(self): | 425 def _assert_config_file_for_linux_distribution(self, port, distribution, con
fig_file): |
| 424 port = TestWebKitPort() | 426 port.host.platform = MockPlatformInfo(os_name='linux', linux_distributio
n=distribution) |
| 425 self.assertFalse(port._is_redhat_based()) | 427 self.assertEqual(port._apache_config_file_name_for_platform(), config_fi
le) |
| 426 self.assertFalse(port._is_debian_based()) | |
| 427 | |
| 428 port._filesystem = MockFileSystem({'/etc/redhat-release': ''}) | |
| 429 self.assertTrue(port._is_redhat_based()) | |
| 430 self.assertFalse(port._is_debian_based()) | |
| 431 | |
| 432 port._filesystem = MockFileSystem({'/etc/debian_version': ''}) | |
| 433 self.assertFalse(port._is_redhat_based()) | |
| 434 self.assertTrue(port._is_debian_based()) | |
| 435 | 428 |
| 436 def test_apache_config_file_name_for_platform(self): | 429 def test_apache_config_file_name_for_platform(self): |
| 437 port = TestWebKitPort() | 430 port = TestWebKitPort() |
| 438 self._assert_config_file_for_platform(port, 'cygwin', 'cygwin-httpd.conf
') | 431 self._assert_config_file_for_platform(port, 'cygwin', 'cygwin-httpd.conf
') |
| 439 | 432 |
| 440 port._apache_version = lambda: '2.2' | 433 port._apache_version = lambda: '2.2' |
| 441 self._assert_config_file_for_platform(port, 'linux2', 'apache2-httpd-2.2
.conf') | 434 self._assert_config_file_for_platform(port, 'linux', 'apache2-httpd-2.2.
conf') |
| 442 self._assert_config_file_for_platform(port, 'linux3', 'apache2-httpd-2.2
.conf') | 435 self._assert_config_file_for_linux_distribution(port, 'arch', 'arch-http
d-2.2.conf') |
| 443 | 436 self._assert_config_file_for_linux_distribution(port, 'debian', 'debian-
httpd-2.2.conf') |
| 444 port._is_redhat_based = lambda: True | 437 self._assert_config_file_for_linux_distribution(port, 'slackware', 'apac
he2-httpd-2.2.conf') |
| 445 self._assert_config_file_for_platform(port, 'linux2', 'fedora-httpd-2.2.
conf') | 438 self._assert_config_file_for_linux_distribution(port, 'redhat', 'redhat-
httpd-2.2.conf') |
| 446 | |
| 447 port = TestWebKitPort() | |
| 448 port._is_debian_based = lambda: True | |
| 449 port._apache_version = lambda: '2.2' | |
| 450 self._assert_config_file_for_platform(port, 'linux2', 'debian-httpd-2.2.
conf') | |
| 451 | 439 |
| 452 self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd-2.2.co
nf') | 440 self._assert_config_file_for_platform(port, 'mac', 'apache2-httpd-2.2.co
nf') |
| 453 self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd-2.2.
conf') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports a
ll use cygwin. | 441 self._assert_config_file_for_platform(port, 'win32', 'apache2-httpd-2.2.
conf') # win32 isn't a supported sys.platform. AppleWin/WinCairo/WinCE ports a
ll use cygwin. |
| 454 self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd-2.2.c
onf') | 442 self._assert_config_file_for_platform(port, 'barf', 'apache2-httpd-2.2.c
onf') |
| 455 | 443 |
| 456 def test_path_to_apache_config_file(self): | 444 def test_path_to_apache_config_file(self): |
| 457 port = TestWebKitPort() | 445 port = TestWebKitPort() |
| 458 | 446 |
| 459 saved_environ = os.environ.copy() | 447 saved_environ = os.environ.copy() |
| 460 try: | 448 try: |
| 461 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' | 449 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/path/to/httpd.conf' |
| 462 self.assertRaises(IOError, port.path_to_apache_config_file) | 450 self.assertRaises(IOError, port.path_to_apache_config_file) |
| 463 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor
ld!') | 451 port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, wor
ld!') |
| 464 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 452 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 465 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') | 453 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') |
| 466 finally: | 454 finally: |
| 467 os.environ = saved_environ.copy() | 455 os.environ = saved_environ.copy() |
| 468 | 456 |
| 469 # Mock out _apache_config_file_name_for_platform to ignore the passed sy
s.platform value. | 457 # Mock out _apache_config_file_name_for_platform to avoid mocking platfo
rm info |
| 470 port._apache_config_file_name_for_platform = lambda platform: 'httpd.con
f' | 458 port._apache_config_file_name_for_platform = lambda: 'httpd.conf' |
| 471 self.assertEqual(port.path_to_apache_config_file(), '/mock-checkout/thir
d_party/WebKit/LayoutTests/http/conf/httpd.conf') | 459 self.assertEqual(port.path_to_apache_config_file(), '/mock-checkout/thir
d_party/WebKit/LayoutTests/http/conf/httpd.conf') |
| 472 | 460 |
| 473 # Check that even if we mock out _apache_config_file_name, the environme
nt variable takes precedence. | 461 # Check that even if we mock out _apache_config_file_name, the environme
nt variable takes precedence. |
| 474 saved_environ = os.environ.copy() | 462 saved_environ = os.environ.copy() |
| 475 try: | 463 try: |
| 476 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' | 464 os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' |
| 477 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') | 465 self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd
.conf') |
| 478 finally: | 466 finally: |
| 479 os.environ = saved_environ.copy() | 467 os.environ = saved_environ.copy() |
| 480 | 468 |
| 481 def test_additional_platform_directory(self): | 469 def test_additional_platform_directory(self): |
| 482 port = self.make_port(options=MockOptions(additional_platform_directory=
['/tmp/foo'])) | 470 port = self.make_port(options=MockOptions(additional_platform_directory=
['/tmp/foo'])) |
| 483 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') | 471 self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') |
| 484 | 472 |
| 485 def test_virtual_test_suites(self): | 473 def test_virtual_test_suites(self): |
| 486 # We test that we can load the real LayoutTests/VirtualTestSuites file p
roperly, so we | 474 # We test that we can load the real LayoutTests/VirtualTestSuites file p
roperly, so we |
| 487 # use a real SystemHost(). We don't care what virtual_test_suites() retu
rns as long | 475 # use a real SystemHost(). We don't care what virtual_test_suites() retu
rns as long |
| 488 # as it is iterable. | 476 # as it is iterable. |
| 489 port = self.make_port(host=SystemHost(), port_name=self.full_port_name) | 477 port = self.make_port(host=SystemHost(), port_name=self.full_port_name) |
| 490 self.assertTrue(isinstance(port.virtual_test_suites(), collections.Itera
ble)) | 478 self.assertTrue(isinstance(port.virtual_test_suites(), collections.Itera
ble)) |
| OLD | NEW |