| 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 27 matching lines...) Expand all Loading... |
| 38 import json | 38 import json |
| 39 import logging | 39 import logging |
| 40 import optparse | 40 import optparse |
| 41 import re | 41 import re |
| 42 import sys | 42 import sys |
| 43 | 43 |
| 44 from webkitpy.common import find_files | 44 from webkitpy.common import find_files |
| 45 from webkitpy.common import read_checksum_from_png | 45 from webkitpy.common import read_checksum_from_png |
| 46 from webkitpy.common.memoized import memoized | 46 from webkitpy.common.memoized import memoized |
| 47 from webkitpy.common.system.executive import ScriptError | 47 from webkitpy.common.system.executive import ScriptError |
| 48 from webkitpy.common.system.path import cygpath, abspath_to_uri | 48 from webkitpy.common.system.path import abspath_to_uri |
| 49 from webkitpy.common.webkit_finder import WebKitFinder | 49 from webkitpy.common.webkit_finder import WebKitFinder |
| 50 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx
pectationsFactory | 50 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx
pectationsFactory |
| 51 from webkitpy.layout_tests.models import test_run_results | 51 from webkitpy.layout_tests.models import test_run_results |
| 52 from webkitpy.layout_tests.models.test_configuration import TestConfiguration | 52 from webkitpy.layout_tests.models.test_configuration import TestConfiguration |
| 53 from webkitpy.layout_tests.models.test_expectations import SKIP | 53 from webkitpy.layout_tests.models.test_expectations import SKIP |
| 54 from webkitpy.layout_tests.port import driver | 54 from webkitpy.layout_tests.port import driver |
| 55 from webkitpy.layout_tests.port import server_process | 55 from webkitpy.layout_tests.port import server_process |
| 56 from webkitpy.layout_tests.port.factory import PortFactory | 56 from webkitpy.layout_tests.port.factory import PortFactory |
| 57 from webkitpy.layout_tests.servers import apache_http | 57 from webkitpy.layout_tests.servers import apache_http |
| 58 from webkitpy.layout_tests.servers import pywebsocket | 58 from webkitpy.layout_tests.servers import pywebsocket |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 tempdir = self._filesystem.mkdtemp() | 432 tempdir = self._filesystem.mkdtemp() |
| 433 | 433 |
| 434 expected_filename = self._filesystem.join(str(tempdir), 'expected.png') | 434 expected_filename = self._filesystem.join(str(tempdir), 'expected.png') |
| 435 self._filesystem.write_binary_file(expected_filename, expected_contents) | 435 self._filesystem.write_binary_file(expected_filename, expected_contents) |
| 436 | 436 |
| 437 actual_filename = self._filesystem.join(str(tempdir), 'actual.png') | 437 actual_filename = self._filesystem.join(str(tempdir), 'actual.png') |
| 438 self._filesystem.write_binary_file(actual_filename, actual_contents) | 438 self._filesystem.write_binary_file(actual_filename, actual_contents) |
| 439 | 439 |
| 440 diff_filename = self._filesystem.join(str(tempdir), 'diff.png') | 440 diff_filename = self._filesystem.join(str(tempdir), 'diff.png') |
| 441 | 441 |
| 442 # image_diff needs native win paths as arguments, so we need to convert
them if running under cygwin. | |
| 443 native_expected_filename = self._convert_path(expected_filename) | |
| 444 native_actual_filename = self._convert_path(actual_filename) | |
| 445 native_diff_filename = self._convert_path(diff_filename) | |
| 446 | |
| 447 executable = self._path_to_image_diff() | 442 executable = self._path_to_image_diff() |
| 448 # Although we are handed 'old', 'new', image_diff wants 'new', 'old'. | 443 # Although we are handed 'old', 'new', image_diff wants 'new', 'old'. |
| 449 command = [executable, '--diff', native_actual_filename, native_expected
_filename, native_diff_filename] | 444 command = [executable, '--diff', actual_filename, expected_filename, dif
f_filename] |
| 450 | 445 |
| 451 result = None | 446 result = None |
| 452 err_str = None | 447 err_str = None |
| 453 try: | 448 try: |
| 454 exit_code = self._executive.run_command(command, return_exit_code=Tr
ue) | 449 exit_code = self._executive.run_command(command, return_exit_code=Tr
ue) |
| 455 if exit_code == 0: | 450 if exit_code == 0: |
| 456 # The images are the same. | 451 # The images are the same. |
| 457 result = None | 452 result = None |
| 458 elif exit_code == 1: | 453 elif exit_code == 1: |
| 459 result = self._filesystem.read_binary_file(native_diff_filename) | 454 result = self._filesystem.read_binary_file(diff_filename) |
| 460 else: | 455 else: |
| 461 err_str = 'Image diff returned an exit code of %s. See http://cr
bug.com/278596' % exit_code | 456 err_str = 'Image diff returned an exit code of %s. See http://cr
bug.com/278596' % exit_code |
| 462 except OSError as error: | 457 except OSError as error: |
| 463 err_str = 'error running image diff: %s' % error | 458 err_str = 'error running image diff: %s' % error |
| 464 finally: | 459 finally: |
| 465 self._filesystem.rmtree(str(tempdir)) | 460 self._filesystem.rmtree(str(tempdir)) |
| 466 | 461 |
| 467 return (result, err_str or None) | 462 return (result, err_str or None) |
| 468 | 463 |
| 469 def driver_name(self): | 464 def driver_name(self): |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 if self.host.platform.is_mac(): | 1080 if self.host.platform.is_mac(): |
| 1086 clean_env['DYLD_LIBRARY_PATH'] = self._build_path() | 1081 clean_env['DYLD_LIBRARY_PATH'] = self._build_path() |
| 1087 variables_to_copy += [ | 1082 variables_to_copy += [ |
| 1088 'HOME', | 1083 'HOME', |
| 1089 ] | 1084 ] |
| 1090 if self.host.platform.is_win(): | 1085 if self.host.platform.is_win(): |
| 1091 variables_to_copy += [ | 1086 variables_to_copy += [ |
| 1092 'PATH', | 1087 'PATH', |
| 1093 'GYP_DEFINES', # Required to locate win sdk. | 1088 'GYP_DEFINES', # Required to locate win sdk. |
| 1094 ] | 1089 ] |
| 1095 if self.host.platform.is_cygwin(): | |
| 1096 variables_to_copy += [ | |
| 1097 'HOMEDRIVE', | |
| 1098 'HOMEPATH', | |
| 1099 '_NT_SYMBOL_PATH', | |
| 1100 ] | |
| 1101 | 1090 |
| 1102 for variable in variables_to_copy: | 1091 for variable in variables_to_copy: |
| 1103 if variable in self.host.environ: | 1092 if variable in self.host.environ: |
| 1104 clean_env[variable] = self.host.environ[variable] | 1093 clean_env[variable] = self.host.environ[variable] |
| 1105 | 1094 |
| 1106 for string_variable in self.get_option('additional_env_var', []): | 1095 for string_variable in self.get_option('additional_env_var', []): |
| 1107 [name, value] = string_variable.split('=', 1) | 1096 [name, value] = string_variable.split('=', 1) |
| 1108 clean_env[name] = value | 1097 clean_env[name] = value |
| 1109 | 1098 |
| 1110 return clean_env | 1099 return clean_env |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 server.start() | 1157 server.start() |
| 1169 self._wpt_server = server | 1158 self._wpt_server = server |
| 1170 | 1159 |
| 1171 def stop_wptserve(self): | 1160 def stop_wptserve(self): |
| 1172 """Shuts down the WPT server if it is running.""" | 1161 """Shuts down the WPT server if it is running.""" |
| 1173 if self._wpt_server: | 1162 if self._wpt_server: |
| 1174 self._wpt_server.stop() | 1163 self._wpt_server.stop() |
| 1175 self._wpt_server = None | 1164 self._wpt_server = None |
| 1176 | 1165 |
| 1177 def http_server_supports_ipv6(self): | 1166 def http_server_supports_ipv6(self): |
| 1178 # Apache < 2.4 on win32 does not support IPv6, nor does cygwin apache. | 1167 # Apache < 2.4 on win32 does not support IPv6. |
| 1179 if self.host.platform.is_cygwin() or self.host.platform.is_win(): | 1168 return not self.host.platform.is_win() |
| 1180 return False | |
| 1181 return True | |
| 1182 | 1169 |
| 1183 def stop_http_server(self): | 1170 def stop_http_server(self): |
| 1184 """Shuts down the http server if it is running.""" | 1171 """Shuts down the http server if it is running.""" |
| 1185 if self._http_server: | 1172 if self._http_server: |
| 1186 self._http_server.stop() | 1173 self._http_server.stop() |
| 1187 self._http_server = None | 1174 self._http_server = None |
| 1188 | 1175 |
| 1189 def stop_websocket_server(self): | 1176 def stop_websocket_server(self): |
| 1190 """Shuts down the websocket server if it is running.""" | 1177 """Shuts down the websocket server if it is running.""" |
| 1191 if self._websocket_server: | 1178 if self._websocket_server: |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 return config_file_from_env | 1370 return config_file_from_env |
| 1384 | 1371 |
| 1385 config_file_name = self._apache_config_file_name_for_platform() | 1372 config_file_name = self._apache_config_file_name_for_platform() |
| 1386 return self._filesystem.join(self.apache_config_directory(), config_file
_name) | 1373 return self._filesystem.join(self.apache_config_directory(), config_file
_name) |
| 1387 | 1374 |
| 1388 def _apache_version(self): | 1375 def _apache_version(self): |
| 1389 config = self._executive.run_command([self.path_to_apache(), '-v']) | 1376 config = self._executive.run_command([self.path_to_apache(), '-v']) |
| 1390 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r'
\1', config) | 1377 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r'
\1', config) |
| 1391 | 1378 |
| 1392 def _apache_config_file_name_for_platform(self): | 1379 def _apache_config_file_name_for_platform(self): |
| 1393 if self.host.platform.is_cygwin(): | |
| 1394 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u
se Apache 1.3. | |
| 1395 if self.host.platform.is_linux(): | 1380 if self.host.platform.is_linux(): |
| 1396 distribution = self.host.platform.linux_distribution() | 1381 distribution = self.host.platform.linux_distribution() |
| 1397 | 1382 |
| 1398 custom_configuration_distributions = ['arch', 'debian', 'redhat'] | 1383 custom_configuration_distributions = ['arch', 'debian', 'redhat'] |
| 1399 if distribution in custom_configuration_distributions: | 1384 if distribution in custom_configuration_distributions: |
| 1400 return '%s-httpd-%s.conf' % (distribution, self._apache_version(
)) | 1385 return '%s-httpd-%s.conf' % (distribution, self._apache_version(
)) |
| 1401 | 1386 |
| 1402 return 'apache2-httpd-' + self._apache_version() + '.conf' | 1387 return 'apache2-httpd-' + self._apache_version() + '.conf' |
| 1403 | 1388 |
| 1404 def _path_to_driver(self, target=None): | 1389 def _path_to_driver(self, target=None): |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 return any(test_input.test_name.startswith(directory) for directory
in self._options.pixel_test_directories) | 1551 return any(test_input.test_name.startswith(directory) for directory
in self._options.pixel_test_directories) |
| 1567 # TODO(burnik): Make sure this is the right way to do it. | 1552 # TODO(burnik): Make sure this is the right way to do it. |
| 1568 if self.should_use_wptserve(test_input.test_name): | 1553 if self.should_use_wptserve(test_input.test_name): |
| 1569 return False | 1554 return False |
| 1570 return True | 1555 return True |
| 1571 | 1556 |
| 1572 def should_run_pixel_test_first(self, test_input): | 1557 def should_run_pixel_test_first(self, test_input): |
| 1573 return any(test_input.test_name.startswith( | 1558 return any(test_input.test_name.startswith( |
| 1574 directory) for directory in self._options.image_first_tests) | 1559 directory) for directory in self._options.image_first_tests) |
| 1575 | 1560 |
| 1576 def _convert_path(self, path): | |
| 1577 """Handles filename conversion for subprocess command line args.""" | |
| 1578 # See note above in diff_image() for why we need this. | |
| 1579 if sys.platform == 'cygwin': | |
| 1580 return cygpath(path) | |
| 1581 return path | |
| 1582 | |
| 1583 def _build_path(self, *comps): | 1561 def _build_path(self, *comps): |
| 1584 return self._build_path_with_target(self._options.target, *comps) | 1562 return self._build_path_with_target(self._options.target, *comps) |
| 1585 | 1563 |
| 1586 def _build_path_with_target(self, target, *comps): | 1564 def _build_path_with_target(self, target, *comps): |
| 1587 # Note that we don't do the option caching that the base class does, | 1565 # Note that we don't do the option caching that the base class does, |
| 1588 # because finding the right directory is relatively fast. | 1566 # because finding the right directory is relatively fast. |
| 1589 target = target or self.get_option('target') | 1567 target = target or self.get_option('target') |
| 1590 return self._static_build_path(self._filesystem, self.get_option('build_
directory'), | 1568 return self._static_build_path(self._filesystem, self.get_option('build_
directory'), |
| 1591 self.path_from_chromium_base(), target, c
omps) | 1569 self.path_from_chromium_base(), target, c
omps) |
| 1592 | 1570 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 | 1617 |
| 1640 def __init__(self, base, args, reference_args=None): | 1618 def __init__(self, base, args, reference_args=None): |
| 1641 self.name = base | 1619 self.name = base |
| 1642 self.base = base | 1620 self.base = base |
| 1643 self.args = args | 1621 self.args = args |
| 1644 self.reference_args = args if reference_args is None else reference_args | 1622 self.reference_args = args if reference_args is None else reference_args |
| 1645 self.tests = set() | 1623 self.tests = set() |
| 1646 | 1624 |
| 1647 def __repr__(self): | 1625 def __repr__(self): |
| 1648 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base,
self.args, self.reference_args) | 1626 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base,
self.args, self.reference_args) |
| OLD | NEW |