| 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 16 matching lines...) Expand all Loading... |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 """Abstract base class of Port-specific entry points for the layout tests | 29 """Abstract base class of Port-specific entry points for the layout tests |
| 30 test infrastructure (the Port and Driver classes).""" | 30 test infrastructure (the Port and Driver classes).""" |
| 31 | 31 |
| 32 import cgi | 32 import cgi |
| 33 import difflib | 33 import difflib |
| 34 import errno | 34 import errno |
| 35 import itertools | 35 import itertools |
| 36 import logging | 36 import logging |
| 37 import os | 37 import math |
| 38 import operator | 38 import operator |
| 39 import optparse | 39 import optparse |
| 40 import math | 40 import os |
| 41 import re | 41 import re |
| 42 import subprocess |
| 42 import sys | 43 import sys |
| 43 | 44 |
| 44 try: | 45 try: |
| 45 from collections import OrderedDict | 46 from collections import OrderedDict |
| 46 except ImportError: | 47 except ImportError: |
| 47 # Needed for Python < 2.7 | 48 # Needed for Python < 2.7 |
| 48 from webkitpy.thirdparty.ordered_dict import OrderedDict | 49 from webkitpy.thirdparty.ordered_dict import OrderedDict |
| 49 | 50 |
| 50 | 51 |
| 51 from webkitpy.common import find_files | 52 from webkitpy.common import find_files |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 """Does the port require an HTTP server for running tests? This could | 1092 """Does the port require an HTTP server for running tests? This could |
| 1092 be the case when the tests aren't run on the host platform.""" | 1093 be the case when the tests aren't run on the host platform.""" |
| 1093 return True | 1094 return True |
| 1094 | 1095 |
| 1095 def start_http_server(self, additional_dirs, number_of_drivers): | 1096 def start_http_server(self, additional_dirs, number_of_drivers): |
| 1096 """Start a web server. Raise an error if it can't start or is already ru
nning. | 1097 """Start a web server. Raise an error if it can't start or is already ru
nning. |
| 1097 | 1098 |
| 1098 Ports can stub this out if they don't need a web server to be running.""
" | 1099 Ports can stub this out if they don't need a web server to be running.""
" |
| 1099 assert not self._http_server, 'Already running an http server.' | 1100 assert not self._http_server, 'Already running an http server.' |
| 1100 | 1101 |
| 1101 server = apache_http.ApacheHTTP(self, self.results_directory(), | 1102 self._http_server = subprocess.Popen([ |
| 1102 additional_dirs=additional_dirs, | 1103 self.path_to_script('sky_server'), |
| 1103 number_of_servers=number_of_drivers) | 1104 '-t', self.get_option('configuration'), |
| 1104 server.start() | 1105 self.path_from_chromium_base(), |
| 1105 self._http_server = server | 1106 '8000', |
| 1107 ]) |
| 1106 | 1108 |
| 1107 def start_websocket_server(self): | 1109 def start_websocket_server(self): |
| 1108 """Start a web server. Raise an error if it can't start or is already ru
nning. | 1110 """Start a web server. Raise an error if it can't start or is already ru
nning. |
| 1109 | 1111 |
| 1110 Ports can stub this out if they don't need a websocket server to be runn
ing.""" | 1112 Ports can stub this out if they don't need a websocket server to be runn
ing.""" |
| 1111 assert not self._websocket_server, 'Already running a websocket server.' | 1113 assert not self._websocket_server, 'Already running a websocket server.' |
| 1112 | 1114 |
| 1113 server = pywebsocket.PyWebSocket(self, self.results_directory()) | 1115 server = pywebsocket.PyWebSocket(self, self.results_directory()) |
| 1114 server.start() | 1116 server.start() |
| 1115 self._websocket_server = server | 1117 self._websocket_server = server |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1131 self._helper.stdin.close() | 1133 self._helper.stdin.close() |
| 1132 self._helper.wait() | 1134 self._helper.wait() |
| 1133 except IOError, e: | 1135 except IOError, e: |
| 1134 pass | 1136 pass |
| 1135 finally: | 1137 finally: |
| 1136 self._helper = None | 1138 self._helper = None |
| 1137 | 1139 |
| 1138 def stop_http_server(self): | 1140 def stop_http_server(self): |
| 1139 """Shut down the http server if it is running. Do nothing if it isn't.""
" | 1141 """Shut down the http server if it is running. Do nothing if it isn't.""
" |
| 1140 if self._http_server: | 1142 if self._http_server: |
| 1141 self._http_server.stop() | 1143 self._http_server.terminate() |
| 1142 self._http_server = None | 1144 self._http_server = None |
| 1143 | 1145 |
| 1144 def stop_websocket_server(self): | 1146 def stop_websocket_server(self): |
| 1145 """Shut down the websocket server if it is running. Do nothing if it isn
't.""" | 1147 """Shut down the websocket server if it is running. Do nothing if it isn
't.""" |
| 1146 if self._websocket_server: | 1148 if self._websocket_server: |
| 1147 self._websocket_server.stop() | 1149 self._websocket_server.stop() |
| 1148 self._websocket_server = None | 1150 self._websocket_server = None |
| 1149 | 1151 |
| 1150 # | 1152 # |
| 1151 # TEST EXPECTATION-RELATED METHODS | 1153 # TEST EXPECTATION-RELATED METHODS |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 | 1762 |
| 1761 class PhysicalTestSuite(object): | 1763 class PhysicalTestSuite(object): |
| 1762 def __init__(self, base, args): | 1764 def __init__(self, base, args): |
| 1763 self.name = base | 1765 self.name = base |
| 1764 self.base = base | 1766 self.base = base |
| 1765 self.args = args | 1767 self.args = args |
| 1766 self.tests = set() | 1768 self.tests = set() |
| 1767 | 1769 |
| 1768 def __repr__(self): | 1770 def __repr__(self): |
| 1769 return "PhysicalTestSuite('%s', '%s', %s)" % (self.name, self.base, self
.args) | 1771 return "PhysicalTestSuite('%s', '%s', %s)" % (self.name, self.base, self
.args) |
| OLD | NEW |