mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix run_dromaeo.py (#33239)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
b2a9184ddc
commit
c69acd1848
2 changed files with 16 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,6 +12,7 @@
|
||||||
/python/_venv*
|
/python/_venv*
|
||||||
/python/tidy/servo_tidy.egg-info
|
/python/tidy/servo_tidy.egg-info
|
||||||
/tests/wpt/sync
|
/tests/wpt/sync
|
||||||
|
/tests/dromaeo/dromaeo
|
||||||
*.pkl
|
*.pkl
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import BaseHTTPServer
|
import urllib
|
||||||
import SimpleHTTPServer
|
|
||||||
import urlparse
|
|
||||||
import json
|
import json
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
|
|
||||||
# Port to run the HTTP server on for Dromaeo.
|
# Port to run the HTTP server on for Dromaeo.
|
||||||
|
@ -29,16 +29,19 @@ def print_usage():
|
||||||
print("USAGE: {0} tests servo_binary dromaeo_base_dir".format(sys.argv[0]))
|
print("USAGE: {0} tests servo_binary dromaeo_base_dir".format(sys.argv[0]))
|
||||||
|
|
||||||
|
|
||||||
|
post_data = None
|
||||||
|
|
||||||
|
|
||||||
# Handle the POST at the end
|
# Handle the POST at the end
|
||||||
class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class RequestHandler(SimpleHTTPRequestHandler):
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
|
global post_data
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write("<HTML>POST OK.<BR><BR>")
|
self.wfile.write(b"<HTML>POST OK.<BR><BR>")
|
||||||
length = int(self.headers.getheader('content-length'))
|
length = int(self.headers.get('content-length'))
|
||||||
parameters = urlparse.parse_qs(self.rfile.read(length))
|
parameters = urllib.parse.parse_qs(self.rfile.read(length))
|
||||||
self.server.got_post = True
|
post_data = parameters[b'data']
|
||||||
self.server.post_data = parameters['data']
|
|
||||||
|
|
||||||
def log_message(self, format, *args):
|
def log_message(self, format, *args):
|
||||||
return
|
return
|
||||||
|
@ -57,14 +60,13 @@ if __name__ == '__main__':
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Start the test server
|
# Start the test server
|
||||||
server = BaseHTTPServer.HTTPServer(('', TEST_SERVER_PORT), RequestHandler)
|
server = HTTPServer(('', TEST_SERVER_PORT), RequestHandler)
|
||||||
|
|
||||||
print("Testing Dromaeo on Servo!")
|
print("Testing Dromaeo on Servo!")
|
||||||
proc = run_servo(servo_exe, tests)
|
proc = run_servo(servo_exe, tests)
|
||||||
server.got_post = False
|
while not post_data:
|
||||||
while not server.got_post:
|
|
||||||
server.handle_request()
|
server.handle_request()
|
||||||
data = json.loads(server.post_data[0])
|
data = json.loads(post_data[0])
|
||||||
number = 0
|
number = 0
|
||||||
length = 0
|
length = 0
|
||||||
for test in data:
|
for test in data:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue