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