Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server.py

Issue 150573014: Rename various methods in webkitpy.layout_test.Port to be public (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove port.check_httpd stub call from port_testcase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 test_dir = self._port_obj.layout_tests_dir() 62 test_dir = self._port_obj.layout_tests_dir()
63 js_test_resources_dir = self._filesystem.join(test_dir, "resources") 63 js_test_resources_dir = self._filesystem.join(test_dir, "resources")
64 media_resources_dir = self._filesystem.join(test_dir, "media") 64 media_resources_dir = self._filesystem.join(test_dir, "media")
65 mime_types_path = self._filesystem.join(test_dir, "http", "conf", "mime. types") 65 mime_types_path = self._filesystem.join(test_dir, "http", "conf", "mime. types")
66 cert_file = self._filesystem.join(test_dir, "http", "conf", "webkit-http d.pem") 66 cert_file = self._filesystem.join(test_dir, "http", "conf", "webkit-http d.pem")
67 access_log = self._filesystem.join(output_dir, "access_log.txt") 67 access_log = self._filesystem.join(output_dir, "access_log.txt")
68 error_log = self._filesystem.join(output_dir, "error_log.txt") 68 error_log = self._filesystem.join(output_dir, "error_log.txt")
69 document_root = self._filesystem.join(test_dir, "http", "tests") 69 document_root = self._filesystem.join(test_dir, "http", "tests")
70 70
71 # FIXME: We shouldn't be calling a protected method of _port_obj! 71 executable = self._port_obj.path_to_apache()
72 executable = self._port_obj._path_to_apache()
73 72
74 start_cmd = [executable, 73 start_cmd = [executable,
75 '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_ dir), 74 '-f', "\"%s\"" % self._port_obj.path_to_apache_config_file(),
76 '-C', "\'DocumentRoot \"%s\"\'" % document_root, 75 '-C', "\'DocumentRoot \"%s\"\'" % document_root,
77 '-c', "\'Alias /js-test-resources \"%s\"'" % js_test_resources_dir, 76 '-c', "\'Alias /js-test-resources \"%s\"'" % js_test_resources_dir,
78 '-c', "\'Alias /media-resources \"%s\"'" % media_resources_dir, 77 '-c', "\'Alias /media-resources \"%s\"'" % media_resources_dir,
79 '-c', "\'TypesConfig \"%s\"\'" % mime_types_path, 78 '-c', "\'TypesConfig \"%s\"\'" % mime_types_path,
80 '-c', "\'CustomLog \"%s\" common\'" % access_log, 79 '-c', "\'CustomLog \"%s\" common\'" % access_log,
81 '-c', "\'ErrorLog \"%s\"\'" % error_log, 80 '-c', "\'ErrorLog \"%s\"\'" % error_log,
82 '-C', "\'User \"%s\"\'" % os.environ.get("USERNAME", os.environ.get( "USER", "")), 81 '-C', "\'User \"%s\"\'" % os.environ.get("USERNAME", os.environ.get( "USER", "")),
83 '-c', "\'PidFile %s'" % self._pid_file, 82 '-c', "\'PidFile %s'" % self._pid_file,
84 '-k', "start"] 83 '-k', "start"]
85 84
(...skipping 28 matching lines...) Expand all
114 '-c', "\'<Location %s>\'" % alias, 113 '-c', "\'<Location %s>\'" % alias,
115 '-c', "\'RemoveHandler .cgi .pl\'", 114 '-c', "\'RemoveHandler .cgi .pl\'",
116 '-c', "\'</Location>\'"] 115 '-c', "\'</Location>\'"]
117 116
118 if self._number_of_servers: 117 if self._number_of_servers:
119 start_cmd += ['-c', "\'StartServers %d\'" % self._number_of_servers, 118 start_cmd += ['-c', "\'StartServers %d\'" % self._number_of_servers,
120 '-c', "\'MinSpareServers %d\'" % self._number_of_serve rs, 119 '-c', "\'MinSpareServers %d\'" % self._number_of_serve rs,
121 '-c', "\'MaxSpareServers %d\'" % self._number_of_serve rs] 120 '-c', "\'MaxSpareServers %d\'" % self._number_of_serve rs]
122 121
123 stop_cmd = [executable, 122 stop_cmd = [executable,
124 '-f', "\"%s\"" % self._get_apache_config_file_path(test_dir, output_ dir), 123 '-f', "\"%s\"" % self._port_obj.path_to_apache_config_file(),
125 '-c', "\'PidFile %s'" % self._pid_file, 124 '-c', "\'PidFile %s'" % self._pid_file,
126 '-k', "stop"] 125 '-k', "stop"]
127 126
128 start_cmd.extend(['-c', "\'SSLCertificateFile %s\'" % cert_file]) 127 start_cmd.extend(['-c', "\'SSLCertificateFile %s\'" % cert_file])
129 # Join the string here so that Cygwin/Windows and Mac/Linux 128 # Join the string here so that Cygwin/Windows and Mac/Linux
130 # can use the same code. Otherwise, we could remove the single 129 # can use the same code. Otherwise, we could remove the single
131 # quotes above and keep cmd as a sequence. 130 # quotes above and keep cmd as a sequence.
132 # FIXME: It's unclear if this is still needed. 131 # FIXME: It's unclear if this is still needed.
133 self._start_cmd = " ".join(start_cmd) 132 self._start_cmd = " ".join(start_cmd)
134 self._stop_cmd = " ".join(stop_cmd) 133 self._stop_cmd = " ".join(stop_cmd)
135 134
136 def _get_apache_config_file_path(self, test_dir, output_dir):
137 """Returns the path to the apache config file to use.
138 Args:
139 test_dir: absolute path to the LayoutTests directory.
140 output_dir: absolute path to the layout test results directory.
141 """
142 httpd_config = self._port_obj._path_to_apache_config_file()
143 httpd_config_copy = os.path.join(output_dir, "httpd.conf")
144 httpd_conf = self._filesystem.read_text_file(httpd_config)
145
146 # FIXME: Why do we need to copy the config file since we're not modifyin g it?
147 self._filesystem.write_text_file(httpd_config_copy, httpd_conf)
148
149 return httpd_config_copy
150
151 def _spawn_process(self): 135 def _spawn_process(self):
152 _log.debug('Starting %s server, cmd="%s"' % (self._name, str(self._start _cmd))) 136 _log.debug('Starting %s server, cmd="%s"' % (self._name, str(self._start _cmd)))
153 retval, err = self._run(self._start_cmd) 137 retval, err = self._run(self._start_cmd)
154 if retval or len(err): 138 if retval or len(err):
155 raise http_server_base.ServerError('Failed to start %s: %s' % (self. _name, err)) 139 raise http_server_base.ServerError('Failed to start %s: %s' % (self. _name, err))
156 140
157 # For some reason apache isn't guaranteed to have created the pid file b efore 141 # For some reason apache isn't guaranteed to have created the pid file b efore
158 # the process exits, so we wait a little while longer. 142 # the process exits, so we wait a little while longer.
159 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f ile)): 143 if not self._wait_for_action(lambda: self._filesystem.exists(self._pid_f ile)):
160 raise http_server_base.ServerError('Failed to start %s: no pid file found' % self._name) 144 raise http_server_base.ServerError('Failed to start %s: no pid file found' % self._name)
(...skipping 22 matching lines...) Expand all
183 # the sake of Window/Cygwin and it needs quoting that breaks 167 # the sake of Window/Cygwin and it needs quoting that breaks
184 # shell=False. 168 # shell=False.
185 # FIXME: We should not need to be joining shell arguments into strings. 169 # FIXME: We should not need to be joining shell arguments into strings.
186 # shell=True is a trail of tears. 170 # shell=True is a trail of tears.
187 # Note: Not thread safe: http://bugs.python.org/issue2320 171 # Note: Not thread safe: http://bugs.python.org/issue2320
188 process = self._executive.popen(cmd, shell=True, stderr=self._executive. PIPE) 172 process = self._executive.popen(cmd, shell=True, stderr=self._executive. PIPE)
189 process.wait() 173 process.wait()
190 retval = process.returncode 174 retval = process.returncode
191 err = process.stderr.read() 175 err = process.stderr.read()
192 return (retval, err) 176 return (retval, err)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698